mirror of
https://github.com/gsi-upm/soil
synced 2025-08-24 12:02:20 +00:00
Add rescheduling for received
This commit is contained in:
@@ -11,6 +11,7 @@ def run_sim(model, **kwargs):
|
||||
dump=False,
|
||||
num_processes=1,
|
||||
parameters={'num_agents': NUM_AGENTS},
|
||||
seed="",
|
||||
max_steps=MAX_STEPS,
|
||||
iterations=NUM_ITERS)
|
||||
opts.update(kwargs)
|
||||
|
@@ -8,7 +8,6 @@ class NoopAgent(Agent):
|
||||
self.num_calls = 0
|
||||
|
||||
def step(self):
|
||||
# import pdb;pdb.set_trace()
|
||||
self.num_calls += 1
|
||||
|
||||
|
||||
|
@@ -10,7 +10,6 @@ class NoopAgent(Agent):
|
||||
self.num_calls = 0
|
||||
|
||||
def step(self):
|
||||
# import pdb;pdb.set_trace()
|
||||
self.num_calls += 1
|
||||
|
||||
|
||||
|
21
benchmarks/noop/soil_state.py
Normal file
21
benchmarks/noop/soil_state.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from soil import Agent, Environment, Simulation, state
|
||||
|
||||
|
||||
class NoopAgent(Agent):
|
||||
num_calls = 0
|
||||
|
||||
@state(default=True)
|
||||
def unique(self):
|
||||
self.num_calls += 1
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
self.add_agent_reporter("num_calls")
|
||||
|
||||
|
||||
from _config import *
|
||||
|
||||
run_sim(model=NoopEnvironment)
|
@@ -1,7 +1,7 @@
|
||||
from soil import BaseAgent, Environment, Simulation
|
||||
from soil import Agent, Environment, Simulation
|
||||
|
||||
|
||||
class NoopAgent(BaseAgent):
|
||||
class NoopAgent(Agent):
|
||||
num_calls = 0
|
||||
|
||||
def step(self):
|
||||
@@ -15,7 +15,6 @@ class NoopEnvironment(Environment):
|
||||
self.add_agent_reporter("num_calls")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from _config import *
|
||||
from _config import *
|
||||
|
||||
run_sim(model=NoopEnvironment)
|
||||
run_sim(model=NoopEnvironment)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from soil import Agent, Environment, Simulation
|
||||
from soilent import Scheduler
|
||||
from soil.time import SoilentActivation
|
||||
|
||||
|
||||
class NoopAgent(Agent):
|
||||
@@ -14,7 +14,7 @@ class NoopAgent(Agent):
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = Scheduler
|
||||
schedule_class = SoilentActivation
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
@@ -26,4 +26,4 @@ if __name__ == "__main__":
|
||||
|
||||
res = run_sim(model=NoopEnvironment)
|
||||
for r in res:
|
||||
assert isinstance(r.schedule, Scheduler)
|
||||
assert isinstance(r.schedule, SoilentActivation)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from soil import Agent, Environment
|
||||
from soilent import PQueueScheduler
|
||||
from soil.time import SoilentPQueueActivation
|
||||
|
||||
|
||||
class NoopAgent(Agent):
|
||||
@@ -12,7 +12,7 @@ class NoopAgent(Agent):
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = PQueueScheduler
|
||||
schedule_class = SoilentPQueueActivation
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
@@ -24,4 +24,4 @@ if __name__ == "__main__":
|
||||
|
||||
res = run_sim(model=NoopEnvironment)
|
||||
for r in res:
|
||||
assert isinstance(r.schedule, PQueueScheduler)
|
||||
assert isinstance(r.schedule, SoilentPQueueActivation)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from soil import Agent, Environment, Simulation
|
||||
from soilent import Scheduler
|
||||
from soil.time import SoilentActivation
|
||||
|
||||
|
||||
class NoopAgent(Agent):
|
||||
@@ -13,7 +13,7 @@ class NoopAgent(Agent):
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = Scheduler
|
||||
schedule_class = SoilentActivation
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
@@ -25,4 +25,4 @@ if __name__ == "__main__":
|
||||
|
||||
res = run_sim(model=NoopEnvironment)
|
||||
for r in res:
|
||||
assert isinstance(r.schedule, Scheduler)
|
||||
assert isinstance(r.schedule, SoilentActivation)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from soil import Agent, Environment
|
||||
from soilent import PQueueScheduler
|
||||
from soil.time import SoilentPQueueActivation
|
||||
|
||||
|
||||
class NoopAgent(Agent):
|
||||
@@ -13,7 +13,7 @@ class NoopAgent(Agent):
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = PQueueScheduler
|
||||
schedule_class = SoilentPQueueActivation
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
@@ -25,4 +25,4 @@ if __name__ == "__main__":
|
||||
|
||||
res = run_sim(model=NoopEnvironment)
|
||||
for r in res:
|
||||
assert isinstance(r.schedule, PQueueScheduler)
|
||||
assert isinstance(r.schedule, SoilentPQueueActivation)
|
||||
|
30
benchmarks/noop/soilent_state.py
Normal file
30
benchmarks/noop/soilent_state.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from soil import Agent, Environment, Simulation, state
|
||||
from soil.time import SoilentActivation
|
||||
|
||||
|
||||
class NoopAgent(Agent):
|
||||
num_calls = 0
|
||||
|
||||
@state(default=True)
|
||||
async def unique(self):
|
||||
while True:
|
||||
self.num_calls += 1
|
||||
# yield self.delay(1)
|
||||
await self.delay()
|
||||
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = SoilentActivation
|
||||
|
||||
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, SoilentActivation)
|
@@ -1,5 +1,5 @@
|
||||
from soil import BaseAgent, Environment, Simulation
|
||||
from soilent import Scheduler
|
||||
from soil.time import SoilentActivation
|
||||
|
||||
|
||||
class NoopAgent(BaseAgent):
|
||||
@@ -10,7 +10,7 @@ class NoopAgent(BaseAgent):
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = Scheduler
|
||||
schedule_class = SoilentActivation
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
@@ -21,4 +21,4 @@ if __name__ == "__main__":
|
||||
from _config import *
|
||||
res = run_sim(model=NoopEnvironment)
|
||||
for r in res:
|
||||
assert isinstance(r.schedule, Scheduler)
|
||||
assert isinstance(r.schedule, SoilentActivation)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
from soil import BaseAgent, Environment, Simulation
|
||||
from soilent import PQueueScheduler
|
||||
from soil.time import SoilentPQueueActivation
|
||||
|
||||
|
||||
class NoopAgent(BaseAgent):
|
||||
@@ -10,7 +10,7 @@ class NoopAgent(BaseAgent):
|
||||
|
||||
class NoopEnvironment(Environment):
|
||||
num_agents = 100
|
||||
schedule_class = PQueueScheduler
|
||||
schedule_class = SoilentPQueueActivation
|
||||
|
||||
def init(self):
|
||||
self.add_agents(NoopAgent, k=self.num_agents)
|
||||
@@ -21,4 +21,4 @@ if __name__ == "__main__":
|
||||
from _config import *
|
||||
res = run_sim(model=NoopEnvironment)
|
||||
for r in res:
|
||||
assert isinstance(r.schedule, PQueueScheduler)
|
||||
assert isinstance(r.schedule, SoilentPqueueActivation)
|
||||
|
Reference in New Issue
Block a user