Skip to content

Commit 2bc3a2d

Browse files
authored
Update SugarscapeG1mt for automatic time advancement
1 parent 1d67252 commit 2bc3a2d

File tree

1 file changed

+2
-4
lines changed
  • examples/sugarscape_g1mt/sugarscape_g1mt

1 file changed

+2
-4
lines changed

examples/sugarscape_g1mt/sugarscape_g1mt/model.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def step(self):
150150

151151
if not self.enable_trade:
152152
# If trade is not enabled, return early
153-
self._steps += 1
154153
self.datacollector.collect(self)
155154
return
156155

@@ -159,7 +158,6 @@ def step(self):
159158
for agent in trader_shuffle:
160159
agent.trade_with_neighbors()
161160

162-
self._steps += 1
163161
# collect model level data
164162
self.datacollector.collect(self)
165163
"""
@@ -175,11 +173,11 @@ def step(self):
175173
"""
176174
# Need to remove excess data
177175
# Create local variable to store trade data
178-
agent_trades = self.datacollector._agent_records[self._steps]
176+
agent_trades = self.datacollector._agent_records[self.steps]
179177
# Get rid of all None to reduce data storage needs
180178
agent_trades = [agent for agent in agent_trades if agent[2] is not None]
181179
# Reassign the dictionary value with lean trade data
182-
self.datacollector._agent_records[self._steps] = agent_trades
180+
self.datacollector._agent_records[self.steps] = agent_trades
183181

184182
def run_model(self, step_count=1000):
185183
for i in range(step_count):

0 commit comments

Comments
 (0)