Files
DicePlayer/diceplayer/optimization/optimization_handler.py
Vitor Hideyoshi 2802f10013
Some checks failed
build and upload / test (3.10) (push) Failing after 1m45s
build and upload / pypi-upload (push) Has been skipped
refactor: restructure dice environment handling and update Python version requirement
2026-03-29 17:57:51 -03:00

38 lines
1.1 KiB
Python

from diceplayer.config.player_config import RoutineType
from diceplayer.dice.dice_wrapper import DiceEnvironmentItem
from diceplayer.environment import Atom
from diceplayer.logger import logger
from diceplayer.state.state_model import StateModel
from pathlib import Path
class OptimizationHandler:
def __init__(self, step_directory: Path):
self.optimization_directory = step_directory / "optimization"
def run(
self,
state: StateModel,
current_cycle: int,
dice_environment: list[Atom],
) -> StateModel:
routine = self._fetch_current_routine(state, current_cycle)
logger.info(
f"Running Optimization - {current_cycle} - {routine} - {self.optimization_directory}"
)
logger.info(dice_environment)
return state
@staticmethod
def _fetch_current_routine(state: StateModel, current_cycle: int) -> RoutineType:
if state.config.type != RoutineType.BOTH:
return state.config.type
if current_cycle < state.config.switch_cyc:
return RoutineType.CHARGE
return RoutineType.GEOMETRY