Closed edchapman88 closed 1 year ago
Update:
agent_grid
during trading process, simplified trading is implemented so one trade at most per agent occurs in before_step()
update()
are expensive when running without visualization. Instead updates can be done with set_object_location()
(these do equality on the agent based on agent.id()
so can safely be called on agents in the same loc) and a lazy_update()
instead used in the Board
update.Looking a bit more into the way the scheduler works, it looks like the trading needs to all be done within the trader. See the following lines of the scheduler as the scheduler processes events on agents without looking at the grid and using versions of the agent from the previous step.
Initial implementation (6720cb0) of trading inside agent using:
get_traders_read
to get the "before_step" view of the traders locations, inventories, offers.
Current Mechanism:
get_trader_by_id
from gridset_object_location
to put the trader back into the grid at the position it was in beforeself.agent_grid.update()
before doing any further operations on the gridProposed mechanism to look into:
.apply_to_all_values()
method on the grid (which takes a closure)34-rl-trader
, but currently commented out