From 57a7e0c5717132266d55287f96327e9546f647c8 Mon Sep 17 00:00:00 2001 From: Daniel Rosel Date: Wed, 17 Dec 2025 18:50:04 +0100 Subject: [PATCH] simple code cleanup --- sim/rl/engine.py | 7 +++++++ sim/rl/train.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sim/rl/engine.py b/sim/rl/engine.py index 6d913f3..e0caca8 100644 --- a/sim/rl/engine.py +++ b/sim/rl/engine.py @@ -1,3 +1,4 @@ +from os import kill import numpy as np import pandas as pd from abc import ABC, abstractmethod @@ -5,6 +6,11 @@ from typing import Dict, Any from environment import BusinessLogicConstraints +""" +An angine by default should have its own demand estimation mechanism from the observed observations whihc are the computer feature. +From these features we then follow the researc hstructure of q -> p with a testable and must be updatable mechanism. +""" + class BasePricingEngine(ABC): """base interface for all pricing engines""" def __init__(self, constraints: BusinessLogicConstraints, seed: int = 0): @@ -12,6 +18,7 @@ class BasePricingEngine(ABC): self.rng = np.random.default_rng(seed) self.step_count = 0 + @abstractmethod def compute_prices(self, current_prices: np.ndarray, observation: Dict[str, Any]) -> np.ndarray: """compute new prices given current state and observation from environment diff --git a/sim/rl/train.py b/sim/rl/train.py index 41a87ab..ba257de 100644 --- a/sim/rl/train.py +++ b/sim/rl/train.py @@ -39,7 +39,7 @@ class EngineTrainer: obs, _ = self.env.reset(seed=seed) prices = None for ep in range(n_episodes): - prices = self.engine.compute_prices(prices, obs + prices = self.engine.compute_prices(prices, obs) obs, reward, done, _, info = self.env.step(prices) self.engine.update(obs, reward, done, info) return self