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

The trajectories a solver found for a performance optimization instance. More...

#include <GeneralPerformanceOptimizationInstance.hpp>

Inheritance diagram for cda_rail::instances::SolGeneralPerformanceOptimizationInstance:
cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes cda_rail::instances::SolGeneralProblemInstance cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance

Classes

struct  EvaluationSetup
 The network and sections the simulation of evaluate() runs on. More...
struct  EdgeTimeBound
struct  PosBound
struct  VelBound
struct  PosVelBound
struct  PosVel
struct  TrainDirection

Public Member Functions

 SolGeneralPerformanceOptimizationInstance (const GeneralPerformanceOptimizationInstance &instance)
 Initializes a solution object for a performance optimization problem instance.
 SolGeneralPerformanceOptimizationInstance (const GeneralPerformanceOptimizationInstance &instance, SolutionStatus status, double obj, bool has_sol)
 Constructs a solution instance with metadata for the given optimization problem.
 SolGeneralPerformanceOptimizationInstance (SolGeneralPerformanceOptimizationInstance const &)=default
 Constructs a copy of an existing solution instance.
SolGeneralPerformanceOptimizationInstance & operator= (SolGeneralPerformanceOptimizationInstance const &)=default
 SolGeneralPerformanceOptimizationInstance (SolGeneralPerformanceOptimizationInstance &&) noexcept=default
SolGeneralPerformanceOptimizationInstance & operator= (SolGeneralPerformanceOptimizationInstance &&) noexcept=default
 ~SolGeneralPerformanceOptimizationInstance () override=default
 Virtual destructor.
void load_solution (const std::filesystem::path &working_directory, std::string_view solution_subdirectory, std::optional< std::string > const &parameter_identifier) override
void export_solution (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier) const override
 Exports the solution without saving the instance.
void export_solution (const std::filesystem::path &working_directory, std::string_view solution_subdirectory, bool save_instance, std::optional< std::string > const &parameter_identifier) const override
 Exports the solution, optionally including the instance data.
GeneralPerformanceOptimizationInstance const * get_instance () const override
 Retrieves the underlying problem instance.
double get_train_pos (const std::string &tr_name, double t) const
 Returns the stored position of a train at a given time.
EdgeTimeBound get_edge_and_time_bounds (const std::string &tr_name, double t) const
 Returns the containing edge and surrounding time bounds.
PosVelBound get_exact_pos_and_vel_bounds (const std::string &tr_name, double t) const
 Returns exact lower and upper bounds on position and velocity.
std::optional< PosVel > get_approximate_train_pos_and_vel (const std::string &tr_name, double t) const
 Returns an approximate position/velocity pair if available.
double get_train_speed (const std::string &tr_name, double t) const
 Returns the stored train speed at a given time.
std::vector< double > get_train_times (const std::string &tr_name) const
 Returns all recorded times for one train.
cda_rail::index_vector get_train_order (size_t edge_index) const
 Returns train order on a given edge.
std::vector< TrainDirection > get_train_order_with_reverse (size_t edge_index) const
 Returns train order on a given edge together with orientation.
double get_time_at_pos (const std::string &tr_name, double pos, bool ub=false) const
 Returns the time at which a train reaches a route position.
double get_exit_time (const std::string &tr_name) const
 Returns the stored exit time of a train.
std::vector< double > get_stop_times (const std::string &tr_name) const
 Returns all stored stop times of a train.
double get_stop_time (const std::string &tr_name, const std::string &station_name) const
 Returns one stored stop time identified by station name.
double get_stop_time (const std::string &tr_name, size_t stop_index) const
 Returns one stored stop time identified by stop index.
void add_train_pos (const std::string &tr_name, double t, double pos)
 Stores a train position sample.
void add_train_speed (const std::string &tr_name, double t, double speed)
 Stores a train speed sample.
void set_train_exit_time (const std::string &tr_name, double t)
 Stores the exit time of a train.
void set_train_stop_time (const std::string &tr_name, size_t stop_idx, double stop_time)
 Stores one stop time identified by stop index.
void set_train_stop_time (const std::string &tr_name, std::string const &station_name, double stop_time)
 Stores one stop time identified by station name.
void set_train_stop_times (const std::string &tr_name, std::vector< double > stop_times)
 Replaces all stop times of one train.
void set_exit_times (const std::vector< double > &exit_times)
 Replaces all stored exit times.
void set_stop_times (const std::vector< std::vector< double > > &stop_times)
 Replaces all stored stop times.
void evaluate (double dt)
 Simulates the decisions of this solution greedily and stores the resulting delays, which are exported with the solution.
const std::optional< SolutionEvaluation > & get_evaluation () const
 Returns the result of the last evaluate(), if any.
bool check_consistency () const override
 Checks whether the stored performance-optimization solution is consistent.
void export_solution (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory) const override
 Exports the solution without saving the problem instance.
void load_solution (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory) override
 Loads a solution from the specified working directory and solution subdirectory.
Public Member Functions inherited from cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes
 SolGeneralProblemInstanceWithScheduleAndRoutes (GeneralProblemInstanceWithScheduleAndRoutes const &instance)
 Creates a solution wrapper from a problem instance.
 SolGeneralProblemInstanceWithScheduleAndRoutes (GeneralProblemInstanceWithScheduleAndRoutes const &instance, SolutionStatus status, double obj, bool has_sol)
 Initializes a solution wrapper around a copy of the provided instance.
 SolGeneralProblemInstanceWithScheduleAndRoutes (const SolGeneralProblemInstanceWithScheduleAndRoutes &)=default
SolGeneralProblemInstanceWithScheduleAndRoutes & operator= (const SolGeneralProblemInstanceWithScheduleAndRoutes &)=default
 SolGeneralProblemInstanceWithScheduleAndRoutes (SolGeneralProblemInstanceWithScheduleAndRoutes &&) noexcept=default
SolGeneralProblemInstanceWithScheduleAndRoutes & operator= (SolGeneralProblemInstanceWithScheduleAndRoutes &&) noexcept=default
 ~SolGeneralProblemInstanceWithScheduleAndRoutes () override=default
void load_solution (const std::filesystem::path &working_directory, std::string_view solution_subdirectory, std::optional< std::string > const &parameter_identifier) override
 Loads the route-aware part of a solution from disk.
void load_solution (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory) override
 Loads a solution from the specified working directory and solution subdirectory.
GeneralProblemInstanceWithScheduleAndRoutes const * get_instance () const override
 Accesses the underlying schedule-and-routes problem instance.
RouteMap const & get_const_solution_routes () const
 Retrieves the solution routes.
double route_length (const std::string &train_name) const
 Computes the total length of a train's solution route.
void reset_routes ()
 Resets solution routes to the instance's fixed routes.
void add_empty_route (const std::string &train_name)
 Adds an empty solution 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 solution route.
void push_front_edge_to_route (const std::string &train_name, Network::EdgeInput const &edge_input)
 Adds an edge to the front of the solution route for a train.
void remove_first_edge_from_route (const std::string &train_name)
 Removes the first edge from a train's route in the solution.
void remove_last_edge_from_route (const std::string &train_name)
 Removes the last edge from a train's route in the solution.
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 solution route.
void export_solution (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier) const override
 Exports the solution without saving the underlying instance.
void export_solution (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory) const override
 Exports the solution without saving the problem instance.
bool check_consistency () const override
 Checks whether the solution routes are consistent with the instance.
void export_solution (const std::string &path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={}) const
 Exports the solution to the specified directory.
void export_solution (const char *path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={}) const
 Exports the solution to the specified directory and subdirectory.
void load_solution (const std::string &path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={})
 Loads a solution from the specified path.
void load_solution (const char *path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={})
 Loads a solution from the specified location.
Public Member Functions inherited from cda_rail::instances::SolGeneralProblemInstance
std::filesystem::path get_export_path (const std::filesystem::path &working_directory, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier) const
 Computes the file path for exporting a solution.
SolutionStatus get_status () const
 Retrieves the current solution status.
double get_obj () const
 Gets the objective value of the solution.
double get_lower_bound () const
 Gets the lower bound on the objective value of the solution.
bool has_solution () const
 Indicates whether a solution has been found.
void set_status (SolutionStatus new_status)
 Sets the solution status.
void set_obj (double new_obj)
 Sets the objective value of the solution.
void set_lower_bound (double new_lb)
 Sets the lower bound of the objective value of the solution.
void set_solution_found ()
 Marks the solution as found.
void set_solution_not_found ()
 Marks that no solution has been found.
void load_solution (const std::string &path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={})
 Loads a solution from the specified path.
void load_solution (const char *path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={})
 Loads a solution from the specified location.
void export_solution (const std::string &path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={}) const
 Exports the solution to the specified directory.
void export_solution (const char *path, std::string_view const solutionSubdirectory, std::optional< std::string > const &parameter_identifier={}) const
 Exports the solution to the specified directory and subdirectory.
virtual ~SolGeneralProblemInstance ()=default
 Virtual destructor.
 SolGeneralProblemInstance (SolGeneralProblemInstance const &)=default
SolGeneralProblemInstance & operator= (SolGeneralProblemInstance const &)=default
 SolGeneralProblemInstance (SolGeneralProblemInstance &&) noexcept=default
SolGeneralProblemInstance & operator= (SolGeneralProblemInstance &&) noexcept=default

Protected Member Functions

virtual EvaluationSetup get_evaluation_setup () const
 Prepares the simulation of evaluate().
nlohmann::json get_general_solution_data () const override
 Adds the evaluation, if any, to the solution-wide metadata.
void set_general_solution_data (const nlohmann::json &data) override
 Loads the solution-wide metadata including the evaluation.
Protected Member Functions inherited from cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes
 SolGeneralProblemInstanceWithScheduleAndRoutes (std::shared_ptr< GeneralProblemInstanceWithScheduleAndRoutes > instance_ptr)
 Initializes a solution wrapper for a schedule-and-routes problem instance.
 SolGeneralProblemInstanceWithScheduleAndRoutes (std::shared_ptr< GeneralProblemInstanceWithScheduleAndRoutes > instance_ptr, SolutionStatus status, double obj, bool has_sol)
 Initializes a solution instance with an existing problem instance and solution metadata.
Protected Member Functions inherited from cda_rail::instances::SolGeneralProblemInstance
 SolGeneralProblemInstance (std::shared_ptr< GeneralProblemInstance > instance_ptr)
 Creates a solution wrapper around the given problem instance.
 SolGeneralProblemInstance (std::shared_ptr< GeneralProblemInstance > instance_ptr, SolutionStatus status, double obj, bool has_sol)
 Constructs a solution instance with problem instance and solution metadata.
GeneralProblemInstance const * get_uncast_instance_pointer () const
 Retrieves the underlying problem instance pointer.

Detailed Description

The trajectories a solver found for a performance optimization instance.

Positions and velocities are stored per train as samples over time, which the solvers fill at the points in time their model knows about. The exit and stop times are stored separately, since they are what the objective is evaluated on.

Constructor & Destructor Documentation

◆ SolGeneralPerformanceOptimizationInstance() [1/4]

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::SolGeneralPerformanceOptimizationInstance ( const GeneralPerformanceOptimizationInstance & instance)
inlineexplicit

Initializes a solution object for a performance optimization problem instance.

Parameters
instanceThe problem instance to associate with this solution.

◆ SolGeneralPerformanceOptimizationInstance() [2/4]

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::SolGeneralPerformanceOptimizationInstance ( const GeneralPerformanceOptimizationInstance & instance,
SolutionStatus status,
double obj,
bool has_sol )
inline

Constructs a solution instance with metadata for the given optimization problem.

Parameters
instanceThe optimization problem instance to solve.
statusThe solution status.
objThe objective value.
has_solWhether a valid solution has been obtained.

◆ SolGeneralPerformanceOptimizationInstance() [3/4]

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::SolGeneralPerformanceOptimizationInstance ( SolGeneralPerformanceOptimizationInstance const & )
default

Constructs a copy of an existing solution instance.

◆ SolGeneralPerformanceOptimizationInstance() [4/4]

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::SolGeneralPerformanceOptimizationInstance ( SolGeneralPerformanceOptimizationInstance && )
defaultnoexcept

◆ ~SolGeneralPerformanceOptimizationInstance()

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::~SolGeneralPerformanceOptimizationInstance ( )
overridedefault

Virtual destructor.

Member Function Documentation

◆ add_train_pos()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::add_train_pos ( const std::string & tr_name,
double t,
double pos )

Stores a train position sample.

Parameters
tr_nameName of the train.
tSample time.
posSample position.

◆ add_train_speed()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::add_train_speed ( const std::string & tr_name,
double t,
double speed )

Stores a train speed sample.

Parameters
tr_nameName of the train.
tSample time.
speedSample speed.

◆ check_consistency()

bool cda_rail::instances::SolGeneralPerformanceOptimizationInstance::check_consistency ( ) const
nodiscardoverridevirtual

Checks whether the stored performance-optimization solution is consistent.

Returns
true if the solution data is consistent, otherwise false.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.

◆ evaluate()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::evaluate ( double dt)

Simulates the decisions of this solution greedily and stores the resulting delays, which are exported with the solution.

The routes, the orders in which the trains pass every block section and every entry and exit vertex, and the stop positions are taken from this solution. Every train then drives as fast as the greedy simulator allows. This is done twice, see SolutionEvaluation. In the first simulation, neither the front nor the braking point of a train may get ahead of the train of this solution at the same time, so that the timing of this solution is not overtaken. If the trajectory of a train follows its acceleration and deceleration, up to the precision to which positions are rounded, the train hence leaves no earlier than in this solution. Its exit time is then not enforced separately, so that it may leave the network as slowly as in this solution. Between two samples of this solution, its trajectory is approximated by a constant line speed, bounded by what the next sample fixes exactly. In the second simulation, the trains are only bound by the decisions, as in the A* search. In both, trains may enter later than scheduled, which then shows up as delay. The objective is that of the instance evaluated at the simulated times.

Parameters
dtTime step of the simulation in seconds.
Exceptions
cda_rail::exceptions::ConsistencyExceptionIf there is no solution to evaluate.

◆ export_solution() [1/3]

void cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes::export_solution ( const std::filesystem::path & working_directory,
std::string_view const solutionSubdirectory ) const
inlineoverridevirtual

Exports the solution without saving the problem instance.

Exports only the solution data (routes) to the specified directory without exporting the underlying problem instance.

Parameters
working_directoryRoot working directory for the solution export.
solutionSubdirectorySubdirectory within the solutions folder for this solution.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.

◆ export_solution() [2/3]

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::export_solution ( const std::filesystem::path & working_directory,
std::string_view const solutionSubdirectory,
std::optional< std::string > const & parameter_identifier ) const
inlineoverridevirtual

Exports the solution without saving the instance.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.

◆ export_solution() [3/3]

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::export_solution ( const std::filesystem::path & working_directory,
std::string_view solution_subdirectory,
bool save_instance,
std::optional< std::string > const & parameter_identifier ) const
overridevirtual

Exports the solution, optionally including the instance data.

Parameters
working_directoryBase export directory.
solution_subdirectorySolution subdirectory.
save_instanceWhether to export the instance as well.
parameter_identifierOptional parameter identifier for the export path.

Reimplemented from cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes.

Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.

◆ get_approximate_train_pos_and_vel()

std::optional< cda_rail::instances::SolGeneralPerformanceOptimizationInstance::PosVel > cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_approximate_train_pos_and_vel ( const std::string & tr_name,
double t ) const
nodiscard

Returns an approximate position/velocity pair if available.

Between two stored states, the train is assumed to change its speed fully to a line speed, drive at it and change it fully to the next stored speed. The line speed is found by a bisection that stops as soon as the candidate speeds differ by at most LINE_SPEED_ACCURACY or the travel time is less than LINE_SPEED_TIME_ACCURACY too short, and the faster candidate is used. Hence, the profile can end before the next stored time. From then on, the position and speed of the next stored state are returned.

Parameters
tr_nameName of the train.
tQuery time.
Returns
Approximate position/velocity pair, or std::nullopt.

◆ get_edge_and_time_bounds()

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::EdgeTimeBound cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_edge_and_time_bounds ( const std::string & tr_name,
double t ) const
nodiscard

Returns the containing edge and surrounding time bounds.

Between the train's last sample and its exit time, both time bounds are the last sample.

Parameters
tr_nameName of the train.
tQuery time.
Returns
Edge/time-bound data at time t.

◆ get_evaluation()

const std::optional< SolutionEvaluation > & cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_evaluation ( ) const
inlinenodiscard

Returns the result of the last evaluate(), if any.

Returns
The evaluation, or std::nullopt if the solution was not evaluated.

◆ get_evaluation_setup()

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::EvaluationSetup cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_evaluation_setup ( ) const
nodiscardprotectedvirtual

Prepares the simulation of evaluate().

Under moving block, the instance and its routes are used as they are and only the unbreakable sections are block sections.

Returns
The instance to simulate, its block sections, and the routes of this solution in that instance.

Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.

◆ get_exact_pos_and_vel_bounds()

cda_rail::instances::SolGeneralPerformanceOptimizationInstance::PosVelBound cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_exact_pos_and_vel_bounds ( const std::string & tr_name,
double t ) const
nodiscard

Returns exact lower and upper bounds on position and velocity.

The bounds intersect the states reachable from the stored state before t with the states from which the stored state after t is still reachable, given the train's acceleration, deceleration and speed limit as well as the highest speed limit of the edges between both states. Up to what corresponds to GRB_EPS in time for each bound, the lower bounds do not exceed the upper bounds. Otherwise, e.g., if the stored times are not physically possible, only the former are used.

Parameters
tr_nameName of the train.
tQuery time.
Returns
Position/velocity bounds at time t.

◆ get_exit_time()

double cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_exit_time ( const std::string & tr_name) const
nodiscard

Returns the stored exit time of a train.

Parameters
tr_nameName of the train.
Returns
Stored exit time for the train.

◆ get_general_solution_data()

nlohmann::json cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_general_solution_data ( ) const
nodiscardoverrideprotectedvirtual

Adds the evaluation, if any, to the solution-wide metadata.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

◆ get_instance()

GeneralPerformanceOptimizationInstance const * cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_instance ( ) const
inlinenodiscardoverridevirtual

Retrieves the underlying problem instance.

Returns
Pointer to the underlying GeneralPerformanceOptimizationInstance.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

◆ get_stop_time() [1/2]

double cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_stop_time ( const std::string & tr_name,
const std::string & station_name ) const
nodiscard

Returns one stored stop time identified by station name.

Parameters
tr_nameName of the train.
station_nameName of the station.
Returns
Stored stop time for the matching station.

◆ get_stop_time() [2/2]

double cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_stop_time ( const std::string & tr_name,
size_t stop_index ) const
nodiscard

Returns one stored stop time identified by stop index.

Parameters
tr_nameName of the train.
stop_indexStop index in schedule order.
Returns
Stored stop time for the specified stop.

◆ get_stop_times()

std::vector< double > cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_stop_times ( const std::string & tr_name) const
nodiscard

Returns all stored stop times of a train.

Parameters
tr_nameName of the train.
Returns
Vector of stop times in schedule order.

◆ get_time_at_pos()

double cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_time_at_pos ( const std::string & tr_name,
double pos,
bool ub = false ) const
nodiscard

Returns the time at which a train reaches a route position.

Parameters
tr_nameName of the train.
posPosition on the route.
ubWhether to return a upper-bound on the time if no exact timing is available.
Returns
Time associated with pos.

◆ get_train_order()

cda_rail::index_vector cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_train_order ( size_t edge_index) const
nodiscard

Returns train order on a given edge.

Parameters
edge_indexEdge index.
Returns
Ordered train indices on that edge.

◆ get_train_order_with_reverse()

std::vector< cda_rail::instances::SolGeneralPerformanceOptimizationInstance::TrainDirection > cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_train_order_with_reverse ( size_t edge_index) const
nodiscard

Returns train order on a given edge together with orientation.

Parameters
edge_indexEdge index.
Returns
Ordered train/direction data.

◆ get_train_pos()

double cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_train_pos ( const std::string & tr_name,
double t ) const
nodiscard

Returns the stored position of a train at a given time.

Parameters
tr_nameName of the train.
tQuery time.
Returns
Train position.

◆ get_train_speed()

double cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_train_speed ( const std::string & tr_name,
double t ) const
nodiscard

Returns the stored train speed at a given time.

Parameters
tr_nameName of the train.
tQuery time.
Returns
Train speed.

◆ get_train_times()

std::vector< double > cda_rail::instances::SolGeneralPerformanceOptimizationInstance::get_train_times ( const std::string & tr_name) const
nodiscard

Returns all recorded times for one train.

Parameters
tr_nameName of the train.
Returns
Sorted list of recorded times.

◆ load_solution() [1/2]

void cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes::load_solution ( const std::filesystem::path & working_directory,
std::string_view const solutionSubdirectory )
inlineoverridevirtual

Loads a solution from the specified working directory and solution subdirectory.

Parameters
working_directoryThe root directory containing solutions.
solutionSubdirectoryThe solution subdirectory within the working directory.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.

◆ load_solution() [2/2]

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::load_solution ( const std::filesystem::path & working_directory,
std::string_view solution_subdirectory,
std::optional< std::string > const & parameter_identifier )
overridevirtual

◆ operator=() [1/2]

SolGeneralPerformanceOptimizationInstance & cda_rail::instances::SolGeneralPerformanceOptimizationInstance::operator= ( SolGeneralPerformanceOptimizationInstance && )
defaultnoexcept

◆ operator=() [2/2]

SolGeneralPerformanceOptimizationInstance & cda_rail::instances::SolGeneralPerformanceOptimizationInstance::operator= ( SolGeneralPerformanceOptimizationInstance const & )
default

◆ set_exit_times()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_exit_times ( const std::vector< double > & exit_times)

Replaces all stored exit times.

Parameters
exit_timesExit times indexed by train.

◆ set_general_solution_data()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_general_solution_data ( const nlohmann::json & data)
overrideprotectedvirtual

Loads the solution-wide metadata including the evaluation.

Reimplemented from cda_rail::instances::SolGeneralProblemInstance.

◆ set_stop_times()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_stop_times ( const std::vector< std::vector< double > > & stop_times)

Replaces all stored stop times.

Parameters
stop_timesStop times indexed by train and stop.

◆ set_train_exit_time()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_train_exit_time ( const std::string & tr_name,
double t )

Stores the exit time of a train.

Parameters
tr_nameName of the train.
tExit time to store.

◆ set_train_stop_time() [1/2]

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_train_stop_time ( const std::string & tr_name,
size_t stop_idx,
double stop_time )

Stores one stop time identified by stop index.

Parameters
tr_nameName of the train.
stop_idxStop index in schedule order.
stop_timeStop time to store.

◆ set_train_stop_time() [2/2]

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_train_stop_time ( const std::string & tr_name,
std::string const & station_name,
double stop_time )

Stores one stop time identified by station name.

Parameters
tr_nameName of the train.
station_nameName of the station.
stop_timeStop time to store.

◆ set_train_stop_times()

void cda_rail::instances::SolGeneralPerformanceOptimizationInstance::set_train_stop_times ( const std::string & tr_name,
std::vector< double > stop_times )

Replaces all stop times of one train.

Parameters
tr_nameName of the train.
stop_timesStop times in schedule order.

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