1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-14 23:42:29 +00:00
soil/benchmarks/noop/soilent_step.py

25 lines
551 B
Python
Raw Normal View History

2023-05-03 10:07:55 +00:00
from soil import BaseAgent, Environment, Simulation
from soilent import Scheduler
class NoopAgent(BaseAgent):
num_calls = 0
def step(self):
self.num_calls += 1
class NoopEnvironment(Environment):
num_agents = 100
schedule_class = Scheduler
def init(self):
self.add_agents(NoopAgent, k=self.num_agents)
self.add_agent_reporter("num_calls")
if __name__ == "__main__":
from _config import *
res = run_sim(model=NoopEnvironment)
for r in res:
assert isinstance(r.schedule, Scheduler)