File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,13 @@ def adjust_price(self):
37
37
38
38
# adjust price dynamics based on neighbouring store
39
39
def adjust_price_by_neighbour_store (self ):
40
- neighbors = (self .model .grid .get_neighbors
41
- (self .pos , moore = True , include_center = False ))
40
+ neighbors = self .model .grid .get_neighbors (
41
+ self .pos , moore = True , include_center = False
42
+ )
42
43
if not neighbors :
43
44
return # No adjustment if there are no neighbors
44
45
45
- avg_neighbor_price = np .mean ([neighbor .price for
46
- neighbor in neighbors ])
46
+ avg_neighbor_price = np .mean ([neighbor .price for neighbor in neighbors ])
47
47
price_difference = self .price - avg_neighbor_price
48
48
49
49
# Strategy: Narrow the price gap if it's significantly
Original file line number Diff line number Diff line change 6
6
# Import the model and visualization elements defined
7
7
# in other files of the project.
8
8
from .model import HotellingModel
9
- from .visualization import (agent_portrayal ,
10
- average_price_chart , total_revenue_chart )
9
+ from .visualization import agent_portrayal , average_price_chart , total_revenue_chart
11
10
12
11
# Define the size of the grid that will be used for visualizing
13
12
# the simulation in the web interface.
Original file line number Diff line number Diff line change @@ -31,10 +31,10 @@ def test_price_variance_behavior(expected_to_increase=True):
31
31
32
32
# Checking if the slope of the price variance is as expected
33
33
if expected_to_increase :
34
- assert check_slope (df_model [ "Price Variance" ],
35
- increasing = True ), \
36
- "The price variance should increase over time, but it did not."
34
+ assert check_slope (
35
+ df_model [ "Price Variance" ], increasing = True
36
+ ), "The price variance should increase over time, but it did not."
37
37
else :
38
- assert check_slope (df_model [ "Price Variance" ],
39
- increasing = False ), \
40
- "The price variance should decrease over time, but it did not."
38
+ assert check_slope (
39
+ df_model [ "Price Variance" ], increasing = False
40
+ ), "The price variance should decrease over time, but it did not."
You can’t perform that action at this time.
0 commit comments