Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
// doxy/ or-tools/ src/ constraint_solver/ |
#include <constraint_solveri.h>
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. |
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.
operations_research::BaseLNS::BaseLNS | ( | const IntVar *const * | vars, | |
int | size | |||
) |
operations_research::BaseLNS::~BaseLNS | ( | ) | [virtual] |
Definition at line 386 of file local_search.cc.
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.