Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ constraint_solver/

operations_research::MakePairActiveOperator Class Reference

Pair-based neighborhood operators, designed to move nodes by pairs (pairs are static and given). More...

Inheritance diagram for operations_research::MakePairActiveOperator:

operations_research::PathOperator operations_research::IntVarLocalSearchOperator operations_research::LocalSearchOperator operations_research::BaseObject

List of all members.

Public Member Functions

 MakePairActiveOperator (const IntVar *const *vars, const IntVar *const *secondary_vars, const RoutingModel::NodePairs &pairs, int size)
virtual ~MakePairActiveOperator ()
virtual bool MakeNextNeighbor (Assignment *delta, Assignment *deltadelta)
 Redefines MakeNextNeighbor to export a simpler interface.
virtual bool MakeNeighbor ()

Protected Member Functions

virtual bool OnSamePathAsPreviousBase (int64 base_index)
 Returns true if a base node has to be on the same path as the "previous" base node (base node of index base_index - 1).
virtual int64 GetBaseNodeRestartPosition (int base_index)
 Returns the index of the node to which the base node of index base_index must be set to when it reaches the end of a path.


Detailed Description

Pair-based neighborhood operators, designed to move nodes by pairs (pairs are static and given).

These neighborhoods are very useful for Pickup and Delivery problems where pickup and delivery nodes must remain on the same route.

Todo:
TODO(user): Add option to prune neighbords where the order of node pairs is violated (ie precedence between pickup and delivery nodes).
Todo:
TODO(user): Move this to local_search.cc if it's generic enough.
Todo:
TODO(user): Detect pairs automatically by parsing the constraint model; we could then get rid of the pair API in the RoutingModel class.
Operator which inserts pairs of inactive nodes into a path. Possible neighbors for the path 1 -> 2 -> 3 with pair (A, B) inactive (where 1 and 3 are first and last nodes of the path) are: 1 -> [A] -> [B] -> 2 -> 3 1 -> [B] -> 2 -> [A] -> 3 1 -> [A] -> 2 -> [B] -> 3 1 -> 2 -> [A] -> [B] -> 3 Note that this operator does not expicitely insert the nodes of a pair one after the other which forbids the following solutions: 1 -> [B] -> [A] -> 2 -> 3 1 -> 2 -> [B] -> [A] -> 3 which can only be obtained by inserting A after B.

Definition at line 145 of file routing.cc.


Constructor & Destructor Documentation

operations_research::MakePairActiveOperator::MakePairActiveOperator ( const IntVar *const *  vars,
const IntVar *const *  secondary_vars,
const RoutingModel::NodePairs pairs,
int  size 
) [inline]

Definition at line 147 of file routing.cc.

virtual operations_research::MakePairActiveOperator::~MakePairActiveOperator (  )  [inline, virtual]

Definition at line 154 of file routing.cc.


Member Function Documentation

bool operations_research::MakePairActiveOperator::MakeNextNeighbor ( Assignment delta,
Assignment deltadelta 
) [virtual]

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.

Reimplemented from operations_research::IntVarLocalSearchOperator.

Definition at line 191 of file routing.cc.

bool operations_research::MakePairActiveOperator::MakeNeighbor (  )  [virtual]

Implements operations_research::PathOperator.

Definition at line 206 of file routing.cc.

virtual bool operations_research::MakePairActiveOperator::OnSamePathAsPreviousBase ( int64  base_index  )  [inline, protected, virtual]

Returns true if a base node has to be on the same path as the "previous" base node (base node of index base_index - 1).

Useful to limit neighborhood exploration to nodes on the same path.

Todo:
TODO(user): ideally this should be OnSamePath(int64 node1, int64 node2); it's currently way more complicated to implement.

Reimplemented from operations_research::PathOperator.

Definition at line 159 of file routing.cc.

virtual int64 operations_research::MakePairActiveOperator::GetBaseNodeRestartPosition ( int  base_index  )  [inline, protected, virtual]

Returns the index of the node to which the base node of index base_index must be set to when it reaches the end of a path.

By default, it is set to the start of the current path. When this method is called, one can only assume that base nodes with indices < base_index have their final position.

Reimplemented from operations_research::PathOperator.

Definition at line 164 of file routing.cc.


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