Skip to content

Commit

Permalink
re-assign vehicles after recombination
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan.schirmeister committed Jan 17, 2025
1 parent 4d5e63d commit 0db1529
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/examples/simba.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rotation_filter_path = data/examples/rotation_filter.csv
# service_optimization finds the largest set of electrified rotations, rotations SOC<0 are removed.
# station_optimization finds the set of fewest stations to electrify all rotations.
# remove_negative removes all negative rotations.
# recombination splits and merges rotations to use the optimal number of busses
# split_negative_depb splits and merges negative rotations to use the optimal number of busses
# report generates simulation output files, including costs.
mode = ["sim", "report"]
#mode = ["sim", "load_pickle", "neg_depb_to_oppb", "service_optimization", "station_optimization", "remove_negative", "split_negative_depb", "report"]
Expand Down
2 changes: 1 addition & 1 deletion simba/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def recombination(schedule, args, trips, depot_trips):
# first trip of new rotation: generate new rotation
rotation = Rotation(id=rot_name, vehicle_type=vt, schedule=schedule)
rotation.allow_opp_charging_for_oppb = original_rotation.allow_opp_charging_for_oppb
rotation.vehicle_id = original_rotation.vehicle_id
rotation.vehicle_id = None # must be re-assigned later
rotation.set_charging_type(ct)

# begin rotation in depot: add initial trip
Expand Down
2 changes: 2 additions & 0 deletions simba/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ def split_negative_depb(schedule, scenario, args, _i):
negative_rotations = schedule.get_negative_rotations(scenario)
trips, depot_trips = optimization.prepare_trips(schedule, negative_rotations)
recombined_schedule = optimization.recombination(schedule, args, trips, depot_trips)
# re-assign vehicles
recombined_schedule.assign_vehicles(args)
# re-run schedule
scenario = recombined_schedule.run(args)
return recombined_schedule, scenario
Expand Down

0 comments on commit 0db1529

Please sign in to comment.