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

Classes

struct  ModelDetailMBAStar
 What the simulation underlying the A* search does. More...
struct  SolverStrategyMBAStar
 How the A* search itself explores the states. More...
class  GenPOMovingBlockAStarSolver
 Routes the trains of a moving block instance by an A* search. More...

Enumerations

enum class  NextStateStrategy : std::uint8_t { SingleEdge = 0 , NextTTD = 1 , NextRelevantTTD = 2 }
 How far the trains are moved by one state transition. More...

Functions

std::optional< simulator::SimulatorState > complete_routes (const instances::GeneralProblemInstanceWithScheduleAndRoutes &instance, simulator::SimulatorState state)
 Completes the routes and stops of a state heuristically.
bool serve_stops_along_route (const instances::GeneralProblemInstanceWithScheduleAndRoutes &instance, simulator::SimulatorState &state, std::size_t tr)
 Serves the stops of a train along its route as complete_routes does, i.e., at the end of the platform.
std::optional< simulator::SimulatorState > complete_state (simulator::GeneralSimulator &simulator, simulator::SimulatorState state, double dt, bool late_entry_possible, bool limit_speed_by_leaving_edges)
 Completes a state to a final state heuristically.
constexpr std::string next_state_strategy_to_string (NextStateStrategy strategy)
 The name of strategy, as it is reported and parsed.

Enumeration Type Documentation

◆ NextStateStrategy

enum class cda_rail::solver::astar_based::NextStateStrategy : std::uint8_t
strong

How far the trains are moved by one state transition.

SingleEdge extends a route by one edge at a time, whereas the other two extend it until the next TTD section is entered, since a train that has entered a TTD section is committed to leaving it. NextRelevantTTD additionally skips the TTD sections in which a train can never be delayed by another one.

Enumerator
SingleEdge 
NextTTD 
NextRelevantTTD 

Function Documentation

◆ complete_routes()

std::optional< cda_rail::simulator::SimulatorState > cda_rail::solver::astar_based::complete_routes ( const instances::GeneralProblemInstanceWithScheduleAndRoutes & instance,
simulator::SimulatorState state )
nodiscard

Completes the routes and stops of a state heuristically.

Every train continues from the end of its route, or from its entry vertex if it has no route yet, along quickest paths, ignoring its dynamics, through its remaining stations to its exit vertex. At every station, it stops at the end of a station track on which it fits, and from which it can continue to its next station, respectively its exit. Where there are several such platforms, the trains take turns in using them in the order of their entry times, i.e., a train takes the one used least recently, counting the stops of the state. A platform consists of all tracks of the station that follow each other, in either direction, e.g., the edges into which a track is split by Network::separate_stop_edges. On it, the train stops at the end of the track furthest ahead, i.e., at the end of the platform, unless it cannot continue from there. A train whose route ends at a valid stop position without a stop there continues beyond it. The routes, stops and orders of the state are kept.

Parameters
instanceThe problem instance.
stateThe state to complete.
Returns
The state with complete routes and stops, or std::nullopt if some train cannot be routed that way.

◆ complete_state()

std::optional< cda_rail::simulator::SimulatorState > cda_rail::solver::astar_based::complete_state ( simulator::GeneralSimulator & simulator,
simulator::SimulatorState state,
double dt,
bool late_entry_possible,
bool limit_speed_by_leaving_edges )
nodiscard

Completes a state to a final state heuristically.

The routes and stops are completed by complete_routes, and the orders that the state leaves open are decided first come, first served, see simulator::GeneralSimulator::first_come_first_served_state.

Parameters
simulatorThe simulator deciding the orders, whose state is replaced.
stateThe state to complete.
dtSee simulator::GeneralSimulator::simulate.
late_entry_possibleSee simulator::GeneralSimulator::simulate.
limit_speed_by_leaving_edgesSee simulator::GeneralSimulator::simulate.
Returns
The final state, or std::nullopt if the routes cannot be completed or the trains do not all reach their exits.

◆ next_state_strategy_to_string()

std::string cda_rail::solver::astar_based::next_state_strategy_to_string ( NextStateStrategy strategy)
constexpr

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

◆ serve_stops_along_route()

bool cda_rail::solver::astar_based::serve_stops_along_route ( const instances::GeneralProblemInstanceWithScheduleAndRoutes & instance,
simulator::SimulatorState & state,
std::size_t tr )

Serves the stops of a train along its route as complete_routes does, i.e., at the end of the platform.

Every stop is served on the first passage of the route through tracks of its station after the previous stop at which the train can stop, at the last vertex of this passage at which it can stop. If a stop cannot be served on the rest of the route, the route is cut back to the previous stop, or emptied if there is none, so that complete_routes can route the train from there. The train must not have any stops in the state yet.

Parameters
instanceThe problem instance.
stateThe state whose route and stops of the train are changed.
trThe index of the train.
Returns
Whether every stop of the train is served on its route.