Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::SwapIndexPairOperator Class Reference

#include <routing_neighborhoods.h>

Inheritance diagram for operations_research::SwapIndexPairOperator:
operations_research::IntVarLocalSearchOperator operations_research::LocalSearchOperator operations_research::BaseObject

Public Member Functions

 SwapIndexPairOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &path_vars, const std::vector< PickupDeliveryPair > &pairs)
 
 ~SwapIndexPairOperator () override
 
bool MakeNextNeighbor (Assignment *delta, Assignment *deltadelta) override
 --— Base operator class for operators manipulating IntVars --—
 
void OnStart () override
 
std::string DebugString () const override
 
- 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.
 
virtual bool SkipUnchanged (int index) const
 
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)
 
- Public Member Functions inherited from operations_research::LocalSearchOperator
 LocalSearchOperator ()
 
 ~LocalSearchOperator () override
 
virtual void Reset ()
 
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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from operations_research::IntVarLocalSearchOperator
virtual bool MakeOneNeighbor ()
 
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
 

Detailed Description

Operator which iterates through each alternative of a set of pairs. If a pair has n and m alternatives, n.m alternatives will be explored. Possible neighbors for the path 1 -> A -> a -> 2 (where (1, 2) are first and last nodes of a path and A has B, C as alternatives and a has b as alternative): 1 -> A -> [b] -> 2 1 -> [B] -> a -> 2 1 -> [B] -> [b] -> 2 1 -> [C] -> a -> 2 1 -> [C] -> [b] -> 2

Definition at line 401 of file routing_neighborhoods.h.

Constructor & Destructor Documentation

◆ SwapIndexPairOperator()

operations_research::SwapIndexPairOperator::SwapIndexPairOperator ( const std::vector< IntVar * > & vars,
const std::vector< IntVar * > & path_vars,
const std::vector< PickupDeliveryPair > & pairs )

Definition at line 753 of file routing_neighborhoods.cc.

◆ ~SwapIndexPairOperator()

operations_research::SwapIndexPairOperator::~SwapIndexPairOperator ( )
inlineoverride

Definition at line 406 of file routing_neighborhoods.h.

Member Function Documentation

◆ DebugString()

std::string operations_research::SwapIndexPairOperator::DebugString ( ) const
inlineoverridevirtual

Reimplemented from operations_research::BaseObject.

Definition at line 410 of file routing_neighborhoods.h.

◆ MakeNextNeighbor()

bool operations_research::SwapIndexPairOperator::MakeNextNeighbor ( Assignment * delta,
Assignment * deltadelta )
overridevirtual

--— Base operator class for operators manipulating IntVars --—

OnStart() should really be protected, but then SWIG doesn't see it. So we make it public, but only subclasses should access to it (to override it). Redefines MakeNextNeighbor to export a simpler interface. The calls to ApplyChanges() and RevertChanges() are factored in this method, hiding both delta and deltadelta from subclasses which only need to override MakeOneNeighbor(). Therefore this method should not be overridden. Override MakeOneNeighbor() instead.

Making current active "pickup" unperformed.

Inserting "pickup" alternative at the same position.

Making current active "delivery" unperformed.

Inserting "delivery" alternative at the same position.

Move to next "pickup/delivery" alternative.

Reimplemented from operations_research::IntVarLocalSearchOperator.

Definition at line 768 of file routing_neighborhoods.cc.

◆ OnStart()

void operations_research::SwapIndexPairOperator::OnStart ( )
overridevirtual

Called by Start() after synchronizing the operator with the current assignment. Should be overridden instead of Start() to avoid calling IntVarLocalSearchOperator::Start explicitly.

Reimplemented from operations_research::IntVarLocalSearchOperator.

Definition at line 824 of file routing_neighborhoods.cc.


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