MTCT
Design Automation and Optimization for ETCS Railway Networks
Loading...
Searching...
No Matches
cda_rail::simulator Namespace Reference

Classes

class  EventSimulator
 Simulates the trains of a moving block instance event by event. More...
struct  PosVel
 Position of a train's front along its route in m together with its velocity in m/s. More...
struct  SimulatorResults
 What a simulation run produced. More...
struct  SimulatorState
 Everything a simulation run needs beyond the instance itself. More...
class  GeneralSimulator
struct  RemainingTimeHeuristicResult
 What a remaining-time heuristic estimates for one train. More...
struct  HeuristicResult
 A lower bound on how much the objective still increases. More...
class  GreedySimulator
 Simulates the trains of a moving block instance greedily. More...

Enumerations

enum class  SimulatorType : std::uint8_t { Greedy = 0 , EventBased = 1 }
 Which simulator obtains the trajectories of a state. More...
enum class  RemainingTimeHeuristicType : std::uint8_t { Zero = 0 , Simple = 1 }
 Which lower bound on the remaining time the A* search uses. More...

Functions

constexpr std::string simulator_type_to_string (SimulatorType const type)
 The name of type, as it is reported and parsed.
constexpr std::string remaining_time_heuristic_type_to_string (RemainingTimeHeuristicType const type)
 The name of type, as it is reported and parsed.
double objective_val (const instances::GeneralPerformanceOptimizationInstance &instance, const std::vector< double > &tr_exit_times, const std::vector< std::vector< double > > &stop_times)
 Computes the objective value based on train exit times and stop times.
RemainingTimeHeuristicResult simple_remaining_time_heuristic (size_t tr, const instances::GeneralPerformanceOptimizationInstance &instance, const SimulatorState &state, double tr_exit_time, bool consider_earliest_exit)
 Computes the simple remaining-time heuristic for one train.
RemainingTimeHeuristicResult remaining_time_heuristic (RemainingTimeHeuristicType type, size_t tr, const instances::GeneralPerformanceOptimizationInstance &instance, const SimulatorState &state, double tr_exit_time, bool consider_earliest_exit)
 Computes a remaining-time heuristic estimate using the selected strategy.
HeuristicResult greedy_heuristic (RemainingTimeHeuristicType remaining_time_heuristic_type, size_t tr, const instances::GeneralPerformanceOptimizationInstance &instance, const SimulatorState &state, double tr_exit_time, bool consider_earliest_exit)
 Combines braking-time and remaining-time heuristics into a single objective-value difference for a train.
HeuristicResult full_greedy_heuristic (RemainingTimeHeuristicType remaining_time_heuristic_type, const instances::GeneralPerformanceOptimizationInstance &instance, const SimulatorState &state, const SimulatorResults &sim_results, bool consider_earliest_exit)
 Computes a weighted-sum objective-value difference for all trains.

Variables

constexpr int CYCLE_LIMIT = 1000
 After how many time steps without any movement, in which no train has a reason to wait, a simulation is given up as deadlocked.

Enumeration Type Documentation

◆ RemainingTimeHeuristicType

enum class cda_rail::simulator::RemainingTimeHeuristicType : std::uint8_t
strong

Which lower bound on the remaining time the A* search uses.

Zero uses none, which turns the search into a Dijkstra search, while Simple estimates the remaining time by ignoring every other train.

Enumerator
Zero 
Simple 

◆ SimulatorType

enum class cda_rail::simulator::SimulatorType : std::uint8_t
strong

Which simulator obtains the trajectories of a state.

Greedy advances all trains in time steps of a fixed length, see GreedySimulator, whereas EventBased only simulates a train again once something relevant to it happens, see EventSimulator.

Enumerator
Greedy 
EventBased 

Function Documentation

◆ full_greedy_heuristic()

cda_rail::simulator::HeuristicResult cda_rail::simulator::full_greedy_heuristic ( RemainingTimeHeuristicType remaining_time_heuristic_type,
const instances::GeneralPerformanceOptimizationInstance & instance,
const SimulatorState & state,
const SimulatorResults & sim_results,
bool consider_earliest_exit )
nodiscard

Computes a weighted-sum objective-value difference for all trains.

Parameters
remaining_time_heuristic_typeRemaining-time heuristic type.
instanceThe problem instance.
stateThe state that was simulated.
sim_resultsSimulation results with exit times and braking parameters.
consider_earliest_exitWhether to enforce earliest departure and exit times.
Returns
HeuristicResult with feasibility flag (true if all trains feasible) and objective difference (weighted sum across all trains).
Exceptions
cda_rail::exceptions::ConsistencyExceptionIf result sizes do not match train count.
cda_rail::exceptions::InvalidInputExceptionIf the simulation failed.

◆ greedy_heuristic()

cda_rail::simulator::HeuristicResult cda_rail::simulator::greedy_heuristic ( RemainingTimeHeuristicType remaining_time_heuristic_type,
size_t tr,
const instances::GeneralPerformanceOptimizationInstance & instance,
const SimulatorState & state,
double tr_exit_time,
bool consider_earliest_exit )
nodiscard

Combines braking-time and remaining-time heuristics into a single objective-value difference for a train.

Computes the objective-value difference as remaining-exit-time plus the station-delay weight multiplied by average-remaining-stop-delay.

Parameters
remaining_time_heuristic_typeType of remaining-time heuristic variant to use.
trTrain index.
instanceThe problem instance.
stateThe routes and stop positions decided so far.
tr_exit_timeCurrent simulated exit time of the train.
consider_earliest_exitWhether to enforce earliest departure and exit constraints.
Returns
HeuristicResult containing feasibility status and the computed objective-value difference.

◆ objective_val()

double cda_rail::simulator::objective_val ( const instances::GeneralPerformanceOptimizationInstance & instance,
const std::vector< double > & tr_exit_times,
const std::vector< std::vector< double > > & stop_times )
inlinenodiscard

Computes the objective value based on train exit times and stop times.

Parameters
instanceThe problem instance.
tr_exit_timesExit times per train.
stop_timesStop times per train and stop.
Returns
double The computed objective value.

◆ remaining_time_heuristic()

RemainingTimeHeuristicResult cda_rail::simulator::remaining_time_heuristic ( RemainingTimeHeuristicType type,
size_t tr,
const instances::GeneralPerformanceOptimizationInstance & instance,
const SimulatorState & state,
double tr_exit_time,
bool consider_earliest_exit )
inlinenodiscard

Computes a remaining-time heuristic estimate using the selected strategy.

Dispatches to the appropriate remaining-time heuristic implementation based on the specified type. The Zero strategy returns a trivial feasible result with zero remaining time and delay. The Simple strategy delegates to the simple remaining-time heuristic.

Parameters
typeThe remaining-time heuristic strategy to apply.
trTrain index.
instanceThe problem instance.
stateThe routes and stop positions decided so far.
tr_exit_timeThe train's exit time.
consider_earliest_exitWhether to consider the train's earliest exit time.
Returns
A RemainingTimeHeuristicResult containing feasibility status, remaining exit time, and average remaining stop delay.

◆ remaining_time_heuristic_type_to_string()

std::string cda_rail::simulator::remaining_time_heuristic_type_to_string ( RemainingTimeHeuristicType const type)
constexpr

The name of type, as it is reported and parsed.

◆ simple_remaining_time_heuristic()

cda_rail::simulator::RemainingTimeHeuristicResult cda_rail::simulator::simple_remaining_time_heuristic ( size_t tr,
const instances::GeneralPerformanceOptimizationInstance & instance,
const SimulatorState & state,
double tr_exit_time,
bool consider_earliest_exit )
nodiscard

Computes the simple remaining-time heuristic for one train.

Parameters
trTrain index.
instanceThe problem instance.
stateThe routes and stop positions decided so far.
tr_exit_timeCurrent simulated exit time.
consider_earliest_exitWhether earliest-exit constraints are enforced.
Returns
Remaining-time heuristic result for the train.

◆ simulator_type_to_string()

std::string cda_rail::simulator::simulator_type_to_string ( SimulatorType const type)
constexpr

The name of type, as it is reported and parsed.

Variable Documentation

◆ CYCLE_LIMIT

int cda_rail::simulator::CYCLE_LIMIT = 1000
inlineconstexpr

After how many time steps without any movement, in which no train has a reason to wait, a simulation is given up as deadlocked.