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:5171
bool MakeNeighbor() override
ExchangeSubtrip(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:846
Filtered heuristic LNS operator, where the destruction phase consists of removing a node and the 'num...
Definition: routing_neighborhoods.h:584
operations_research::FilteredHeuristicCloseNodesLNSOperator::~FilteredHeuristicCloseNodesLNSOperator
~FilteredHeuristicCloseNodesLNSOperator() override
Definition: routing_neighborhoods.h:588
FilteredHeuristicCloseNodesLNSOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic, int num_close_nodes)
std::string DebugString() const override
Definition: routing_neighborhoods.h:590
Similar to the heuristic path LNS above, but instead of removing one route entirely,...
Definition: routing_neighborhoods.h:541
FilteredHeuristicExpensiveChainLNSOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic, int num_arcs_to_consider, std::function< int64_t(int64_t, int64_t, int64_t)> arc_cost_for_route_start)
~FilteredHeuristicExpensiveChainLNSOperator() override
Definition: routing_neighborhoods.h:548
std::string DebugString() const override
Definition: routing_neighborhoods.h:550
Class of operators using a RoutingFilteredHeuristic to insert unperformed nodes after changes have be...
Definition: routing_neighborhoods.h:432
~FilteredHeuristicLocalSearchOperator() override
Definition: routing_neighborhoods.h:437
FilteredHeuristicLocalSearchOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic, bool keep_inverse_values=false)
virtual std::function< int64_t(int64_t)> SetupNextAccessorForNeighbor()=0
Virtual method to return the next_accessor to be passed to the heuristic to build a new solution.
RoutingModel *const model_
Definition: routing_neighborhoods.h:462
virtual bool IncrementPosition()=0
std::string HeuristicName() const
Definition: routing_neighborhoods.h:446
SparseBitset removed_nodes_
Keeps track of removed nodes when making a neighbor.
Definition: routing_neighborhoods.h:464
LNS-like operator based on a filtered first solution heuristic to rebuild the solution,...
Definition: routing_neighborhoods.h:479
FilteredHeuristicPathLNSOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic)
std::string DebugString() const override
Definition: routing_neighborhoods.h:485
~FilteredHeuristicPathLNSOperator() override
Definition: routing_neighborhoods.h:483
Operator which moves a pair of nodes to another position where the first node of the pair is directly...
Definition: routing_neighborhoods.h:244
bool MakeNeighbor() override
GroupPairAndRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
~GroupPairAndRelocateOperator() override
Definition: routing_neighborhoods.h:251
std::string DebugString() const override
Definition: routing_neighborhoods.h:254
Operator which inserts inactive nodes into a path and makes a pair of active nodes inactive.
Definition: routing_neighborhoods.h:407
IndexPairSwapActiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
bool MakeNeighbor() override
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
OnStart() should really be protected, but then SWIG doesn't see it.
~IndexPairSwapActiveOperator() override
Definition: routing_neighborhoods.h:414
std::string DebugString() const override
Definition: routing_neighborhoods.h:418
Specialization of LocalSearchOperator built from an array of IntVars which specifies the scope of the...
Definition: constraint_solveri.h:1048
void SetValue(int64_t index, int64_t value)
Definition: constraint_solveri.h:1105
int Size() const
Definition: constraint_solveri.h:1091
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
OnStart() should really be protected, but then SWIG doesn't see it.
int64_t InverseValue(int64_t index) const
Definition: constraint_solveri.h:1181
int64_t Value(int64_t index) const
Returns the value in the current assignment of the variable of given index.
Definition: constraint_solveri.h:1094
Operator which moves a pair of nodes to another position where the first node of the pair must be bef...
Definition: routing_neighborhoods.h:268
bool MakeNeighbor() override
LightPairRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs, std::function< bool(int64_t)> force_lifo=nullptr)
~LightPairRelocateOperator() override
Definition: routing_neighborhoods.h:275
std::string DebugString() const override
Definition: routing_neighborhoods.h:278
Pair-based neighborhood operators, designed to move nodes by pairs (pairs are static and given).
Definition: routing_neighborhoods.h:157
int64_t 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...
bool MakeNeighbor() override
MakePairActiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &pairs)
~MakePairActiveOperator() override
Definition: routing_neighborhoods.h:163
bool RestartAtPathStartOnSynchronize() override
Required to ensure that after synchronization the operator is in a state compatible with GetBaseNodeR...
Definition: routing_neighborhoods.h:179
bool MakeOneNeighbor() override
This method should not be overridden. Override MakeNeighbor() instead.
bool OnSamePathAsPreviousBase(int64_t 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:169
std::string DebugString() const override
Definition: routing_neighborhoods.h:165
Operator which makes pairs of active nodes inactive.
Definition: routing_neighborhoods.h:193
MakePairInactiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
bool MakeNeighbor() override
std::string DebugString() const override
Definition: routing_neighborhoods.h:201
Relocate neighborhood which moves chains of neighbors.
Definition: routing_neighborhoods.h:57
bool MakeNeighbor() override
MakeRelocateNeighborsOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, RoutingTransitCallback2 arc_evaluator)
~MakeRelocateNeighborsOperator() override
Definition: routing_neighborhoods.h:64
std::string DebugString() const override
Definition: routing_neighborhoods.h:67
Operator which exchanges the position of two pairs; for both pairs the first node of the pair must be...
Definition: routing_neighborhoods.h:292
bool MakeNeighbor() override
~PairExchangeOperator() override
Definition: routing_neighborhoods.h:298
PairExchangeOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:301
Operator which exchanges the paths of two pairs (path have to be different).
Definition: routing_neighborhoods.h:323
int64_t 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...
bool MakeNeighbor() override
PairExchangeRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
~PairExchangeRelocateOperator() override
Definition: routing_neighborhoods.h:330
bool OnSamePathAsPreviousBase(int64_t 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...
std::string DebugString() const override
Definition: routing_neighborhoods.h:333
Operator which inserts pairs of inactive nodes into a path and makes an active node inactive.
Definition: routing_neighborhoods.h:694
int64_t 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:743
bool MakeNeighbor() override
Definition: routing_neighborhoods.h:781
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
OnStart() should really be protected, but then SWIG doesn't see it.
Definition: routing_neighborhoods.h:765
~PairNodeSwapActiveOperator() override
Definition: routing_neighborhoods.h:700
bool RestartAtPathStartOnSynchronize() override
Required to ensure that after synchronization the operator is in a state compatible with GetBaseNodeR...
Definition: routing_neighborhoods.h:719
PairNodeSwapActiveOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
Definition: routing_neighborhoods.h:732
bool OnSamePathAsPreviousBase(int64_t 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:709
std::string DebugString() const override
Definition: routing_neighborhoods.h:704
Operator which moves a pair of nodes to another position where the first node of the pair must be bef...
Definition: routing_neighborhoods.h:212
int64_t 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...
bool MakeNeighbor() override
~PairRelocateOperator() override
Definition: routing_neighborhoods.h:218
bool ConsiderAlternatives(int64_t base_index) const override
Indicates if alternatives should be considered when iterating over base nodes.
Definition: routing_neighborhoods.h:230
PairRelocateOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
bool OnSamePathAsPreviousBase(int64_t 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:224
std::string DebugString() const override
Definition: routing_neighborhoods.h:221
Base class of the local search operators dedicated to path modifications (a path is a set of nodes li...
Definition: constraint_solveri.h:1300
RelocateExpensiveChain.
Definition: routing_neighborhoods.h:647
bool MakeNeighbor() override
~RelocateExpensiveChain() override
Definition: routing_neighborhoods.h:655
RelocateExpensiveChain(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, int num_arcs_to_consider, std::function< int64_t(int64_t, int64_t, int64_t)> arc_cost_for_path_start)
bool MakeOneNeighbor() override
This method should not be overridden. Override MakeNeighbor() instead.
std::string DebugString() const override
Definition: routing_neighborhoods.h:659
Heuristic-based local search operator which relocates an entire route to an empty vehicle of differen...
Definition: routing_neighborhoods.h:507
RelocatePathAndHeuristicInsertUnperformedOperator(std::unique_ptr< RoutingFilteredHeuristic > heuristic)
~RelocatePathAndHeuristicInsertUnperformedOperator() override
Definition: routing_neighborhoods.h:511
std::string DebugString() const override
Definition: routing_neighborhoods.h:513
Tries to move subtrips after an insertion node.
Definition: routing_neighborhoods.h:810
bool MakeNeighbor() override
RelocateSubtrip(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &pairs)
std::string DebugString() const override
Definition: routing_neighborhoods.h:817
Definition: routing.h:246
bool IsEnd(int64_t index) const
Returns true if 'index' represents the last node of a route.
Definition: routing.h:1456
~SwapActiveToShortestPathOperator() override=default
bool MakeNeighbor() override
SwapActiveToShortestPathOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, std::function< int(int64_t)> start_empty_path_class, std::vector< std::vector< int64_t >> alternative_sets, RoutingTransitCallback2 arc_evaluator)
std::string DebugString() const override
Definition: routing_neighborhoods.h:119
Operator which iterates through each alternative of a set of pairs.
Definition: routing_neighborhoods.h:368
void OnStart() override
Called by Start() after synchronizing the operator with the current assignment.
bool MakeNextNeighbor(Assignment *delta, Assignment *deltadelta) override
OnStart() should really be protected, but then SWIG doesn't see it.
SwapIndexPairOperator(const std::vector< IntVar * > &vars, const std::vector< IntVar * > &path_vars, std::function< int(int64_t)> start_empty_path_class, const RoutingIndexPairs &index_pairs)
~SwapIndexPairOperator() override
Definition: routing_neighborhoods.h:374
std::string DebugString() const override
Definition: routing_neighborhoods.h:378
Collection of objects used to extend the Constraint Solver library.
Definition: constraint_solver.h:109
std::function< int64_t(int64_t, int64_t)> RoutingTransitCallback2
Definition: routing_types.h:43
std::vector< RoutingIndexPair > RoutingIndexPairs
Definition: routing_types.h:46