|
MTCT
Design Automation and Optimization for ETCS Railway Networks
|
The trains of an instance together with what they are to do. More...
#include <Timetable.hpp>
Public Member Functions | |
| Timetable ()=default | |
| Creates an empty timetable. | |
| Timetable (StationList station_list, TrainList train_list, const std::vector< Schedule > &schedules) | |
| Constructs a timetable from explicit station, train, and schedule data. | |
| Timetable (const std::filesystem::path &p, const Network &network) | |
| Loads a timetable from a filesystem path. | |
| Timetable (const std::string &path, const Network &network) | |
| Constructs a timetable from a file path specified as a string. | |
| Timetable (char const *const path, Network const &network) | |
| Constructs a timetable from a C-string path. | |
| Timetable (const Timetable &other) | |
| Copy constructor that performs a deep copy. | |
| Timetable & | operator= (const Timetable &other) |
| Copy assignment operator that performs a deep copy. | |
| Timetable (Timetable &&) noexcept=default | |
| Move constructor. | |
| Timetable & | operator= (Timetable &&) noexcept=default |
| Move assignment operator. | |
| constexpr auto | begin () const |
| Provides a read-only iterator to the first schedule. | |
| constexpr auto | end () const |
| Provides the end iterator for iterating over schedules. | |
| constexpr auto | cbegin () const |
| Read-only iterator to the first schedule (explicit const). | |
| constexpr auto | cend () const |
| Returns a const iterator to one past the last schedule. | |
| constexpr auto | crbegin () const |
| Const reverse iterator to the last schedule. | |
| constexpr auto | crend () const |
| Read-only reverse iterator before the first schedule. | |
| void | export_timetable (const std::filesystem::path &p, const Network &network) const |
| Exports the timetable to the given filesystem path. | |
| void | export_timetable (const std::string &path, const Network &network) const |
| Writes the timetable to a file. | |
| void | export_timetable (char const *const path, Network const &network) const |
| Exports the timetable to a file. | |
| StationList const & | get_station_list () const |
| Provides access to the station list. | |
| TrainList const & | get_train_list () const |
| Provides access to the train list. | |
| Schedule const & | get_schedule (size_t const trainIndex) const |
| Retrieves the schedule for a given train. | |
| Schedule const & | get_schedule (std::string const &train_name) const |
| Retrieves the schedule for a train by name. | |
| double | latest_exit_time () const |
| Returns the latest scheduled exit time across all trains. | |
| Train & | editable_train (size_t const index) |
| Provides mutable access to a train by index. | |
| Train & | editable_train (std::string const &name) |
| Obtains a mutable reference to a train by name. | |
| Schedule & | editable_schedule (size_t const trainIndex) |
| Provides mutable access to the schedule of a train. | |
| Schedule & | editable_schedule (std::string const &train_name) |
| Provides mutable access to the schedule of a train by name. | |
| std::vector< std::pair< size_t, std::vector< cda_rail::index_vector > > > | get_stop_tracks (size_t const tr, std::string const &station_name, Network const &network, cda_rail::index_set const &edges_to_consider) const |
| Retrieves available track segments for a train at a station. | |
| void | add_empty_station (const std::string &station_name) |
| Adds a new station to the timetable with no scheduled stops. | |
| void | insert_stop (size_t train_index, std::string const &station_name, double service_time, double service_duration) |
| Inserts a scheduled stop for a train identified by index. | |
| void | insert_stop (std::string const &train_name, std::string const &station_name, double const serviceTime, double const serviceDuration) |
| Inserts a scheduled stop for a train identified by name. | |
| void | remove_stop (size_t train_index, std::string const &station_name, bool throw_exception_if_not_existent=true) |
| Removes a stop from a train's schedule by train index. | |
| void | remove_stop (std::string const &train_name, std::string const &station_name, bool throw_exception_if_not_existent=true) |
| Removes a stop from a train's schedule by station name. | |
| void | add_track_to_station (std::string const &station_name, Network::EdgeInput const &new_edge, Network const &network) |
| Adds a new track to the specified station. | |
| size_t | add_train (std::string const &train_name, double length, double max_speed, double acceleration, double deceleration, bool tim, double entry_time, double initial_velocity, Network::VertexInput const &entry_vertex, double exit_time, double exit_velocity, Network::VertexInput const &exit_vertex, Network const &network) |
| Adds a train to the timetable with specified entry/exit constraints. | |
| size_t | add_train (std::string const &train_name, double length, double max_speed, double acceleration, double deceleration, double entry_time, double initial_velocity, Network::VertexInput const &entry_vertex, double exit_time, double exit_velocity, Network::VertexInput const &exit_vertex, Network const &network) |
| Adds a new train to the timetable. | |
| bool | check_consistency (Network const &network) const |
| Checks whether timetable data is consistent with the network. | |
| void | update_after_discretization (std::vector< std::pair< size_t, cda_rail::index_set > > const &new_edges) |
| Updates the timetable after network discretization. | |
| void | update_after_discretization (std::vector< std::pair< size_t, cda_rail::index_vector > > const &new_edges) |
| Updates the timetable after discretization. | |
| std::pair< size_t, size_t > | time_index_interval (size_t train_index, double dt, bool tn_inclusive=true) const |
| Returns the discrete time-index interval relevant for one train. | |
| std::pair< size_t, size_t > | time_index_interval (std::string const &train_name, double const dt, bool const tnInclusive=true) const |
| Computes the time index interval for a train, identified by name. | |
Static Public Member Functions | |
| static Timetable | import_timetable (const std::string &path, const Network &network) |
| Imports a timetable from a file. | |
| static Timetable | import_timetable (const std::filesystem::path &p, const Network &network) |
| Imports a timetable from a file. | |
| static Timetable | import_timetable (char const *const path, const Network &network) |
| Loads a timetable from a file. | |
The trains of an instance together with what they are to do.
Holds the stations, the trains, and one schedule per train, where the schedule of a train is stored at the index the train has in the train list. The stops of a schedule refer to the stations of this timetable, which is why a timetable is deep copied.
|
default |
Creates an empty timetable.
| cda_rail::Timetable::Timetable | ( | StationList | station_list, |
| TrainList | train_list, | ||
| const std::vector< Schedule > & | schedules ) |
| cda_rail::Timetable::Timetable | ( | const std::filesystem::path & | p, |
| const Network & | network ) |
Loads a timetable from a filesystem path.
| p | Path to the timetable data. |
| network | Network used for validation and vertex resolution. |
|
inline |
Constructs a timetable from a file path specified as a string.
| path | Path to the timetable data. |
|
inline |
Constructs a timetable from a C-string path.
| path | C-string path to the timetable file. |
| network | Network used for vertex validation. |
|
inline |
Copy constructor that performs a deep copy.
Creates new Station objects and updates all ScheduledStop references to point to the corresponding stations in the copied StationList.
| other | The Timetable to copy from. |
|
defaultnoexcept |
Move constructor.
|
inline |
Adds a new station to the timetable with no scheduled stops.
| station_name | Name of the station to add. |
|
inline |
|
inlinenodiscard |
Adds a train to the timetable with specified entry/exit constraints.
| train_name | The name identifier for the train. |
| length | The train's length. |
| max_speed | The train's maximum speed. |
| acceleration | The train's acceleration rate. |
| deceleration | The train's deceleration rate. |
| tim | Whether the train operates in time-independent movement mode. |
| entry_time | The service start time at the entry vertex. |
| initial_velocity | The velocity at entry. |
| entry_vertex | The entry vertex specification. |
| exit_time | The service end time at the exit vertex. |
| exit_velocity | The velocity at exit. |
| exit_vertex | The exit vertex specification. |
|
inlinenodiscard |
Adds a new train to the timetable.
| train_name | Name of the train. |
| length | Train length. |
| max_speed | Maximum speed. |
| acceleration | Acceleration rate. |
| deceleration | Deceleration rate. |
| entry_time | Scheduled entry time. |
| initial_velocity | Velocity at entry. |
| entry_vertex | Entry vertex; resolved against the network. |
| exit_time | Scheduled exit time. |
| exit_velocity | Velocity at exit. |
| exit_vertex | Exit vertex; resolved against the network. |
| network | Network to resolve vertex inputs against. |
|
inlinenodiscardconstexpr |
Provides a read-only iterator to the first schedule.
|
inlinenodiscardconstexpr |
Read-only iterator to the first schedule (explicit const).
|
inlinenodiscardconstexpr |
Returns a const iterator to one past the last schedule.
|
nodiscard |
Checks whether timetable data is consistent with the network.
Verifies that entry and exit vertices exist and are terminal vertices, station tracks refer to valid network edges, scheduled stops are ordered by service time and use distinct stations, and each stop's service interval is contained in the train's entry/exit time window.
| network | The network to which the timetable belongs. |
|
inlinenodiscardconstexpr |
Const reverse iterator to the last schedule.
|
inlinenodiscardconstexpr |
Read-only reverse iterator before the first schedule.
|
inlinenodiscard |
Provides mutable access to the schedule of a train.
| trainIndex | The index of the train. |
| exceptions::TrainNotExistentException | if the train does not exist. |
|
inlinenodiscard |
Provides mutable access to the schedule of a train by name.
| train_name | Name of the train. |
| exceptions::TrainNotExistentException | if the train does not exist. |
|
inlinenodiscard |
Provides mutable access to a train by index.
|
inlinenodiscard |
|
inlinenodiscardconstexpr |
Provides the end iterator for iterating over schedules.
|
inline |
Exports the timetable to a file.
| void cda_rail::Timetable::export_timetable | ( | const std::filesystem::path & | p, |
| const Network & | network ) const |
Exports the timetable to the given filesystem path.
| p | Output path. |
| network | Network context used during export. |
|
inline |
Writes the timetable to a file.
| path | File path where the timetable should be written. |
| network | Network context used for the export. |
|
inlinenodiscard |
Retrieves the schedule for a given train.
| trainIndex | The index of the train. |
| exceptions::TrainNotExistentException | if the train does not exist. |
|
inlinenodiscard |
Retrieves the schedule for a train by name.
| train_name | Name of the train. |
| exceptions::TrainNotExistentException | if the train does not exist. |
|
inlinenodiscard |
Provides access to the station list.
|
inlinenodiscard |
Retrieves available track segments for a train at a station.
| tr | Train index. |
| station_name | Name of the station. |
| network | The network containing track and vertex information. |
| edges_to_consider | Network edges to filter available tracks. |
|
inlinenodiscard |
Provides access to the train list.
| void cda_rail::Timetable::insert_stop | ( | size_t | train_index, |
| std::string const & | station_name, | ||
| double | service_time, | ||
| double | service_duration ) |
Inserts a scheduled stop for a train identified by index.
| train_index | Index of the train. |
| station_name | Name of the station. |
| service_time | Earliest service start time. |
| service_duration | Minimum service duration. |
|
inline |
Inserts a scheduled stop for a train identified by name.
| train_name | Name of the train. |
| station_name | Name of the station. |
| serviceTime | Earliest service start time. |
| serviceDuration | Minimum service duration. |
| cda_rail::exceptions::InvalidInputException | if the station already exists in the train's schedule. |
|
nodiscard |
Returns the latest scheduled exit time across all trains.
Move assignment operator.
| void cda_rail::Timetable::remove_stop | ( | size_t | train_index, |
| std::string const & | station_name, | ||
| bool | throw_exception_if_not_existent = true ) |
Removes a stop from a train's schedule by train index.
| train_index | Index of the train. |
| station_name | Name of the station to remove. |
| throw_exception_if_not_existent | If true, throws when no matching stop exists. |
|
inline |
Removes a stop from a train's schedule by station name.
| train_name | Name of the train. |
| station_name | Name of the station to remove. |
| throw_exception_if_not_existent | If true, throws an exception if the station is not found in the schedule. |
| cda_rail::exceptions::InvalidInputException | If throw_exception_if_not_existent is true and the station is not in the train's schedule. |
|
nodiscard |
Returns the discrete time-index interval relevant for one train.
| train_index | Index of the train. |
| dt | Time discretization step. |
| tn_inclusive | Whether the upper bound includes the final time index. |
|
inlinenodiscard |
Computes the time index interval for a train, identified by name.
| train_name | The name of the train. |
| dt | The time discretization step. |
| tnInclusive | Whether to include the final time index. Defaults to true. |
|
inline |
Updates the timetable after network discretization.
| new_edges | Pairs of vertex IDs and their associated edge indices after discretization. |
|
inline |
Updates the timetable after discretization.
| new_edges | Vector of pairs mapping edge identifiers to their discretized indices. |