26 lines
698 B
Python
26 lines
698 B
Python
import uuid
|
|
from abc import ABC
|
|
class BaseAgent(ABC):
|
|
_bal="balance"
|
|
def __init__(self,simulation) -> None:
|
|
"""
|
|
Base class of an agent.
|
|
Simulation: to register tick method at.
|
|
"""
|
|
self.id=uuid.uuid4()
|
|
self.simulation=simulation
|
|
simulation.register_agent(self.id,self.tick,self.reset)
|
|
pass
|
|
def tick(self,tick,episode):
|
|
"""
|
|
Tick method for simulation to call to execute selected action
|
|
"""
|
|
assert "No Tick method has been provided"
|
|
pass
|
|
|
|
def reset(self,episode):
|
|
"""
|
|
Resets agent to new episode.
|
|
"""
|
|
assert "No reset method has been provided"
|
|
pass |