mirror of
https://github.com/velocitatem/PHANTOM.git
synced 2026-05-31 08:33:36 +00:00
simple code cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user