MTCT
Design Automation and Optimization for ETCS Railway Networks
Loading...
Searching...
No Matches
cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver Class Reference

Routes the trains of a moving block instance by an A* search. More...

#include <GenPOMovingBlockAStarSolver.hpp>

Inheritance diagram for cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver:
cda_rail::solver::GeneralSolver< instances::GeneralPerformanceOptimizationInstance, instances::SolGeneralPerformanceOptimizationInstance >

Public Member Functions

 GenPOMovingBlockAStarSolver ()=default
 Constructs a default solver instance.
 GenPOMovingBlockAStarSolver (const instances::GeneralPerformanceOptimizationInstance &instance)
 Constructs the solver from a performance optimization instance.
 GenPOMovingBlockAStarSolver (std::string_view const instanceName, std::string_view const instanceSubdirectory, std::filesystem::path const &working_directory)
 Constructs a solver instance from file-based configuration.
 ~GenPOMovingBlockAStarSolver () override=default
 GenPOMovingBlockAStarSolver (const GenPOMovingBlockAStarSolver &)=default
 Copy constructor.
 GenPOMovingBlockAStarSolver (GenPOMovingBlockAStarSolver &&)=default
 Move constructor.
GenPOMovingBlockAStarSolver & operator= (const GenPOMovingBlockAStarSolver &)=default
 Copy assignment operator.
GenPOMovingBlockAStarSolver & operator= (GenPOMovingBlockAStarSolver &&)=default
 Move assignment operator.
instances::SolGeneralPerformanceOptimizationInstance solve (int time_limit, bool debug_input, bool overwrite_severity) override
 Solves the problem with default model and strategy configurations.
instances::SolGeneralPerformanceOptimizationInstance solve (const ModelDetailMBAStar &model_detail_input, const SolverStrategyMBAStar &solver_strategy_input, const GeneralSolutionSettings &solution_settings_input, int time_limit=-1, bool debug_input=false, bool overwrite_severity=true)
 Solves the problem with explicit model, strategy, and export setup.
S solve ()
 Solves the problem instance using default configuration.
S solve (int time_limit, bool debug_input)
 Solves the problem instance.
Public Member Functions inherited from cda_rail::solver::GeneralSolver< instances::GeneralPerformanceOptimizationInstance, instances::SolGeneralPerformanceOptimizationInstance >
const nlohmann::json & get_solver_data () const
 The solver data of the last solve, as written to solver_data.json if the solution is exported, so that it can be exported later. Null before the first solve.
const instances::GeneralPerformanceOptimizationInstance & get_instance () const
 Accesses the problem instance stored in this solver.
instances::GeneralPerformanceOptimizationInstance & editable_instance ()
 Provides mutable access to the problem instance.
instances::SolGeneralPerformanceOptimizationInstance solve ()
 Solves the problem instance using default configuration.
virtual ~GeneralSolver ()=default
 Virtual destructor.

Additional Inherited Members

Protected Member Functions inherited from cda_rail::solver::GeneralSolver< instances::GeneralPerformanceOptimizationInstance, instances::SolGeneralPerformanceOptimizationInstance >
void solve_init_general (bool debug_input, bool overwrite_severity)
 Initializes logging and records solver start time.
 GeneralSolver ()=default
 Constructs a solver with a default-initialized problem instance.
nlohmann::json solver_data (FurtherData const &further_data) const
 Solver data, i.e., timing and further information (e.g. iterations, nodes, etc.), as written to solver_data.json.
void export_solver_data (std::filesystem::path const &export_directory, FurtherData const &further_data={})
 Exports solver data, see solver_data, into solver_data.json.
std::optional< std::filesystem::path > export_general_solution (instances::SolGeneralPerformanceOptimizationInstance &solution, const GeneralSolutionSettings &solution_settings, FurtherData const &further_data={})
 Exports the solution together with the solver data if requested.
Protected Attributes inherited from cda_rail::solver::GeneralSolver< instances::GeneralPerformanceOptimizationInstance, instances::SolGeneralPerformanceOptimizationInstance >
instances::GeneralPerformanceOptimizationInstance m_instance
decltype(std::chrono::high_resolution_clock::now()) m_start
decltype(std::chrono::high_resolution_clock::now()) m_model_created
decltype(std::chrono::high_resolution_clock::now()) m_model_solved
int64_t m_create_time
int64_t m_solve_time
nlohmann::json m_solver_data

Detailed Description

Routes the trains of a moving block instance by an A* search.

A state consists of the decisions made so far, i.e. of partial routes, orders, and stop positions, see simulator::SimulatorState. Its value is the objective of the trajectories that the chosen simulator obtains for it, and the remaining objective is estimated by a heuristic, see simulator::greedy_heuristic. The first final state that is dequeued is therefore an optimal solution.

Since partial states and the heuristic rely on actual times, the search adds the weighted scheduled exit times to the objective, i.e., it counts exit times rather than exit delays. This constant does not affect the search and is subtracted from every reported value, including the lower bound.

As in GenPOMovingBlockMIPSolver, the search runs on separated station tracks, see instances::StopDiscretization, so that a train can also stop within a long platform, while the solution refers to the original network.

Constructor & Destructor Documentation

◆ GenPOMovingBlockAStarSolver() [1/5]

cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::GenPOMovingBlockAStarSolver ( )
default

Constructs a default solver instance.

◆ GenPOMovingBlockAStarSolver() [2/5]

cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::GenPOMovingBlockAStarSolver ( const instances::GeneralPerformanceOptimizationInstance & instance)
inlineexplicit

Constructs the solver from a performance optimization instance.

Parameters
instanceThe performance optimization problem instance to solve.

◆ GenPOMovingBlockAStarSolver() [3/5]

cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::GenPOMovingBlockAStarSolver ( std::string_view const instanceName,
std::string_view const instanceSubdirectory,
std::filesystem::path const & working_directory )
inline

Constructs a solver instance from file-based configuration.

Parameters
instanceNameThe name of the instance.
instanceSubdirectoryThe subdirectory containing instance files.
working_directoryThe root working directory path.

◆ ~GenPOMovingBlockAStarSolver()

cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::~GenPOMovingBlockAStarSolver ( )
overridedefault

◆ GenPOMovingBlockAStarSolver() [4/5]

cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::GenPOMovingBlockAStarSolver ( const GenPOMovingBlockAStarSolver & )
default

Copy constructor.

◆ GenPOMovingBlockAStarSolver() [5/5]

cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::GenPOMovingBlockAStarSolver ( GenPOMovingBlockAStarSolver && )
default

Move constructor.

Member Function Documentation

◆ operator=() [1/2]

GenPOMovingBlockAStarSolver & cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::operator= ( const GenPOMovingBlockAStarSolver & )
default

Copy assignment operator.

◆ operator=() [2/2]

GenPOMovingBlockAStarSolver & cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::operator= ( GenPOMovingBlockAStarSolver && )
default

Move assignment operator.

◆ solve() [1/4]

S cda_rail::solver::GeneralSolver< T, S >::solve ( )
inlinenodiscard

Solves the problem instance using default configuration.

Returns
S The solution.

◆ solve() [2/4]

cda_rail::instances::SolGeneralPerformanceOptimizationInstance cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::solve ( const ModelDetailMBAStar & model_detail_input,
const SolverStrategyMBAStar & solver_strategy_input,
const GeneralSolutionSettings & solution_settings_input,
int time_limit = -1,
bool debug_input = false,
bool overwrite_severity = true )
nodiscard

Solves the problem with explicit model, strategy, and export setup.

Parameters
model_detail_inputSimulation-model settings.
solver_strategy_inputA* search strategy settings.
solution_settings_inputSolution export settings.
time_limitTime limit in seconds (-1 for no limit).
debug_inputIf true, enables debug mode.
overwrite_severityIf true, overwrites solution severity.
Returns
Solution to the general performance optimization problem.

◆ solve() [3/4]

S cda_rail::solver::GeneralSolver< T, S >::solve ( int time_limit,
bool debug_input )
inlinenodiscard

Solves the problem instance.

Parameters
time_limitMaximum time allowed for solving. Zero or negative values disable the limit.
debug_inputWhether to enable debug input mode.
Returns
S The computed solution.

◆ solve() [4/4]

instances::SolGeneralPerformanceOptimizationInstance cda_rail::solver::astar_based::GenPOMovingBlockAStarSolver::solve ( int time_limit,
bool debug_input,
bool overwrite_severity )
inlinenodiscardoverride

Solves the problem with default model and strategy configurations.

Parameters
time_limitTime limit in seconds (-1 for no limit).
debug_inputIf true, enables debug mode.
overwrite_severityIf true, overwrites solution severity.
Returns
Solution to the general performance optimization problem.

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