1
0
mirror of https://github.com/gsi-upm/soil synced 2024-09-28 02:21:43 +00:00
soil/benchmarks/noop/_config.py
J. Fernando Sánchez 5e93399d58 Initial benchmarking
2023-05-03 12:07:55 +02:00

26 lines
708 B
Python

import os
NUM_AGENTS = int(os.environ.get('NUM_AGENTS', 100))
NUM_ITERS = int(os.environ.get('NUM_ITERS', 10))
MAX_STEPS = int(os.environ.get('MAX_STEPS', 1000))
def run_sim(model, **kwargs):
from soil import Simulation
opts = dict(model=model,
dump=False,
num_processes=1,
parameters={'num_agents': NUM_AGENTS},
max_steps=MAX_STEPS,
iterations=NUM_ITERS)
opts.update(kwargs)
res = Simulation(**opts).run()
total = sum(a.num_calls for e in res for a in e.schedule.agents)
expected = NUM_AGENTS * NUM_ITERS * MAX_STEPS
print(total)
print(expected)
assert total == expected
return res