MTCT
Design Automation and Optimization for ETCS Railway Networks
Loading...
Searching...
No Matches
cda_rail::instances::GeneralPerformanceOptimizationInstance Class Reference

An instance in which the trains are routed as efficiently as possible. More...

#include <GeneralPerformanceOptimizationInstance.hpp>

Inheritance diagram for cda_rail::instances::GeneralPerformanceOptimizationInstance:
cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes cda_rail::instances::GeneralProblemInstance

Public Member Functions

 GeneralPerformanceOptimizationInstance ()=default
 Constructs an instance with default values.
 GeneralPerformanceOptimizationInstance (Network network)
 Constructs an instance from a network.
 GeneralPerformanceOptimizationInstance (Network network, Timetable timetable, RouteMap routes)
 Constructs an instance with a network, timetable, and routes.
 GeneralPerformanceOptimizationInstance (std::string_view instance_name, std::string_view instance_subdirectory, std::filesystem::path const &working_directory)
double get_objective_val (const std::vector< double > &tr_exit_times, const std::vector< std::vector< double > > &stop_times, bool throw_error_if_not_all_stops_specified=true) const
 Evaluates the objective for explicit exit and stop times.
std::vector< std::vector< double > > service_start_times (const std::vector< std::vector< double > > &arrival_times) const
 The stop times of a solution, given the times at which the trains reach their stops, e.g., in a simulation.
double sum_of_weighted_exit_times () const
 Calculates the weighted sum of all (earliest) exit times.
double sum_of_train_weights () const
MinimumRunningTimes minimum_running_times (size_t tr, const cda_rail::index_set &start_edges, bool include_first_edge, double start_time, size_t first_stop, bool consider_earliest_departures) const
 Earliest times at which train tr can serve its remaining stops and reach its exit vertex.
 GeneralPerformanceOptimizationInstance (std::string_view const instanceName, std::string_view const instanceSubdirectory, std::string const &working_directory)
 Constructs an instance from a named subdirectory.
 GeneralPerformanceOptimizationInstance (std::string_view const instanceName, std::string_view const instanceSubdirectory, char const *const workingDirectory)
 Constructs an instance by loading from a specified directory structure.
const auto & get_train_weights () const
 Accesses the per-train weights.
double get_station_delay_weight () const
 Gets the station delay weight.
double get_train_weight (size_t train_index) const
 Retrieves the weight assigned to a specific train.
double get_train_weight (const std::string &train_name) const
 Retrieves the weight of a train by name.
double get_train_weight (const char *train_name) const
 Returns the weight of a train by its name.
void set_station_delay_weight (double new_weight)
 Sets the station-delay weight.
void set_train_weight (size_t train_index, double weight)
 Assigns a weight to a specific train.
void set_train_weight (const std::string &train_name, double weight)
 Sets the weight for a train by its name.
void set_train_weight (const char *train_name, double weight)
 Sets the weight for a train by name.
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, double tr_weight=1)
 Adds a train with an associated weight to the instance.
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, double tr_weight=1)
 Adds a train to the instance with specified characteristics and weight.
void export_instance (const std::filesystem::path &working_directory, bool save_network) const override
 Exports the instance and optionally its network.
void discretize_stops ()
 Discretizes stop edges used by the instance timetable.
bool check_consistency () const override
 Checks if the instance is consistent.
bool check_consistency (bool every_train_must_have_route) const override
 Checks instance consistency under the chosen route-completeness rule.
double get_approximate_leaving_time (size_t train) const
 Returns an approximate leaving time for a train.
double get_maximal_leaving_time (size_t train, double v) const
 Returns a maximal leaving time under a speed bound.
double get_minimal_leaving_time (size_t train, double v) const
 Returns a minimal leaving time under a speed bound.
double get_approximate_leaving_time (const std::string &tr_name) const
 Gets the approximate leaving time for a train by name.
double get_maximal_leaving_time (const std::string &tr_name, double v) const
 Determines the maximum departure time for a train at a specified velocity.
double get_minimal_leaving_time (const std::string &tr_name, double v) const
 Gets the minimal leaving time for a train.
std::pair< size_t, size_t > time_index_interval (size_t train_index, double dt, bool tn_inclusive=true) const
std::pair< size_t, size_t > time_index_interval (const std::string &train_name, double dt, bool tn_inclusive=true) const
cda_rail::index_set trains_at_t (double t) const
cda_rail::index_set trains_at_t (double t, const cda_rail::index_set &trains_to_consider) const
void discretize (const vss::SeparationFunction &sep_func=vss::UNIFORM)
std::vector< std::pair< size_t, cda_rail::index_vector > > separate_edges_at_vss (const std::vector< std::vector< double > > &vss_positions)
 Splits the edges at the given VSS borders, see Network::separate_edges_at_vss, and updates timetable and routes accordingly.
void export_instance (std::filesystem::path const &working_directory) const override
 Exports the instance to the specified working directory without saving the network.
Public Member Functions inherited from cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes
 GeneralProblemInstanceWithScheduleAndRoutes (const GeneralProblemInstanceWithScheduleAndRoutes &)=default
GeneralProblemInstanceWithScheduleAndRoutes & operator= (const GeneralProblemInstanceWithScheduleAndRoutes &)=default
 GeneralProblemInstanceWithScheduleAndRoutes (GeneralProblemInstanceWithScheduleAndRoutes &&) noexcept=default
 Move constructor.
GeneralProblemInstanceWithScheduleAndRoutes & operator= (GeneralProblemInstanceWithScheduleAndRoutes &&) noexcept=default
 ~GeneralProblemInstanceWithScheduleAndRoutes () override=default
bool is_route_end_valid_stop_pos (size_t tr, const cda_rail::index_vector &edges, size_t next_stop_id) const
 Checks whether a route end is a valid stopping position.
void export_instance (std::filesystem::path const &working_directory) const override
 Exports the instance to the specified working directory without saving the network.
const auto & get_const_network () const
 Provides read-only access to the network.
const auto & get_const_timetable () const
 Accesses the timetable.
const auto & get_const_routes () const
 Provides read-only access to the routes.
auto & get_editable_network ()
 Provides editable access to the underlying network.
Train & editable_train (size_t const index)
 Gets a train by its index in the schedule.
Train & editable_train (const std::string &name)
 Retrieves mutable access to a train by name.
Schedule & editable_schedule (size_t const index)
 Gets the schedule of a train by its index for editing.
Schedule & editable_schedule (const std::string &name)
 Retrieves mutable access to the schedule of a train by name.
const StationList & get_const_station_list () const
 Provides the list of all stations.
const TrainList & get_const_train_list () const
 Provides const access to the list of trains in the instance.
const auto & get_const_schedule (size_t index) const
 Retrieves the schedule for a train.
const auto & get_const_schedule (const std::string &train_name) const
 Retrieves the schedule for a specified train.
bool has_route_for_every_train () const
 Checks whether every train has an assigned route.
double route_length (const std::string &train_name) const
 Computes the total length of a train's route.
std::vector< std::pair< size_t, std::vector< cda_rail::index_vector > > > get_stop_tracks (size_t tr, const std::string &station_name, const cda_rail::index_set &edges_to_consider={}) const
 Retrieves the stop tracks for a train at a specified station.
std::optional< double > get_last_stop_position_on_route (size_t tr_id, const std::string &station_name) const
 Returns the last reachable stop position of a station on a route.
std::vector< std::pair< size_t, std::vector< cda_rail::index_vector > > > possible_stop_vertices (size_t tr, const std::string &station_name, const cda_rail::index_set &edges_to_consider={}) const
 Computes feasible stop-edge paths for a train at a station.
std::vector< std::pair< size_t, std::vector< cda_rail::index_vector > > > possible_stop_vertices (const std::string &train_name, const std::string &station_name, const cda_rail::index_set &edges_to_consider={}) const
 Finds possible vertices where a train can stop at a station.
cda_rail::index_set edges_used_by_train (const std::string &train_name, bool fixed_routes, bool error_if_no_route=true) const
 Returns the edges used by a train.
cda_rail::index_set edges_used_by_train (size_t train_id, bool fixed_routes, bool error_if_no_route=true) const
 Retrieves the edges used by a train identified by index.
cda_rail::index_set vertices_used_by_train (const std::string &tr_name, bool fixed_routes, bool error_if_no_route=true) const
 Returns the vertices used by a train.
cda_rail::index_set vertices_used_by_train (size_t tr_id, bool fixed_routes, bool error_if_no_route=true) const
 Retrieves all vertices used by a train identified by its index.
cda_rail::index_set sections_used_by_train (const std::string &tr_name, const std::vector< cda_rail::index_set > &sections, bool fixed_routes, bool error_if_no_route=true) const
 Returns the queried sections used by a train.
cda_rail::index_set sections_used_by_train (size_t tr_id, const std::vector< cda_rail::index_set > &sections, bool fixed_routes, bool error_if_no_route=true) const
 Retrieves sections used by a train specified by index.
cda_rail::index_set trains_in_section (const cda_rail::index_set &section, bool fix_routes=true, bool error_if_no_route=true) const
 Returns the trains that use a section.
cda_rail::index_set trains_on_edge (size_t edge_id, bool fixed_routes, const cda_rail::index_set &trains_to_consider, bool error_if_not_route=true) const
 Identifies which trains use the specified edge.
cda_rail::index_set trains_on_edge (RouteMap const &route_map, size_t edge_id, bool fixed_routes, const cda_rail::index_set &trains_to_consider, bool error_if_not_route=true) const
 Identifies which trains from a subset use the specified edge.
cda_rail::index_set all_trains_on_edge (size_t edge_id, bool fixed_routes=true, bool error_if_not_route=true) const
 Returns the indices of all trains using a given edge.
cda_rail::index_set all_trains_on_edge (RouteMap const &route_map, size_t edge_id, bool fixed_routes=true, bool error_if_not_route=true) const
 Returns all trains whose routes use the specified edge.
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)
 Adds a train with the specified properties to the timetable.
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)
 Adds a train to the timetable.
void add_empty_station (const std::string &name)
 Adds an empty station to the timetable.
void add_track_to_station (const std::string &name, Network::EdgeInput const &track)
 Adds a track to a station.
void insert_stop (size_t train_index, std::string const &station_name, double service_time, double service_duration)
 Inserts a stop into a train's schedule.
void insert_stop (std::string const &train_name, std::string const &station_name, double service_time, double service_duration)
 Inserts a stop for a train at a specified station.
void set_routes (RouteMap routes)
 Replaces all routes of the instance.
void add_empty_route (const std::string &train_name)
 Adds an empty route for a train.
void push_back_edge_to_route (const std::string &train_name, Network::EdgeInput const &edge_input)
 Appends an edge to the end of a train's route.
void push_front_edge_to_route (const std::string &train_name, Network::EdgeInput const &edge_input)
 Adds an edge to the front of a train's route.
void remove_first_edge_from_route (const std::string &train_name)
 Removes the first edge from a train's route.
void remove_last_edge_from_route (const std::string &train_name)
 Removes the last edge from a train's route.
Route::EdgePosition route_edge_pos (const std::string &train_name, Network::EdgeInput const &edge) const
 Determines the position of an edge on a train's route.
Route::EdgePosition route_edge_pos (const std::string &train_name, const cda_rail::index_vector &edges) const
 Determines the position of edges on a train's route.
std::vector< ConflictPair > get_parallel_overlaps (const std::string &train1, const std::string &train2) const
 Identifies parallel overlaps between two trains.
std::vector< ConflictPair > get_ttd_overlaps (const std::string &train1, const std::string &train2) const
 Identifies time-to-distance overlaps between two trains.
std::vector< ConflictPair > get_reverse_overlaps (const std::string &train1, const std::string &train2) const
 Identifies sections where two trains travel in opposite directions.
std::vector< ConflictPair > get_crossing_overlaps (const std::string &train1, const std::string &train2) const
 Identifies crossing conflicts between two trains' routes.
bool check_consistency () const override
 Checks that the instance is internally consistent, requiring all trains to have routes.
FeasibilityCheck is_obviously_infeasible (bool late_entry_allowed) const override
 Checks the instance for reasons that make it infeasible by itself.
virtual void export_instance (const std::string &working_directory) const
 Exports the instance to the specified working directory.
virtual void export_instance (char const *const workingDirectory) const
 Exports the instance to the specified working directory.
Public Member Functions inherited from cda_rail::instances::GeneralProblemInstance
virtual ~GeneralProblemInstance ()=default
 Virtual destructor.
 GeneralProblemInstance (const GeneralProblemInstance &)=default
 Copy constructor.
GeneralProblemInstance & operator= (const GeneralProblemInstance &)=default
 Copy assignment operator.
 GeneralProblemInstance (GeneralProblemInstance &&) noexcept=default
 Move constructor.
GeneralProblemInstance & operator= (GeneralProblemInstance &&) noexcept=default
 Move assignment operator.
const std::string & get_instance_name () const
 Gets the instance name.
const std::string & get_instance_subdirectory () const
 Provides the instance subdirectory.
void set_instance_name (std::string_view const instanceName)
 Sets the instance name.
void set_instance_subdirectory (std::string_view const instanceSubdirectory)
 Sets the instance subdirectory.

Friends

class SolGeneralPerformanceOptimizationInstance

Additional Inherited Members

Protected Member Functions inherited from cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes
 GeneralProblemInstanceWithScheduleAndRoutes ()=default
 Constructs an empty problem instance with schedule and routes.
 GeneralProblemInstanceWithScheduleAndRoutes (Network network)
 Initializes the instance with a network.
 GeneralProblemInstanceWithScheduleAndRoutes (Network network, Timetable timetable, RouteMap routes)
 Initializes the instance with a network, timetable, and routes.
 GeneralProblemInstanceWithScheduleAndRoutes (std::string_view instance_name, std::string_view instance_subdirectory, std::filesystem::path const &working_directory)
 Loads a full problem instance from disk.
 GeneralProblemInstanceWithScheduleAndRoutes (std::string_view const instanceName, std::string_view const instanceSubdirectory, std::string const &working_directory)
 Constructs a problem instance by loading from a working directory.
 GeneralProblemInstanceWithScheduleAndRoutes (std::string_view const instanceName, std::string_view const instanceSubdirectory, char const *const workingDirectory)
 Constructs an instance by loading data from the working directory.
auto & get_editable_timetable ()
 Provides editable access to the timetable.
auto & get_editable_routes ()
 Provides editable access to the route map.
Protected Member Functions inherited from cda_rail::instances::GeneralProblemInstance
 GeneralProblemInstance ()=default
 Initializes the instance with empty name and subdirectory.
 GeneralProblemInstance (std::string_view const instanceName, std::string_view const instanceSubdirectory)
 Initializes the instance with a name and subdirectory.

Detailed Description

An instance in which the trains are routed as efficiently as possible.

The times given in the timetable are lower bounds, i.e., no train may enter the network, serve a station or leave the network earlier than scheduled. The objective is the weighted sum of the exit delay and the average station delay of every train, where the weight of each train and the weight of the station delays relative to the exit delays are part of the instance. Hence, it is never negative and, since the train weights are positive, 0 if and only if every train leaves the network on time and, if the station delay weight is positive, serves its stations on time.

Constructor & Destructor Documentation

◆ GeneralPerformanceOptimizationInstance() [1/6]

cda_rail::instances::GeneralPerformanceOptimizationInstance::GeneralPerformanceOptimizationInstance ( )
default

Constructs an instance with default values.

◆ GeneralPerformanceOptimizationInstance() [2/6]

cda_rail::instances::GeneralPerformanceOptimizationInstance::GeneralPerformanceOptimizationInstance ( Network network)
inlineexplicit

Constructs an instance from a network.

Parameters
networkThe network for this instance.

◆ GeneralPerformanceOptimizationInstance() [3/6]

cda_rail::instances::GeneralPerformanceOptimizationInstance::GeneralPerformanceOptimizationInstance ( Network network,
Timetable timetable,
RouteMap routes )
inline

Constructs an instance with a network, timetable, and routes.

Initializes all train weights to 1.

◆ GeneralPerformanceOptimizationInstance() [4/6]

cda_rail::instances::GeneralPerformanceOptimizationInstance::GeneralPerformanceOptimizationInstance ( std::string_view instance_name,
std::string_view instance_subdirectory,
std::filesystem::path const & working_directory )

◆ GeneralPerformanceOptimizationInstance() [5/6]

cda_rail::instances::GeneralPerformanceOptimizationInstance::GeneralPerformanceOptimizationInstance ( std::string_view const instanceName,
std::string_view const instanceSubdirectory,
std::string const & working_directory )
inline

Constructs an instance from a named subdirectory.

Parameters
instanceNameThe name of the instance to load.
instanceSubdirectoryThe subdirectory containing the instance data.
working_directoryThe working directory containing the instance subdirectory.

◆ GeneralPerformanceOptimizationInstance() [6/6]

cda_rail::instances::GeneralPerformanceOptimizationInstance::GeneralPerformanceOptimizationInstance ( std::string_view const instanceName,
std::string_view const instanceSubdirectory,
char const *const workingDirectory )
inline

Constructs an instance by loading from a specified directory structure.

Parameters
instanceNameName identifying the instance to load.
instanceSubdirectorySubdirectory (within workingDirectory) containing instance data.
workingDirectoryRoot directory path for loading instance data.

Member Function Documentation

◆ add_train() [1/2]

size_t cda_rail::instances::GeneralPerformanceOptimizationInstance::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,
double tr_weight = 1 )
inline

Adds a train with an associated weight to the instance.

Parameters
train_nameName of the train.
lengthLength of the train.
max_speedMaximum speed of the train.
accelerationAcceleration capability of the train.
decelerationDeceleration capability of the train.
timWhether the train operates under timetable constraints.
entry_timeTime at which the train enters the network.
initial_velocityInitial velocity of the train.
entry_vertexEntry vertex for the train.
exit_timeTime at which the train exits the network.
exit_velocityExit velocity of the train.
exit_vertexExit vertex for the train.
tr_weightWeight coefficient for this train in the objective (default 1).
Returns
Index of the newly added train.

◆ add_train() [2/2]

size_t cda_rail::instances::GeneralPerformanceOptimizationInstance::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,
double tr_weight = 1 )
inline

Adds a train to the instance with specified characteristics and weight.

Parameters
train_nameName of the train.
lengthLength of the train.
max_speedMaximum speed of the train.
accelerationAcceleration capability of the train.
decelerationDeceleration capability of the train.
entry_timeTime at which the train enters the network.
initial_velocityInitial velocity of the train.
entry_vertexEntry vertex for the train.
exit_timeTime at which the train exits the network.
exit_velocityExit velocity of the train.
exit_vertexExit vertex for the train.
tr_weightPer-train weight factor for objective calculation (default: 1).
Returns
The index of the added train.

◆ check_consistency() [1/2]

bool cda_rail::instances::GeneralPerformanceOptimizationInstance::check_consistency ( ) const
inlinenodiscardoverridevirtual

Checks if the instance is consistent.

Returns
true if the instance is consistent and every train has a route, false otherwise.

Implements cda_rail::instances::GeneralProblemInstance.

◆ check_consistency() [2/2]

bool cda_rail::instances::GeneralPerformanceOptimizationInstance::check_consistency ( bool every_train_must_have_route) const
nodiscardoverridevirtual

Checks instance consistency under the chosen route-completeness rule.

Parameters
every_train_must_have_routeWhether every train must have a route.
Returns
true if the instance is consistent under the requested rule.

Reimplemented from cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ discretize()

void cda_rail::instances::GeneralPerformanceOptimizationInstance::discretize ( const vss::SeparationFunction & sep_func = vss::UNIFORM)

◆ discretize_stops()

void cda_rail::instances::GeneralPerformanceOptimizationInstance::discretize_stops ( )

Discretizes stop edges used by the instance timetable.

◆ export_instance() [1/2]

void cda_rail::instances::GeneralPerformanceOptimizationInstance::export_instance ( const std::filesystem::path & working_directory,
bool save_network ) const
overridevirtual

Exports the instance and optionally its network.

Parameters
working_directoryBase export directory.
save_networkWhether to export the network alongside the instance.

Reimplemented from cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ export_instance() [2/2]

void cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes::export_instance ( std::filesystem::path const & working_directory) const
inlineoverridevirtual

Exports the instance to the specified working directory without saving the network.

Parameters
working_directoryThe target directory for the export.

Implements cda_rail::instances::GeneralProblemInstance.

◆ get_approximate_leaving_time() [1/2]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_approximate_leaving_time ( const std::string & tr_name) const
inlinenodiscard

Gets the approximate leaving time for a train by name.

Parameters
tr_nameThe name of the train.
Returns
double The approximate leaving time of the train.

◆ get_approximate_leaving_time() [2/2]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_approximate_leaving_time ( size_t train) const
nodiscard

Returns an approximate leaving time for a train.

Parameters
trainTrain index.
Returns
Approximate leaving time.

◆ get_maximal_leaving_time() [1/2]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_maximal_leaving_time ( const std::string & tr_name,
double v ) const
inlinenodiscard

Determines the maximum departure time for a train at a specified velocity.

Parameters
vVelocity constraint.
Returns
Maximum departure time.

◆ get_maximal_leaving_time() [2/2]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_maximal_leaving_time ( size_t train,
double v ) const
nodiscard

Returns a maximal leaving time under a speed bound.

Parameters
trainTrain index.
vSpeed bound.
Returns
Maximal leaving time.

◆ get_minimal_leaving_time() [1/2]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_minimal_leaving_time ( const std::string & tr_name,
double v ) const
inlinenodiscard

Gets the minimal leaving time for a train.

Parameters
tr_nameThe name of the train.
vConstraint value for the calculation.
Returns
double The minimal leaving time for the specified train.

◆ get_minimal_leaving_time() [2/2]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_minimal_leaving_time ( size_t train,
double v ) const
nodiscard

Returns a minimal leaving time under a speed bound.

Parameters
trainTrain index.
vSpeed bound.
Returns
Minimal leaving time.

◆ get_objective_val()

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_objective_val ( const std::vector< double > & tr_exit_times,
const std::vector< std::vector< double > > & stop_times,
bool throw_error_if_not_all_stops_specified = true ) const
nodiscard

Evaluates the objective for explicit exit and stop times.

Every train contributes its weight times the sum of its exit delay, i.e., its exit time minus its scheduled exit time, and the station delay weight times its average station delay. A stop time before the scheduled service time counts as no delay, whereas an exit time before the scheduled exit time is not rounded up, so that times at which partial routes end yield the same value up to the constant sum_of_weighted_exit_times().

Parameters
tr_exit_timesExit times per train.
stop_timesStop times per train and stop.
throw_error_if_not_all_stops_specifiedWhether missing stop times should trigger an error.
Returns
Objective value induced by the provided timing data.

◆ get_station_delay_weight()

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_station_delay_weight ( ) const
inlinenodiscard

Gets the station delay weight.

Returns
double The weight applied to station delays in the objective function.

◆ get_train_weight() [1/3]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_train_weight ( const char * train_name) const
inlinenodiscard

Returns the weight of a train by its name.

Parameters
train_nameThe name of the train.
Returns
double The weight of the specified train.

◆ get_train_weight() [2/3]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_train_weight ( const std::string & train_name) const
inlinenodiscard

Retrieves the weight of a train by name.

Parameters
train_nameThe name of the train.
Returns
double The weight assigned to the train.

◆ get_train_weight() [3/3]

double cda_rail::instances::GeneralPerformanceOptimizationInstance::get_train_weight ( size_t train_index) const
inlinenodiscard

Retrieves the weight assigned to a specific train.

Parameters
train_indexIndex of the train.
Returns
double The weight for the specified train.

◆ get_train_weights()

const auto & cda_rail::instances::GeneralPerformanceOptimizationInstance::get_train_weights ( ) const
inlinenodiscard

Accesses the per-train weights.

Returns
A const reference to the vector of per-train weights, indexed by train.

◆ minimum_running_times()

cda_rail::instances::MinimumRunningTimes cda_rail::instances::GeneralPerformanceOptimizationInstance::minimum_running_times ( size_t tr,
const cda_rail::index_set & start_edges,
bool include_first_edge,
double start_time,
size_t first_stop,
bool consider_earliest_departures ) const
nodiscard

Earliest times at which train tr can serve its remaining stops and reach its exit vertex.

Walks the remaining schedule and adds, for every leg, the quickest possible running time to the next station (respectively to the exit vertex), the service duration of every stop passed and, if consider_earliest_departures is set, the earliest departure of every stop. Running times ignore acceleration and every other train, so all returned times are lower bounds on the respective event.

Parameters
trTrain index.
start_edgesEdges the train may start on. The train is assumed to be at the source of these edges if include_first_edge is set and at their common target otherwise.
include_first_edgeWhether the length of the start edges counts.
start_timeTime at which the train is at the described position.
first_stopIndex of the first scheduled stop still to be served.
consider_earliest_departuresWhether earliest departure times of stops are respected.
Returns
Earliest arrival times, see MinimumRunningTimes.
Exceptions
cda_rail::exceptions::TrainNotExistentExceptionIf tr does not exist.
cda_rail::exceptions::InvalidInputExceptionIf start_edges is empty or first_stop exceeds the number of scheduled stops.

◆ separate_edges_at_vss()

std::vector< std::pair< size_t, cda_rail::index_vector > > cda_rail::instances::GeneralPerformanceOptimizationInstance::separate_edges_at_vss ( const std::vector< std::vector< double > > & vss_positions)

Splits the edges at the given VSS borders, see Network::separate_edges_at_vss, and updates timetable and routes accordingly.

Parameters
vss_positionsFor every edge, the distances of its borders from its source vertex.
Returns
Vector of pairs {original_edge_index, new_edge_indices} for every separated direction.

◆ service_start_times()

std::vector< std::vector< double > > cda_rail::instances::GeneralPerformanceOptimizationInstance::service_start_times ( const std::vector< std::vector< double > > & arrival_times) const
nodiscard

The stop times of a solution, given the times at which the trains reach their stops, e.g., in a simulation.

A stop time is the time at which the service starts, i.e., once the train has arrived, but no earlier than the scheduled service time.

Parameters
arrival_timesArrival times per train and stop, possibly only for the first stops of a train.
Returns
Stop times of the same shape.

◆ set_station_delay_weight()

void cda_rail::instances::GeneralPerformanceOptimizationInstance::set_station_delay_weight ( double new_weight)
inline

Sets the station-delay weight.

Parameters
new_weightThe weight value to assign.

◆ set_train_weight() [1/3]

void cda_rail::instances::GeneralPerformanceOptimizationInstance::set_train_weight ( const char * train_name,
double weight )
inline

Sets the weight for a train by name.

Parameters
train_nameThe name of the train.
weightThe new weight value.

◆ set_train_weight() [2/3]

void cda_rail::instances::GeneralPerformanceOptimizationInstance::set_train_weight ( const std::string & train_name,
double weight )
inline

Sets the weight for a train by its name.

Parameters
train_nameName of the train.
weightWeight to assign to the train.

◆ set_train_weight() [3/3]

void cda_rail::instances::GeneralPerformanceOptimizationInstance::set_train_weight ( size_t train_index,
double weight )
inline

Assigns a weight to a specific train.

Parameters
train_indexIndex of the train.
weightThe weight value.

◆ sum_of_train_weights()

double cda_rail::instances::GeneralPerformanceOptimizationInstance::sum_of_train_weights ( ) const
nodiscard

◆ sum_of_weighted_exit_times()

double cda_rail::instances::GeneralPerformanceOptimizationInstance::sum_of_weighted_exit_times ( ) const
nodiscard

Calculates the weighted sum of all (earliest) exit times.

Returns
Weighted sum

◆ time_index_interval() [1/2]

std::pair< size_t, size_t > cda_rail::instances::GeneralPerformanceOptimizationInstance::time_index_interval ( const std::string & train_name,
double dt,
bool tn_inclusive = true ) const
inlinenodiscard

◆ time_index_interval() [2/2]

std::pair< size_t, size_t > cda_rail::instances::GeneralPerformanceOptimizationInstance::time_index_interval ( size_t train_index,
double dt,
bool tn_inclusive = true ) const
inlinenodiscard

VSS INSTANCE HELPER

◆ trains_at_t() [1/2]

cda_rail::index_set cda_rail::instances::GeneralPerformanceOptimizationInstance::trains_at_t ( double t) const
nodiscard

◆ trains_at_t() [2/2]

cda_rail::index_set cda_rail::instances::GeneralPerformanceOptimizationInstance::trains_at_t ( double t,
const cda_rail::index_set & trains_to_consider ) const
nodiscard

◆ SolGeneralPerformanceOptimizationInstance

friend class SolGeneralPerformanceOptimizationInstance
friend

The documentation for this class was generated from the following files: