simple code cleanup

This commit is contained in:
2025-12-17 18:50:04 +01:00
parent c8c44d0453
commit 57a7e0c571
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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