Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::PathOperator< ignore_path_vars > Class Template Referenceabstract

#include <constraint_solveri.h>

Inheritance diagram for operations_research::PathOperator< ignore_path_vars >:
operations_research::IntVarLocalSearchOperator operations_research::LocalSearchOperator operations_research::BaseObject operations_research::BaseInactiveNodeToPathOperator< ignore_path_vars > operations_research::Cross< ignore_path_vars > operations_research::Exchange< ignore_path_vars > operations_research::ExchangeSubtrip< ignore_path_vars > operations_research::GroupPairAndRelocateOperator< ignore_path_vars > operations_research::IndexPairSwapActiveOperator< ignore_path_vars > operations_research::LightPairRelocateOperator< ignore_path_vars > operations_research::LinKernighan< ignore_path_vars > operations_research::MakeChainInactiveOperator< ignore_path_vars > operations_research::MakeInactiveOperator< ignore_path_vars > operations_research::MakePairActiveOperator< ignore_path_vars > operations_research::MakePairInactiveOperator< ignore_path_vars > operations_research::MakeRelocateNeighborsOperator< ignore_path_vars > operations_research::PairExchangeOperator< ignore_path_vars > operations_research::PairExchangeRelocateOperator< ignore_path_vars > operations_research::PairNodeSwapActiveOperator< swap_first, ignore_path_vars > operations_research::PairRelocateOperator< ignore_path_vars > operations_research::PathLns< ignore_path_vars > operations_research::Relocate< ignore_path_vars > operations_research::RelocateAndMakeInactiveOperator< ignore_path_vars > operations_research::RelocateExpensiveChain< ignore_path_vars > operations_research::RelocateSubtrip< ignore_path_vars > operations_research::SwapActiveToShortestPathOperator< ignore_path_vars > operations_research::TSPLns< ignore_path_vars > operations_research::TSPOpt< ignore_path_vars > operations_research::TwoOpt< ignore_path_vars > operations_research::TwoOptWithShortestPathOperator< ignore_path_vars >

Classes

struct  IterationParameters
 Set of parameters used to configure how the neighnorhood is traversed. More...
 
struct  Neighbor
 

Public Member Functions

 PathOperator (const std::vector< IntVar * > &next_vars, const std::vector< IntVar * > &path_vars, IterationParameters iteration_parameters)
 Builds an instance of PathOperator from next and path variables.
 
 PathOperator (const std::vector< IntVar * > &next_vars, const std::vector< IntVar * > &path_vars, int number_of_base_nodes, bool skip_locally_optimal_paths, bool accept_path_end_base, std::function< int(int64_t)> start_empty_path_class, std::function< const std::vector< int > &(int, int)> get_incoming_neighbors, std::function< const std::vector< int > &(int, int)> get_outgoing_neighbors)
 
 ~PathOperator () override
 
virtual bool MakeNeighbor ()=0
 
void EnterSearch () override
 
void Reset () override
 
bool SkipUnchanged (int index) const override
 
int64_t Next (int64_t node) const
 Returns the node after node in the current delta.
 
int64_t Prev (int64_t node) const
 Returns the node before node in the current delta.
 
int64_t Path (int64_t node) const
 
int number_of_nexts () const
 Number of next variables.
 
- Public Member Functions inherited from operations_research::IntVarLocalSearchOperator
 IntVarLocalSearchOperator (const std::vector< IntVar * > &vars, bool keep_inverse_values=false)
 
 ~IntVarLocalSearchOperator () override
 
bool HoldsDelta () const override
 
void Start (const Assignment *assignment) override
 
virtual bool IsIncremental () const
 
int Size () const
 
int64_t Value (int64_t index) const
 
IntVarVar (int64_t index) const
 Returns the variable of given index.
 
int64_t OldValue (int64_t index) const
 
int64_t PrevValue (int64_t index) const
 
void SetValue (int64_t index, int64_t value)
 
bool Activated (int64_t index) const
 
void Activate (int64_t index)
 
void Deactivate (int64_t index)
 
bool ApplyChanges (Assignment *delta, Assignment *deltadelta) const
 
void RevertChanges (bool change_was_incremental)
 
void AddVars (const std::vector< IntVar * > &vars)
 
bool MakeNextNeighbor (Assignment *delta, Assignment *deltadelta) override
 --— Base operator class for operators manipulating IntVars --—
 
- Public Member Functions inherited from operations_research::LocalSearchOperator
 LocalSearchOperator ()
 
 ~LocalSearchOperator () override
 
virtual const LocalSearchOperatorSelf () const
 
virtual bool HasFragments () const
 
- Public Member Functions inherited from operations_research::BaseObject
 BaseObject ()
 
 BaseObject (const BaseObject &)=delete
 This type is neither copyable nor movable.
 
BaseObjectoperator= (const BaseObject &)=delete
 
virtual ~BaseObject ()
 
virtual std::string DebugString () const
 

Protected Member Functions

bool MakeOneNeighbor () override
 This method should not be overridden. Override MakeNeighbor() instead.
 
virtual void OnNodeInitialization ()
 
virtual void ResetIncrementalism ()
 
int64_t BaseNode (int i) const
 Returns the ith base node of the operator.
 
int64_t BaseAlternativeNode (int i) const
 Returns the alternative node for the ith base node.
 
int64_t BaseSiblingAlternativeNode (int i) const
 Returns the alternative node for the sibling of the ith base node.
 
int64_t StartNode (int i) const
 Returns the start node of the ith base node.
 
int64_t EndNode (int i) const
 Returns the end node of the ith base node.
 
const std::vector< int64_t > & path_starts () const
 Returns the vector of path start nodes.
 
int PathClass (int i) const
 Returns the class of the path of the ith base node.
 
int PathClassFromStartNode (int64_t start_node) const
 
virtual bool RestartAtPathStartOnSynchronize ()
 
virtual bool OnSamePathAsPreviousBase (int64_t)
 
virtual int64_t GetBaseNodeRestartPosition (int base_index)
 
virtual void SetNextBaseToIncrement (int64_t base_index)
 
virtual bool ConsiderAlternatives (int64_t) const
 
int64_t OldNext (int64_t node) const
 
int64_t PrevNext (int64_t node) const
 
int64_t OldPrev (int64_t node) const
 
int64_t OldPath (int64_t node) const
 
int CurrentNodePathStart (int64_t node) const
 
int CurrentNodePathEnd (int64_t node) const
 
bool MoveChain (int64_t before_chain, int64_t chain_end, int64_t destination)
 
bool ReverseChain (int64_t before_chain, int64_t after_chain, int64_t *chain_last)
 
bool SwapNodes (int64_t node1, int64_t node2)
 Swaps the nodes node1 and node2.
 
bool MakeActive (int64_t node, int64_t destination)
 Insert the inactive node after destination.
 
bool MakeChainInactive (int64_t before_chain, int64_t chain_end)
 
bool SwapActiveAndInactive (int64_t active, int64_t inactive)
 Replaces active by inactive in the current path, making active inactive.
 
bool SwapActiveAndInactiveChains (absl::Span< const int64_t > active_chain, absl::Span< const int64_t > inactive_chain)
 
void SetNext (int64_t from, int64_t to, int64_t path)
 Sets 'to' to be the node after 'from' on the given path.
 
bool IsPathEnd (int64_t node) const
 
bool IsPathStart (int64_t node) const
 Returns true if node is the first node on the path.
 
bool IsInactive (int64_t node) const
 Returns true if node is inactive.
 
virtual bool InitPosition () const
 
void ResetPosition ()
 
int AddAlternativeSet (const std::vector< int64_t > &alternative_set)
 
template<typename PairType>
void AddPairAlternativeSets (const std::vector< PairType > &pair_alternative_sets)
 
int64_t GetActiveInAlternativeSet (int alternative_index) const
 Returns the active node in the given alternative set.
 
int64_t GetActiveAlternativeNode (int node) const
 Returns the active node in the alternative set of the given node.
 
int GetSiblingAlternativeIndex (int node) const
 Returns the index of the alternative set of the sibling of node.
 
int GetAlternativeIndex (int node) const
 Returns the index of the alternative set of the node.
 
int64_t GetActiveAlternativeSibling (int node) const
 
bool CheckChainValidity (int64_t before_chain, int64_t chain_end, int64_t exclude) const
 
bool HasNeighbors () const
 
Neighbor GetNeighborForBaseNode (int64_t base_index) const
 
- Protected Member Functions inherited from operations_research::IntVarLocalSearchOperator
int64_t InverseValue (int64_t index) const
 
int64_t OldInverseValue (int64_t index) const
 
void AddToAssignment (IntVar *var, int64_t value, bool active, std::vector< int > *assignment_indices, int64_t index, Assignment *assignment) const
 

Protected Attributes

const int number_of_nexts_
 

Friends

class BaseNodeIterators< PathOperator >
 
class AlternativeNodeIterator
 
class NodeNeighborIterator
 

Detailed Description

template<bool ignore_path_vars>
class operations_research::PathOperator< ignore_path_vars >

Base class of the local search operators dedicated to path modifications (a path is a set of nodes linked together by arcs). This family of neighborhoods supposes they are handling next variables representing the arcs (var[i] represents the node immediately after i on a path). Several services are provided:

  • arc manipulators (SetNext(), ReverseChain(), MoveChain())
  • path inspectors (Next(), Prev(), IsPathEnd())
  • path iterators: operators need a given number of nodes to define a neighbor; this class provides the iteration on a given number of (base) nodes which can be used to define a neighbor (through the BaseNode method) Subclasses only need to override MakeNeighbor to create neighbors using the services above (no direct manipulation of assignments).

Definition at line 1530 of file constraint_solveri.h.

Constructor & Destructor Documentation

◆ PathOperator() [1/2]

template<bool ignore_path_vars>
operations_research::PathOperator< ignore_path_vars >::PathOperator ( const std::vector< IntVar * > & next_vars,
const std::vector< IntVar * > & path_vars,
IterationParameters iteration_parameters )
inline

Builds an instance of PathOperator from next and path variables.

Definition at line 1562 of file constraint_solveri.h.

◆ PathOperator() [2/2]

template<bool ignore_path_vars>
operations_research::PathOperator< ignore_path_vars >::PathOperator ( const std::vector< IntVar * > & next_vars,
const std::vector< IntVar * > & path_vars,
int number_of_base_nodes,
bool skip_locally_optimal_paths,
bool accept_path_end_base,
std::function< int(int64_t)> start_empty_path_class,
std::function< const std::vector< int > &(int, int)> get_incoming_neighbors,
std::function< const std::vector< int > &(int, int)> get_outgoing_neighbors )
inline

Definition at line 1601 of file constraint_solveri.h.

◆ ~PathOperator()

template<bool ignore_path_vars>
operations_research::PathOperator< ignore_path_vars >::~PathOperator ( )
inlineoverride

Definition at line 1613 of file constraint_solveri.h.

Member Function Documentation

◆ AddAlternativeSet()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::AddAlternativeSet ( const std::vector< int64_t > & alternative_set)
inlineprotected

Handling node alternatives. Adds a set of node alternatives to the neighborhood. No node can be in two alternatives.

Definition at line 1910 of file constraint_solveri.h.

◆ AddPairAlternativeSets()

template<bool ignore_path_vars>
template<typename PairType>
void operations_research::PathOperator< ignore_path_vars >::AddPairAlternativeSets ( const std::vector< PairType > & pair_alternative_sets)
inlineprotected

Adds all sets of node alternatives of a vector of alternative pairs. No node can be in two alternatives.

Definition at line 1924 of file constraint_solveri.h.

◆ BaseAlternativeNode()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::BaseAlternativeNode ( int i) const
inlineprotected

Returns the alternative node for the ith base node.

Definition at line 1685 of file constraint_solveri.h.

◆ BaseNode()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::BaseNode ( int i) const
inlineprotected

Returns the ith base node of the operator.

Definition at line 1683 of file constraint_solveri.h.

◆ BaseSiblingAlternativeNode()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::BaseSiblingAlternativeNode ( int i) const
inlineprotected

Returns the alternative node for the sibling of the ith base node.

Definition at line 1690 of file constraint_solveri.h.

◆ CheckChainValidity()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::CheckChainValidity ( int64_t before_chain,
int64_t chain_end,
int64_t exclude ) const
inlineprotected

Returns true if the chain is a valid path without cycles from before_chain to chain_end and does not contain exclude. In particular, rejects a chain if chain_end is not strictly after before_chain on the path. Cycles are detected through chain length overflow.

Definition at line 1962 of file constraint_solveri.h.

◆ ConsiderAlternatives()

template<bool ignore_path_vars>
virtual bool operations_research::PathOperator< ignore_path_vars >::ConsiderAlternatives ( int64_t ) const
inlineprotectedvirtual

Indicates if alternatives should be considered when iterating over base nodes.

Reimplemented in operations_research::PairRelocateOperator< ignore_path_vars >.

Definition at line 1738 of file constraint_solveri.h.

◆ CurrentNodePathEnd()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::CurrentNodePathEnd ( int64_t node) const
inlineprotected

Definition at line 1764 of file constraint_solveri.h.

◆ CurrentNodePathStart()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::CurrentNodePathStart ( int64_t node) const
inlineprotected

Definition at line 1760 of file constraint_solveri.h.

◆ EndNode()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::EndNode ( int i) const
inlineprotected

Returns the end node of the ith base node.

Definition at line 1697 of file constraint_solveri.h.

◆ EnterSearch()

template<bool ignore_path_vars>
void operations_research::PathOperator< ignore_path_vars >::EnterSearch ( )
inlineoverridevirtual

Reimplemented from operations_research::LocalSearchOperator.

Definition at line 1615 of file constraint_solveri.h.

◆ GetActiveAlternativeNode()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::GetActiveAlternativeNode ( int node) const
inlineprotected

Returns the active node in the alternative set of the given node.

Definition at line 1940 of file constraint_solveri.h.

◆ GetActiveAlternativeSibling()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::GetActiveAlternativeSibling ( int node) const
inlineprotected

Returns the active node in the alternative set of the sibling of the given node.

Definition at line 1954 of file constraint_solveri.h.

◆ GetActiveInAlternativeSet()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::GetActiveInAlternativeSet ( int alternative_index) const
inlineprotected

Returns the active node in the given alternative set.

Definition at line 1934 of file constraint_solveri.h.

◆ GetAlternativeIndex()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::GetAlternativeIndex ( int node) const
inlineprotected

Returns the index of the alternative set of the node.

Definition at line 1949 of file constraint_solveri.h.

◆ GetBaseNodeRestartPosition()

template<bool ignore_path_vars>
virtual int64_t operations_research::PathOperator< ignore_path_vars >::GetBaseNodeRestartPosition ( int base_index)
inlineprotectedvirtual

◆ GetNeighborForBaseNode()

template<bool ignore_path_vars>
Neighbor operations_research::PathOperator< ignore_path_vars >::GetNeighborForBaseNode ( int64_t base_index) const
inlineprotected

Definition at line 1989 of file constraint_solveri.h.

◆ GetSiblingAlternativeIndex()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::GetSiblingAlternativeIndex ( int node) const
inlineprotected

Returns the index of the alternative set of the sibling of node.

Definition at line 1944 of file constraint_solveri.h.

◆ HasNeighbors()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::HasNeighbors ( ) const
inlineprotected

Definition at line 1977 of file constraint_solveri.h.

◆ InitPosition()

template<bool ignore_path_vars>
virtual bool operations_research::PathOperator< ignore_path_vars >::InitPosition ( ) const
inlineprotectedvirtual

Returns true if the operator needs to restart its initial position at each call to Start()

Definition at line 1901 of file constraint_solveri.h.

◆ IsInactive()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::IsInactive ( int64_t node) const
inlineprotected

Returns true if node is inactive.

Definition at line 1895 of file constraint_solveri.h.

◆ IsPathEnd()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::IsPathEnd ( int64_t node) const
inlineprotected

Returns true if node is the last node on the path; defined by the fact that node is outside the range of the variable array.

Definition at line 1889 of file constraint_solveri.h.

◆ IsPathStart()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::IsPathStart ( int64_t node) const
inlineprotected

Returns true if node is the first node on the path.

Definition at line 1892 of file constraint_solveri.h.

◆ MakeActive()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::MakeActive ( int64_t node,
int64_t destination )
inlineprotected

Insert the inactive node after destination.

Definition at line 1828 of file constraint_solveri.h.

◆ MakeChainInactive()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::MakeChainInactive ( int64_t before_chain,
int64_t chain_end )
inlineprotected

Makes the nodes on the chain starting after before_chain and ending at chain_end inactive.

Definition at line 1837 of file constraint_solveri.h.

◆ MakeNeighbor()

template<bool ignore_path_vars>
virtual bool operations_research::PathOperator< ignore_path_vars >::MakeNeighbor ( )
pure virtual

Implemented in operations_research::Cross< ignore_path_vars >, operations_research::Exchange< ignore_path_vars >, operations_research::ExchangeAndMakeActiveOperator< ignore_path_vars >, operations_research::ExchangePathStartEndsAndMakeActiveOperator< ignore_path_vars >, operations_research::ExchangeSubtrip< ignore_path_vars >, operations_research::ExtendedSwapActiveOperator< ignore_path_vars >, operations_research::GroupPairAndRelocateOperator< ignore_path_vars >, operations_research::IndexPairSwapActiveOperator< ignore_path_vars >, operations_research::LightPairRelocateOperator< ignore_path_vars >, operations_research::LinKernighan< ignore_path_vars >, operations_research::MakeActiveAndRelocateOperator< ignore_path_vars >, operations_research::MakeActiveOperator< ignore_path_vars >, operations_research::MakeChainInactiveOperator< ignore_path_vars >, operations_research::MakeInactiveOperator< ignore_path_vars >, operations_research::MakePairActiveOperator< ignore_path_vars >, operations_research::MakePairInactiveOperator< ignore_path_vars >, operations_research::MakeRelocateNeighborsOperator< ignore_path_vars >, operations_research::PairExchangeOperator< ignore_path_vars >, operations_research::PairExchangeRelocateOperator< ignore_path_vars >, operations_research::PairNodeSwapActiveOperator< swap_first, ignore_path_vars >, operations_research::PairRelocateOperator< ignore_path_vars >, operations_research::PathLns< ignore_path_vars >, operations_research::Relocate< ignore_path_vars >, operations_research::RelocateAndMakeActiveOperator< ignore_path_vars >, operations_research::RelocateAndMakeInactiveOperator< ignore_path_vars >, operations_research::RelocateExpensiveChain< ignore_path_vars >, operations_research::RelocateSubtrip< ignore_path_vars >, operations_research::SwapActiveChainOperator< ignore_path_vars >, operations_research::SwapActiveOperator< ignore_path_vars >, operations_research::SwapActiveToShortestPathOperator< ignore_path_vars >, operations_research::TSPLns< ignore_path_vars >, operations_research::TSPOpt< ignore_path_vars >, operations_research::TwoOpt< ignore_path_vars >, and operations_research::TwoOptWithShortestPathOperator< ignore_path_vars >.

◆ MakeOneNeighbor()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::MakeOneNeighbor ( )
inlineoverrideprotectedvirtual

This method should not be overridden. Override MakeNeighbor() instead.

Need to revert changes here since MakeNeighbor might have returned false and have done changes in the previous iteration.

Reimplemented from operations_research::IntVarLocalSearchOperator.

Reimplemented in operations_research::RelocateExpensiveChain< ignore_path_vars >, and operations_research::TSPLns< ignore_path_vars >.

Definition at line 1660 of file constraint_solveri.h.

◆ MoveChain()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::MoveChain ( int64_t before_chain,
int64_t chain_end,
int64_t destination )
inlineprotected

Moves the chain starting after the node before_chain and ending at the node chain_end after the node destination

Definition at line 1768 of file constraint_solveri.h.

◆ Next()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::Next ( int64_t node) const
inline

Returns the node after node in the current delta.

Definition at line 1636 of file constraint_solveri.h.

◆ number_of_nexts()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::number_of_nexts ( ) const
inline

Number of next variables.

Definition at line 1656 of file constraint_solveri.h.

◆ OldNext()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::OldNext ( int64_t node) const
inlineprotected

Definition at line 1740 of file constraint_solveri.h.

◆ OldPath()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::OldPath ( int64_t node) const
inlineprotected

Definition at line 1755 of file constraint_solveri.h.

◆ OldPrev()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::OldPrev ( int64_t node) const
inlineprotected

Definition at line 1750 of file constraint_solveri.h.

◆ OnNodeInitialization()

template<bool ignore_path_vars>
virtual void operations_research::PathOperator< ignore_path_vars >::OnNodeInitialization ( )
inlineprotectedvirtual

Called by OnStart() after initializing node information. Should be overridden instead of OnStart() to avoid calling PathOperator::OnStart explicitly.

Definition at line 1675 of file constraint_solveri.h.

◆ OnSamePathAsPreviousBase()

template<bool ignore_path_vars>
virtual bool operations_research::PathOperator< ignore_path_vars >::OnSamePathAsPreviousBase ( int64_t )
inlineprotectedvirtual

◆ Path()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::Path ( int64_t node) const
inline

Returns the index of the path to which node belongs in the current delta. Only returns a valid value if path variables are taken into account.

Definition at line 1650 of file constraint_solveri.h.

◆ path_starts()

template<bool ignore_path_vars>
const std::vector< int64_t > & operations_research::PathOperator< ignore_path_vars >::path_starts ( ) const
inlineprotected

Returns the vector of path start nodes.

Definition at line 1699 of file constraint_solveri.h.

◆ PathClass()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::PathClass ( int i) const
inlineprotected

Returns the class of the path of the ith base node.

Definition at line 1701 of file constraint_solveri.h.

◆ PathClassFromStartNode()

template<bool ignore_path_vars>
int operations_research::PathOperator< ignore_path_vars >::PathClassFromStartNode ( int64_t start_node) const
inlineprotected

Definition at line 1702 of file constraint_solveri.h.

◆ Prev()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::Prev ( int64_t node) const
inline

Returns the node before node in the current delta.

Definition at line 1642 of file constraint_solveri.h.

◆ PrevNext()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::PrevNext ( int64_t node) const
inlineprotected

Definition at line 1745 of file constraint_solveri.h.

◆ Reset()

template<bool ignore_path_vars>
void operations_research::PathOperator< ignore_path_vars >::Reset ( )
inlineoverridevirtual

Reimplemented from operations_research::LocalSearchOperator.

Definition at line 1619 of file constraint_solveri.h.

◆ ResetIncrementalism()

template<bool ignore_path_vars>
virtual void operations_research::PathOperator< ignore_path_vars >::ResetIncrementalism ( )
inlineprotectedvirtual

When entering a new search or using metaheuristics, path operators reactivate optimal routes and iterating re-starts at route starts, which can potentially be out of sync with the last incremental moves. This requires resetting incrementalism.

Reimplemented in operations_research::SwapActiveChainOperator< ignore_path_vars >, and operations_research::TwoOpt< ignore_path_vars >.

Definition at line 1680 of file constraint_solveri.h.

◆ ResetPosition()

template<bool ignore_path_vars>
void operations_research::PathOperator< ignore_path_vars >::ResetPosition ( )
inlineprotected

Reset the position of the operator to its position when Start() was last called; this can be used to let an operator iterate more than once over the paths.

Definition at line 1905 of file constraint_solveri.h.

◆ RestartAtPathStartOnSynchronize()

template<bool ignore_path_vars>
virtual bool operations_research::PathOperator< ignore_path_vars >::RestartAtPathStartOnSynchronize ( )
inlineprotectedvirtual

When the operator is being synchronized with a new solution (when Start() is called), returns true to restart the exploration of the neighborhood from the start of the last paths explored; returns false to restart the exploration at the last nodes visited. This is used to avoid restarting on base nodes which have changed paths, leading to potentially skipping neighbors.

Todo
(user): remove this when automatic detection of such cases in done.

Reimplemented in operations_research::MakePairActiveOperator< ignore_path_vars >, operations_research::PairNodeSwapActiveOperator< swap_first, ignore_path_vars >, and operations_research::TwoOptWithShortestPathOperator< ignore_path_vars >.

Definition at line 1715 of file constraint_solveri.h.

◆ ReverseChain()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::ReverseChain ( int64_t before_chain,
int64_t after_chain,
int64_t * chain_last )
inlineprotected

Reverses the chain starting after before_chain and ending before after_chain

Definition at line 1792 of file constraint_solveri.h.

◆ SetNext()

template<bool ignore_path_vars>
void operations_research::PathOperator< ignore_path_vars >::SetNext ( int64_t from,
int64_t to,
int64_t path )
inlineprotected

Sets 'to' to be the node after 'from' on the given path.

Definition at line 1878 of file constraint_solveri.h.

◆ SetNextBaseToIncrement()

template<bool ignore_path_vars>
virtual void operations_research::PathOperator< ignore_path_vars >::SetNextBaseToIncrement ( int64_t base_index)
inlineprotectedvirtual

Set the next base to increment on next iteration. All base > base_index will be reset to their start value.

Definition at line 1733 of file constraint_solveri.h.

◆ SkipUnchanged()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::SkipUnchanged ( int index) const
inlineoverridevirtual
Todo
(user): Make the following methods protected.

Reimplemented from operations_research::IntVarLocalSearchOperator.

Definition at line 1625 of file constraint_solveri.h.

◆ StartNode()

template<bool ignore_path_vars>
int64_t operations_research::PathOperator< ignore_path_vars >::StartNode ( int i) const
inlineprotected

Returns the start node of the ith base node.

Definition at line 1695 of file constraint_solveri.h.

◆ SwapActiveAndInactive()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::SwapActiveAndInactive ( int64_t active,
int64_t inactive )
inlineprotected

Replaces active by inactive in the current path, making active inactive.

Definition at line 1855 of file constraint_solveri.h.

◆ SwapActiveAndInactiveChains()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::SwapActiveAndInactiveChains ( absl::Span< const int64_t > active_chain,
absl::Span< const int64_t > inactive_chain )
inlineprotected

Swaps both chains, making nodes on active_chain inactive and inserting active_chain at the position where inactive_chain was.

Definition at line 1862 of file constraint_solveri.h.

◆ SwapNodes()

template<bool ignore_path_vars>
bool operations_research::PathOperator< ignore_path_vars >::SwapNodes ( int64_t node1,
int64_t node2 )
inlineprotected

Swaps the nodes node1 and node2.

Definition at line 1816 of file constraint_solveri.h.

Friends And Related Symbol Documentation

◆ AlternativeNodeIterator

template<bool ignore_path_vars>
friend class AlternativeNodeIterator
friend

Definition at line 2417 of file constraint_solveri.h.

◆ BaseNodeIterators< PathOperator >

template<bool ignore_path_vars>
friend class BaseNodeIterators< PathOperator >
friend

Definition at line 2414 of file constraint_solveri.h.

◆ NodeNeighborIterator

template<bool ignore_path_vars>
friend class NodeNeighborIterator
friend

Definition at line 2418 of file constraint_solveri.h.

Member Data Documentation

◆ number_of_nexts_

template<bool ignore_path_vars>
const int operations_research::PathOperator< ignore_path_vars >::number_of_nexts_
protected

Definition at line 1995 of file constraint_solveri.h.


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