simulation.trip_manager module

Trip management for the simulation.

class simulation.trip_manager.TripManager(trips_directory: str = 'assets/trips')[source]

Bases: object

Manage trip loading and daily trip assignments for boats.

Loads route CSV files once and then assigns trips per boat and day based on weekday rules, exposing helpers to query trips by slot or date.

assign_daily_trips(boat_name: str, current_date: datetime) List[Trip][source]

Assign trips for a boat for the given day if not already assigned.

Parameters:
  • boat_name – Name of the boat

  • current_date – Current simulation date

Returns:

List of trips assigned for this day (may be empty).

get_trip_for_slot(boat_name: str, current_date: datetime, slot: int) Trip | None[source]

Get the assigned trip for a specific time slot on a given date.

Parameters:
  • boat_name – Name of the boat

  • current_date – Current simulation date

  • slot – Time slot index (e.g. 0 = morning, 1 = afternoon).

Returns:

The assigned trip, or None if no trip exists for this slot.

get_trips_for_date(boat_name: str, current_date: datetime) List[Trip][source]

Get all assigned trips for a boat on a specific date.

Parameters:
  • boat_name – Name of the boat

  • current_date – Date to get trips for

Returns:

List of trips assigned for this date (may be empty).