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

operations_research::BaseLNS Class Reference

Base Large Neighborhood Search operator class. More...

#include <constraint_solveri.h>

Inheritance diagram for operations_research::BaseLNS:

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

List of all members.

Public Member Functions

 BaseLNS (const IntVar *const *vars, int size)
 Base Large Neighborhood Search operator.
virtual ~BaseLNS ()
virtual void InitFragments ()
virtual bool NextFragment (std::vector< int > *fragment)=0

Protected Member Functions

virtual bool MakeOneNeighbor ()
 This method should not be overridden. Override NextFragment() instead.


Detailed Description

Base Large Neighborhood Search operator class.

This is the base class for building an LNS operator. An LNS fragment is a collection of variables which will be relaxed. Fragments are built with NextFragment(), which returns false if there are no more fragments to build. Optionally one can override InitFragments, which is called from LocalSearchOperator::Start to initialize fragment data.

Here's a sample relaxing one variable at a time:

class OneVarLNS : public BaseLNS { public: OneVarLNS(const IntVar* const* vars, int size) : BaseLNS(vars, size), index_(0) {} virtual ~OneVarLNS() {} virtual void InitFragments() { index_ = 0; } virtual bool NextFragment(std::vector<int>* fragment) { const int size = Size(); if (index_ < size) { fragment->push_back(index_); ++index_; return true; } else { return false; } }

private: int index_; };

Definition at line 960 of file constraint_solveri.h.


Constructor & Destructor Documentation

operations_research::BaseLNS::BaseLNS ( const IntVar *const *  vars,
int  size 
)

Base Large Neighborhood Search operator.

Definition at line 383 of file local_search.cc.

operations_research::BaseLNS::~BaseLNS (  )  [virtual]

Definition at line 386 of file local_search.cc.


Member Function Documentation

void operations_research::BaseLNS::InitFragments (  )  [virtual]

Definition at line 405 of file local_search.cc.

virtual bool operations_research::BaseLNS::NextFragment ( std::vector< int > *  fragment  )  [pure virtual]

bool operations_research::BaseLNS::MakeOneNeighbor (  )  [protected, virtual]

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

Reimplemented from operations_research::IntVarLocalSearchOperator.

Definition at line 388 of file local_search.cc.


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