Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spell to reduce_memory_delete_vehicle_route_pref #150

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/test_other_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,13 +784,13 @@ def veh_user_function(veh):

assert equal_tolerance(np.nanmean(link1.user_attribute["speed_record"]), 15.89)

def test_reduce_memory_delele_vehicle_route_pref():
def test_reduce_memory_delete_vehicle_route_pref():
W = World(
name="",
deltan=10,
tmax=3000,
print_mode=1, save_mode=1, show_mode=0,
reduce_memory_delele_vehicle_route_pref=False,
reduce_memory_delete_vehicle_route_pref=False,
random_seed=0,
)

Expand Down Expand Up @@ -835,7 +835,7 @@ def test_reduce_memory_delele_vehicle_route_pref():
deltan=10,
tmax=3000,
print_mode=1, save_mode=1, show_mode=0,
reduce_memory_delele_vehicle_route_pref=True,
reduce_memory_delete_vehicle_route_pref=True,
random_seed=0,
)

Expand Down Expand Up @@ -875,4 +875,4 @@ def test_reduce_memory_delele_vehicle_route_pref():
df2 = W.analyzer.area_to_pandas(list(area_dict.values()), list(area_dict.keys()), border_include=True)
print(df2)

assert df1["total_travel_time"][0] == df2["total_travel_time"][0]
assert df1["total_travel_time"][0] == df2["total_travel_time"][0]
12 changes: 6 additions & 6 deletions uxsim/uxsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def __init__(s, W, name, x, y, signal=[0], signal_offset=0, flow_capacity=None,
raise ValueError(f"Node name {s.name} already used by another node. Please specify a unique name.")
s.W.NODES.append(s)
s.W.NODES_NAME_DICT[s.name] = s

def __repr__(s):
return f"<Node {s.name}>"

Expand Down Expand Up @@ -590,6 +590,7 @@ def __init__(s, W, name, start_node, end_node, length, free_flow_speed=20, jam_d
if s.edie_dx < s.u*s.W.DELTAT:
s.edie_dx = s.u*s.W.DELTAT


def __repr__(s):
return f"<Link {s.name}>"

Expand Down Expand Up @@ -979,7 +980,6 @@ def __init__(s, W, orig, dest, departure_time, name=None, route_pref=None, route
s.W.VEHICLES[s.name] = s
s.W.VEHICLES_LIVING[s.name] = s


def __repr__(s):
return f"<Vehicle {s.name}: {s.state}, x={s.x}, link={s.link}>"

Expand Down Expand Up @@ -1086,7 +1086,7 @@ def end_trip(s):

s.record_log(enforce_log=1)

if s.W.reduce_memory_delele_vehicle_route_pref:
if s.W.reduce_memory_delete_vehicle_route_pref:
s.route_pref = None

def carfollow(s):
Expand Down Expand Up @@ -1432,7 +1432,7 @@ def __init__(W, name="", deltan=5, reaction_time=1,
print_mode=1, save_mode=1, show_mode=0, show_progress=1, show_progress_deltat=600,
tmax=None,
vehicle_logging_timestep_interval=1,
reduce_memory_delele_vehicle_route_pref=False,
reduce_memory_delete_vehicle_route_pref=False,
hard_deterministic_mode=False,
meta_data={}, user_attribute=None, user_function=None):
"""
Expand Down Expand Up @@ -1483,7 +1483,7 @@ def __init__(W, name="", deltan=5, reaction_time=1,
If it is longer than the DUO update timestep interval, it is substituted by DUO update timestep interval to maintain reasonable route choice behavior.
hard_deterministic_mode : bool, optional
If True, the simulation will not use any random variables. At a merging node, a link with higher merge_priority will be always prioritized, and vehicles always choose the shortest path. This may be useful for analysis that need strict predictability. Be aware that the simulation results will be significantly different from ones with `hard_deterministic_mode=False`.
reduce_memory_delele_vehicle_route_pref : bool, optional
reduce_memory_delete_vehicle_route_pref : bool, optional
If True, the simulation will delete the route preference of vehicles after its ends. This is useful when the route preference is not needed after the simulation ends.
meta_data : dict, optinal
Meta data for simulation scenario. Can store arbitrary data, such as licences and simulation explanation.
Expand Down Expand Up @@ -1549,7 +1549,7 @@ def __init__(W, name="", deltan=5, reaction_time=1,
W.show_progress_deltat_timestep = int(show_progress_deltat/W.DELTAT)

## memory setting
W.reduce_memory_delele_vehicle_route_pref = reduce_memory_delele_vehicle_route_pref
W.reduce_memory_delete_vehicle_route_pref = reduce_memory_delete_vehicle_route_pref

## system setting
W.name = name
Expand Down