2023-05-03 10:07:55 +00:00
|
|
|
from soil import Agent, Environment, Simulation
|
2023-05-19 14:19:50 +00:00
|
|
|
from soil.time import SoilentActivation
|
2023-05-03 10:07:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class NoopAgent(Agent):
|
|
|
|
num_calls = 0
|
|
|
|
|
|
|
|
def step(self):
|
|
|
|
while True:
|
|
|
|
self.num_calls += 1
|
|
|
|
# yield self.delay(1)
|
|
|
|
yield self.delay()
|
|
|
|
|
|
|
|
class NoopEnvironment(Environment):
|
|
|
|
num_agents = 100
|
2023-05-19 14:19:50 +00:00
|
|
|
schedule_class = SoilentActivation
|
2023-05-03 10:07:55 +00:00
|
|
|
|
|
|
|
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:
|
2023-05-19 14:19:50 +00:00
|
|
|
assert isinstance(r.schedule, SoilentActivation)
|