C++ Reference
C++ Reference: Routing
routing_neighborhoods.h
Go to the documentation of this file.
An Assignment is a variable -> domains mapping, used to report solutions to the user.
Definition: constraint_solver.h:5038
bool MakeNeighbor() override
ExchangeSubtrip(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:754
Filtered heuristic LNS operator, where the destruction phase consists of removing a node and the 'num...
Definition: routing_neighborhoods.h:498
operations_research::FilteredHeuristicCloseNodesLNSOperator::~FilteredHeuristicCloseNodesLNSOperator
~FilteredHeuristicCloseNodesLNSOperator() override
Definition: routing_neighborhoods.h:502
FilteredHeuristicCloseNodesLNSOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic, int num_close_nodes)
std::string DebugString() const override
Definition: routing_neighborhoods.h:504
Similar to the heuristic path LNS above, but instead of removing one route entirely,...
Definition: routing_neighborhoods.h:456
FilteredHeuristicExpensiveChainLNSOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic, int num_arcs_to_consider, std::function< int64(int64, int64, int64)> arc_cost_for_route_start)
~FilteredHeuristicExpensiveChainLNSOperator() override
Definition: routing_neighborhoods.h:462
std::string DebugString() const override
Definition: routing_neighborhoods.h:464
Class of operators using a RoutingFilteredHeuristic to insert unperformed nodes after changes have be...
Definition: routing_neighborhoods.h:347
~FilteredHeuristicLocalSearchOperator() override
Definition: routing_neighborhoods.h:352
FilteredHeuristicLocalSearchOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic, bool keep_inverse_values=false)
virtual std::function< int64(int64)> SetupNextAccessorForNeighbor()=0
Virtual method to return the next_accessor to be passed to the heuristic to build a new solution.
virtual bool IncrementPosition()=0
std::string HeuristicName() const
Definition: routing_neighborhoods.h:361
SparseBitset removed_nodes_
Keeps track of removed nodes when making a neighbor.
Definition: routing_neighborhoods.h:379
const RoutingModel & model_
Definition: routing_neighborhoods.h:377
LNS-like operator based on a filtered first solution heuristic to rebuild the solution,...
Definition: routing_neighborhoods.h:394
FilteredHeuristicPathLNSOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic)
std::string DebugString() const override
Definition: routing_neighborhoods.h:400
~FilteredHeuristicPathLNSOperator() override
Definition: routing_neighborhoods.h:398
Operator which inserts inactive nodes into a path and makes a pair of active nodes inactive.
Definition: routing_neighborhoods.h:323
bool MakeNeighbor() override
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
Redefines MakeNextNeighbor to export a simpler interface.
IndexPairSwapActiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
~IndexPairSwapActiveOperator() override
Definition: routing_neighborhoods.h:329
std::string DebugString() const override
Definition: routing_neighborhoods.h:333
Specialization of LocalSearchOperator built from an array of IntVars which specifies the scope of the...
Definition: constraint_solveri.h:1028
int64 InverseValue(int64 index) const
Definition: constraint_solveri.h:1072
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
Redefines MakeNextNeighbor to export a simpler interface.
bool MakeNeighbor() override
~LightPairRelocateOperator() override
Definition: routing_neighborhoods.h:195
LightPairRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:198
Pair-based neighborhood operators, designed to move nodes by pairs (pairs are static and given).
Definition: routing_neighborhoods.h:104
bool MakeNeighbor() override
~MakePairActiveOperator() override
Definition: routing_neighborhoods.h:110
bool RestartAtPathStartOnSynchronize() override
Required to ensure that after synchronization the operator is in a state compatible with GetBaseNodeR...
Definition: routing_neighborhoods.h:126
bool OnSamePathAsPreviousBase(int64 base_index) override
Returns true if a base node has to be on the same path as the "previous" base node (base node of inde...
Definition: routing_neighborhoods.h:116
MakePairActiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &pairs)
bool MakeOneNeighbor() override
This method should not be overridden. Override MakeNeighbor() instead.
int64 GetBaseNodeRestartPosition(int base_index) override
Returns the index of the node to which the base node of index base_index must be set to when it reach...
std::string DebugString() const override
Definition: routing_neighborhoods.h:112
Operator which makes pairs of active nodes inactive.
Definition: routing_neighborhoods.h:140
MakePairInactiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
bool MakeNeighbor() override
std::string DebugString() const override
Definition: routing_neighborhoods.h:148
Relocate neighborhood which moves chains of neighbors.
Definition: routing_neighborhoods.h:47
bool MakeNeighbor() override
MakeRelocateNeighborsOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, RoutingTransitCallback2 arc_evaluator)
~MakeRelocateNeighborsOperator() override
Definition: routing_neighborhoods.h:54
std::string DebugString() const override
Definition: routing_neighborhoods.h:57
Operator which exchanges the position of two pairs; for both pairs the first node of the pair must be...
Definition: routing_neighborhoods.h:209
bool MakeNeighbor() override
PairExchangeOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
~PairExchangeOperator() override
Definition: routing_neighborhoods.h:215
std::string DebugString() const override
Definition: routing_neighborhoods.h:218
Operator which exchanges the paths of two pairs (path have to be different).
Definition: routing_neighborhoods.h:240
bool MakeNeighbor() override
~PairExchangeRelocateOperator() override
Definition: routing_neighborhoods.h:246
bool OnSamePathAsPreviousBase(int64 base_index) override
Returns true if a base node has to be on the same path as the "previous" base node (base node of inde...
int64 GetBaseNodeRestartPosition(int base_index) override
Returns the index of the node to which the base node of index base_index must be set to when it reach...
PairExchangeRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:249
Operator which inserts pairs of inactive nodes into a path and makes an active node inactive.
Definition: routing_neighborhoods.h:604
bool MakeNeighbor() override
Definition: routing_neighborhoods.h:691
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
Redefines MakeNextNeighbor to export a simpler interface.
Definition: routing_neighborhoods.h:675
~PairNodeSwapActiveOperator() override
Definition: routing_neighborhoods.h:610
bool RestartAtPathStartOnSynchronize() override
Required to ensure that after synchronization the operator is in a state compatible with GetBaseNodeR...
Definition: routing_neighborhoods.h:629
bool OnSamePathAsPreviousBase(int64 base_index) override
Returns true if a base node has to be on the same path as the "previous" base node (base node of inde...
Definition: routing_neighborhoods.h:619
PairNodeSwapActiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
Definition: routing_neighborhoods.h:642
int64 GetBaseNodeRestartPosition(int base_index) override
Returns the index of the node to which the base node of index base_index must be set to when it reach...
Definition: routing_neighborhoods.h:653
std::string DebugString() const override
Definition: routing_neighborhoods.h:614
Operator which moves a pair of nodes to another position where the first node of the pair must be bef...
Definition: routing_neighborhoods.h:159
bool MakeNeighbor() override
~PairRelocateOperator() override
Definition: routing_neighborhoods.h:165
PairRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
bool ConsiderAlternatives(int64 base_index) const override
Indicates if alternatives should be considered when iterating over base nodes.
Definition: routing_neighborhoods.h:177
bool OnSamePathAsPreviousBase(int64 base_index) override
Returns true if a base node has to be on the same path as the "previous" base node (base node of inde...
Definition: routing_neighborhoods.h:171
int64 GetBaseNodeRestartPosition(int base_index) override
Returns the index of the node to which the base node of index base_index must be set to when it reach...
std::string DebugString() const override
Definition: routing_neighborhoods.h:168
Base class of the local search operators dedicated to path modifications (a path is a set of nodes li...
Definition: constraint_solveri.h:1319
RelocateExpensiveChain.
Definition: routing_neighborhoods.h:557
bool MakeNeighbor() override
RelocateExpensiveChain(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, int num_arcs_to_consider, std::function< int64(int64, int64, int64)> arc_cost_for_path_start)
~RelocateExpensiveChain() override
Definition: routing_neighborhoods.h:565
bool MakeOneNeighbor() override
This method should not be overridden. Override MakeNeighbor() instead.
std::string DebugString() const override
Definition: routing_neighborhoods.h:569
Heuristic-based local search operator which relocates an entire route to an empty vehicle of differen...
Definition: routing_neighborhoods.h:422
RelocatePathAndHeuristicInsertUnperformedOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic)
~RelocatePathAndHeuristicInsertUnperformedOperator() override
Definition: routing_neighborhoods.h:426
std::string DebugString() const override
Definition: routing_neighborhoods.h:428
Tries to move subtrips after an insertion node.
Definition: routing_neighborhoods.h:720
bool MakeNeighbor() override
RelocateSubtrip(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:727
Definition: routing.h:213
bool IsEnd(int64 index) const
Returns true if 'index' represents the last node of a route.
Definition: routing.h:1186
Operator which iterates through each alternative of a set of pairs.
Definition: routing_neighborhoods.h:284
void OnStart() override
Called by Start() after synchronizing the operator with the current assignment.
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
Redefines MakeNextNeighbor to export a simpler interface.
~SwapIndexPairOperator() override
Definition: routing_neighborhoods.h:290
SwapIndexPairOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &path_vars, std::function< int(int64)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:294
int Size() const
Definition: constraint_solveri.h:840
const int64 & Value(int64 index) const
Returns the value in the current assignment of the variable of given index.
Definition: constraint_solveri.h:843
void SetValue(int64 index, const int64 &value)
Definition: constraint_solveri.h:851
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: constraint_solver.h:106
std::function< int64(int64, int64)> RoutingTransitCallback2
Definition: routing_types.h:42
std::vector< RoutingIndexPair > RoutingIndexPairs
Definition: routing_types.h:45