|
MTCT
Design Automation and Optimization for ETCS Railway Networks
|
A solution that says which routes the trains take. More...
#include <GeneralProblemInstance.hpp>
Public Member Functions | |
| 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 ¶meter_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 ¶meter_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. | |
| virtual void | export_solution (const std::filesystem::path &working_directory, std::string_view solution_subdirectory, bool save_instance, std::optional< std::string > const ¶meter_identifier) const |
| 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 ¶meter_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 ¶meter_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 ¶meter_identifier={}) |
| Loads a solution from the specified path. | |
| void | load_solution (const char *path, std::string_view const solutionSubdirectory, std::optional< std::string > const ¶meter_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 ¶meter_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 ¶meter_identifier={}) |
| Loads a solution from the specified path. | |
| void | load_solution (const char *path, std::string_view const solutionSubdirectory, std::optional< std::string > const ¶meter_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 ¶meter_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 ¶meter_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 | |
| 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. | |
| virtual nlohmann::json | get_general_solution_data () const |
| Serializes solution-wide metadata to JSON. | |
| virtual void | set_general_solution_data (const nlohmann::json &data) |
| Loads solution-wide metadata from JSON. | |
| GeneralProblemInstance const * | get_uncast_instance_pointer () const |
| Retrieves the underlying problem instance pointer. | |
A solution that says which routes the trains take.
The routes are initialized to those of the instance and are filled in by the solver wherever the instance leaves them open.
|
inlineexplicitprotected |
Initializes a solution wrapper for a schedule-and-routes problem instance.
| instance_ptr | The problem instance to wrap. |
|
inlineprotected |
Initializes a solution instance with an existing problem instance and solution metadata.
|
inlineexplicit |
Creates a solution wrapper from a problem instance.
|
inline |
Initializes a solution wrapper around a copy of the provided instance.
| instance | Problem instance to wrap. |
| status | Solution status. |
| obj | Objective value of the solution. |
| has_sol | Whether a solution exists. |
|
default |
|
defaultnoexcept |
|
overridedefault |
| void cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes::add_empty_route | ( | const std::string & | train_name | ) |
Adds an empty solution route for a train.
| train_name | Name of the train. |
|
nodiscardoverridevirtual |
Checks whether the solution routes are consistent with the instance.
Reimplemented from cda_rail::instances::SolGeneralProblemInstance.
Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.
|
inline |
Exports the solution to the specified directory and subdirectory.
| path | Directory path where the solution will be exported. |
| solutionSubdirectory | Subdirectory name for organizing solutions. |
| parameter_identifier | Optional identifier appended to the solution name. |
|
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.
| working_directory | Root working directory for the solution export. |
| solutionSubdirectory | Subdirectory within the solutions folder for this solution. |
Reimplemented from cda_rail::instances::SolGeneralProblemInstance.
Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.
|
inlineoverridevirtual |
Exports the solution without saving the underlying instance.
| working_directory | The base directory for solution exports. |
| solutionSubdirectory | The subdirectory for this solution. |
| parameter_identifier | Optional identifier to include in the export path. |
Reimplemented from cda_rail::instances::SolGeneralProblemInstance.
Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.
|
virtual |
|
inline |
Exports the solution to the specified directory.
| path | Directory path where the solution will be exported. |
| solutionSubdirectory | Solution subdirectory name. |
| parameter_identifier | Optional parameter identifier appended to the export path. |
|
inlinenodiscard |
Retrieves the solution routes.
|
inlinenodiscardoverridevirtual |
Accesses the underlying schedule-and-routes problem instance.
Reimplemented from cda_rail::instances::SolGeneralProblemInstance.
|
inline |
Loads a solution from the specified location.
| path | Working directory path. |
| solutionSubdirectory | Subdirectory containing solutions. |
| parameter_identifier | Optional identifier to append to the instance name when constructing the solution path. |
|
inlineoverridevirtual |
Loads a solution from the specified working directory and solution subdirectory.
| working_directory | The root directory containing solutions. |
| solutionSubdirectory | The solution subdirectory within the working directory. |
Reimplemented from cda_rail::instances::SolGeneralProblemInstance.
Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.
|
overridevirtual |
Loads the route-aware part of a solution from disk.
Reimplemented from cda_rail::instances::SolGeneralProblemInstance.
Reimplemented in cda_rail::instances::SolVSSGeneralPerformanceOptimizationInstance.
|
inline |
Loads a solution from the specified path.
| path | Working directory path. |
| solutionSubdirectory | Subdirectory containing solution files. |
| parameter_identifier | Optional identifier appended to the instance name when locating solution files. |
|
default |
|
defaultnoexcept |
|
inline |
Appends an edge to the end of a train's solution route.
| train_name | Name of the train. |
| edge_input | The edge to append. |
|
inline |
Adds an edge to the front of the solution route for a train.
| train_name | Name of the train whose solution route is modified. |
| edge_input | The edge to prepend to the route. |
|
inline |
Removes the first edge from a train's route in the solution.
| train_name | The name of the train whose route is to be modified. |
|
inline |
Removes the last edge from a train's route in the solution.
| train_name | Name of the train. |
| void cda_rail::instances::SolGeneralProblemInstanceWithScheduleAndRoutes::reset_routes | ( | ) |
Resets solution routes to the instance's fixed routes.
|
inlinenodiscard |
Determines the position of an edge on a train's solution route.
| train_name | The name of the train. |
| edge | The edge to locate on the solution route. |
|
inlinenodiscard |
Computes the total length of a train's solution route.
| train_name | Name of the train. |