# arnaudbarth/autonomous-dynamic-pricing architecture

> Architecture diagram of the GitHub repository arnaudbarth/autonomous-dynamic-pricing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arnaudbarth/autonomous-dynamic-pricing
- Repository: https://github.com/arnaudbarth/autonomous-dynamic-pricing

## Overview

This project simulates ticket sales for concerts and trains reinforcement-learning agents to choose prices over a sale horizon, comparing them with a fixed-price baseline. Its workflow is reference-data preparation, buyer and market simulation, a Gymnasium decision interface, agent training or inference, then paired evaluation across shared scenarios. The README also documents ChartMetric artist-data retrieval and OFS demographic calibration. Source excerpts show key simulator and agent links; some data-pipeline and Q-table training details are documented but not sampled, so those connections are limited to documented or indexed evidence.

Main entry points: [`scripts/run_comparison.py`](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/run_comparison.py) (Comparison runner), [`env/gym_wrapper.py`](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/gym_wrapper.py) (Gym environment), [`pricing_agent/registry.py`](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/registry.py) (Model registry), [`scripts/train_dqn.py`](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/train_dqn.py) (DQN training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data calibration"]
  node_chartmetric_client["ChartMetric client<br/>[chartmetric.py]"]
  node_chartmetric_fetch["Artist data fetch"]
  node_reference_data["Reference profiles<br/>[refdata.py]"]
  node_upsert_data["Calibrated datasets"]
end

subgraph group_simulation["Ticket simulation"]
  node_buyer["Virtual buyers<br/>[agents.py]"]
  node_market["Ticket market<br/>[market.py]"]
  node_gym["Gym environment<br/>[gym_wrapper.py]"]
end

subgraph group_agents["Pricing agents"]
  node_fixed["Fixed-price agent<br/>[agent_fixed.py]"]
  node_qtable["Q-table agent<br/>[agent_qtable.py]"]
  node_dqn_agent["DQN agent<br/>[agent_dqn.py]"]
  node_agent_base["Price action mapping<br/>[base.py]"]
  node_model_registry["Model registry<br/>[registry.py]"]
  node_model_files["Trained models"]
  node_dqn_primitives["DQN primitives<br/>[dqn.py]"]
end

subgraph group_experiments["Training evaluation"]
  node_qtable_training["Q-table training<br/>[train_qtable.py]"]
  node_dqn_training["DQN training<br/>[train_dqn.py]"]
  node_comparison_cli["Comparison runner<br/>[run_comparison.py]"]
  node_evaluation["Paired evaluation<br/>[evaluate.py]"]
end

node_organizer(("Event organizer"))
node_chartmetric{{"ChartMetric API"}}

node_organizer -->|"runs comparisons"| node_comparison_cli
node_chartmetric_fetch -->|"uses client"| node_chartmetric_client
node_chartmetric_client -.->|"fetches data"| node_chartmetric
node_chartmetric_fetch -->|"builds artist data"| node_upsert_data
node_upsert_data -->|"calibrates profiles"| node_reference_data
node_reference_data -->|"provides profiles"| node_market
node_reference_data -->|"provides parameters"| node_buyer
node_market -->|"solicits buyers"| node_buyer
node_gym -->|"steps market"| node_market
node_fixed -->|"maps prices"| node_agent_base
node_qtable -->|"discretizes states"| node_gym
node_qtable -->|"loads model"| node_model_registry
node_dqn_agent -->|"loads model"| node_model_registry
node_model_registry -->|"resolves versions"| node_model_files
node_qtable_training -->|"trains in"| node_gym
node_qtable_training -->|"saves model"| node_model_registry
node_dqn_training -->|"trains in"| node_gym
node_dqn_training -->|"uses primitives"| node_dqn_primitives
node_dqn_training -->|"saves checkpoints"| node_model_registry
node_comparison_cli -->|"creates environment"| node_gym
node_comparison_cli -->|"compares baseline"| node_fixed
node_comparison_cli -->|"compares policy"| node_qtable
node_comparison_cli -->|"compares policy"| node_dqn_agent
node_comparison_cli -->|"runs evaluation"| node_evaluation
node_evaluation -->|"runs episodes"| node_gym

click node_chartmetric_client "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/chartmetric.py"
click node_chartmetric_fetch "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/fetch_chartmetric.py"
click node_reference_data "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/refdata.py"
click node_upsert_data "https://github.com/arnaudbarth/autonomous-dynamic-pricing/tree/main/data/upsert"
click node_buyer "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/agents.py"
click node_market "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/market.py"
click node_gym "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/gym_wrapper.py"
click node_fixed "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/agent_fixed.py"
click node_qtable "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/agent_qtable.py"
click node_dqn_agent "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/agent_dqn.py"
click node_agent_base "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/base.py"
click node_model_registry "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/registry.py"
click node_model_files "https://github.com/arnaudbarth/autonomous-dynamic-pricing/tree/main/models/pricingAgents"
click node_dqn_primitives "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/dqn.py"
click node_qtable_training "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/train_qtable.py"
click node_dqn_training "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/train_dqn.py"
click node_comparison_cli "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/run_comparison.py"
click node_evaluation "https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/evaluate.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chartmetric_client,node_chartmetric_fetch,node_reference_data,node_upsert_data toneBlue
class node_buyer,node_market,node_gym toneAmber
class node_fixed,node_qtable,node_dqn_agent,node_agent_base,node_model_registry,node_model_files,node_dqn_primitives,node_chartmetric toneMint
class node_qtable_training,node_dqn_training,node_comparison_cli,node_evaluation toneRose
class node_organizer toneIndigo
```

## Components

### Data calibration

- [ChartMetric client](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/chartmetric.py): `env/chartmetric.py`
- [Artist data fetch](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/fetch_chartmetric.py): `scripts/fetch_chartmetric.py`
- [Reference profiles](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/refdata.py): `env/refdata.py`
- [Calibrated datasets](https://github.com/arnaudbarth/autonomous-dynamic-pricing/tree/main/data/upsert): `data/upsert`

### Ticket simulation

- [Virtual buyers](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/agents.py): `env/agents.py`
- [Ticket market](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/market.py): `env/market.py`
- [Gym environment](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/env/gym_wrapper.py): `env/gym_wrapper.py`

### Pricing agents

- [Fixed-price agent](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/agent_fixed.py): `pricing_agent/agent_fixed.py`
- [Q-table agent](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/agent_qtable.py): `pricing_agent/agent_qtable.py`
- [DQN agent](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/agent_dqn.py): `pricing_agent/agent_dqn.py`
- [Price action mapping](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/base.py): `pricing_agent/base.py`
- [Model registry](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/registry.py): `pricing_agent/registry.py`
- [Trained models](https://github.com/arnaudbarth/autonomous-dynamic-pricing/tree/main/models/pricingAgents): `models/pricingAgents`
- [DQN primitives](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/dqn.py): `pricing_agent/dqn.py`

### Training evaluation

- [Q-table training](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/train_qtable.py): `scripts/train_qtable.py`
- [DQN training](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/train_dqn.py): `scripts/train_dqn.py`
- [Comparison runner](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/scripts/run_comparison.py): `scripts/run_comparison.py`
- [Paired evaluation](https://github.com/arnaudbarth/autonomous-dynamic-pricing/blob/main/pricing_agent/evaluate.py): `pricing_agent/evaluate.py`

### Other components

- **Event organizer**
- **ChartMetric API**

## Connections

- Event organizer → Comparison runner: runs comparisons (evidence: `README.md`)
- Artist data fetch → ChartMetric client: uses client (evidence: `scripts/fetch_chartmetric.py`)
- ChartMetric client → ChartMetric API: fetches data
- Artist data fetch → Calibrated datasets: builds artist data (evidence: `README.md`)
- Calibrated datasets → Reference profiles: calibrates profiles (evidence: `README.md`)
- Reference profiles → Ticket market: provides profiles (evidence: `env/market.py`)
- Reference profiles → Virtual buyers: provides parameters (evidence: `env/agents.py`)
- Ticket market → Virtual buyers: solicits buyers (evidence: `env/market.py`)
- Gym environment → Ticket market: steps market (evidence: `env/gym_wrapper.py`)
- Fixed-price agent → Price action mapping: maps prices (evidence: `pricing_agent/agent_fixed.py`)
- Q-table agent → Gym environment: discretizes states (evidence: `pricing_agent/agent_qtable.py`)
- Q-table agent → Model registry: loads model (evidence: `pricing_agent/agent_qtable.py`)
- DQN agent → Model registry: loads model (evidence: `pricing_agent/agent_dqn.py`)
- Model registry → Trained models: resolves versions (evidence: `pricing_agent/registry.py`)
- Q-table training → Gym environment: trains in (evidence: `scripts/train_qtable.py`)
- Q-table training → Model registry: saves model (evidence: `scripts/train_qtable.py`)
- DQN training → Gym environment: trains in (evidence: `scripts/train_dqn.py`)
- DQN training → DQN primitives: uses primitives (evidence: `scripts/train_dqn.py`)
- DQN training → Model registry: saves checkpoints (evidence: `scripts/train_dqn.py`)
- Comparison runner → Gym environment: creates environment (evidence: `scripts/run_comparison.py`)
- Comparison runner → Fixed-price agent: compares baseline (evidence: `scripts/run_comparison.py`)
- Comparison runner → Q-table agent: compares policy (evidence: `scripts/run_comparison.py`)
- Comparison runner → DQN agent: compares policy (evidence: `scripts/run_comparison.py`)
- Comparison runner → Paired evaluation: runs evaluation (evidence: `scripts/run_comparison.py`)
- Paired evaluation → Gym environment: runs episodes (evidence: `pricing_agent/evaluate.py`)
