Skip to content

Commit 322023b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent aca104e commit 322023b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/hotelling_law/hotelling_law/agents.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,15 @@ def determine_preferred_store(self):
175175
for store in stores:
176176
# Calculate score based on consumer preference
177177
if consumer_preference == "proximity":
178-
score = self.euclidean_distance(self.cell.coordinate, store.cell.coordinate)
178+
score = self.euclidean_distance(
179+
self.cell.coordinate, store.cell.coordinate
180+
)
179181
elif consumer_preference == "price":
180182
score = store.price
181183
else: # Default case includes both proximity and price
182-
score = store.price + self.euclidean_distance(self.cell.coordinate, store.cell.coordinate)
184+
score = store.price + self.euclidean_distance(
185+
self.cell.coordinate, store.cell.coordinate
186+
)
183187

184188
# Update the list of best stores if a new minimum score is found
185189
if score < min_score:

examples/hotelling_law/hotelling_law/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def _initialize_agents(self):
189189
# Randomly place agents on the grid for a grid environment.
190190
x = self.random.randrange(self.grid.dimensions[0])
191191
y = self.random.randrange(self.grid.dimensions[1])
192-
agent.cell = self.grid[(x,y)]
192+
agent.cell = self.grid[(x, y)]
193193

194194
# Place consumer agents
195195
for _ in range(self.num_consumers):
@@ -199,7 +199,7 @@ def _initialize_agents(self):
199199
# Place consumer randomly on the grid
200200
x = self.random.randrange(self.grid.dimensions[0])
201201
y = self.random.randrange(self.grid.dimensions[1])
202-
consumer.cell = self.grid[(x,y)]
202+
consumer.cell = self.grid[(x, y)]
203203

204204
# Method to advance the simulation by one step.
205205
def step(self):

0 commit comments

Comments
 (0)