Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
Public Member Functions | |
DobbleOperator (const IntVar *const *card_symbol_vars, int num_vars, int num_cards, int num_symbols, int num_symbols_per_card) | |
virtual | ~DobbleOperator () |
Protected Member Functions | |
virtual void | OnStart () |
OnStart() simply stores the current symbols per card in symbols_per_card_, and defers further initialization to the subclass's InitNeighborhoodSearch() method. | |
virtual void | InitNeighborhoodSearch ()=0 |
int | VarIndex (int card, int symbol) |
Find the index of the variable corresponding to the given symbol on the given card. | |
void | SwapTwoSymbolsOnCards (int card1, int symbol1, int card2, int symbol2) |
Move symbol1 from card1 to card2, and symbol2 from card2 to card1. | |
Protected Attributes | |
const int | num_cards_ |
const int | num_symbols_ |
const int | num_symbols_per_card_ |
std::vector< std::vector< int > > | symbols_per_card_ |
The "local search", or "local neighborhood search", works like this: starting from a given solution to the problem, other solutions in its neighborhood are generated from it, some of them might be selected (because they're better, for example) to become a starting point for other neighborhood searches, and so on.. The detailed search algorithm can vary and depends on the problem to solve.
The fundamental building block for the local search is the "search operator", which has three fundamental methods in its API:
All local search operators on this problem will derive from the parent class below, which contains some shared code to store a compact representation of which symbols appeal on each cards.
Definition at line 238 of file dobble_ls.cc.
operations_research::DobbleOperator::DobbleOperator | ( | const IntVar *const * | card_symbol_vars, | |
int | num_vars, | |||
int | num_cards, | |||
int | num_symbols, | |||
int | num_symbols_per_card | |||
) | [inline] |
Definition at line 240 of file dobble_ls.cc.
virtual operations_research::DobbleOperator::~DobbleOperator | ( | ) | [inline, virtual] |
Definition at line 259 of file dobble_ls.cc.
virtual void operations_research::DobbleOperator::OnStart | ( | ) | [inline, protected, virtual] |
OnStart() simply stores the current symbols per card in symbols_per_card_, and defers further initialization to the subclass's InitNeighborhoodSearch() method.
Definition at line 265 of file dobble_ls.cc.
virtual void operations_research::DobbleOperator::InitNeighborhoodSearch | ( | ) | [protected, pure virtual] |
Implemented in operations_research::SwapSymbolsOnCardPairs.
int operations_research::DobbleOperator::VarIndex | ( | int | card, | |
int | symbol | |||
) | [inline, protected] |
Find the index of the variable corresponding to the given symbol on the given card.
Definition at line 282 of file dobble_ls.cc.
void operations_research::DobbleOperator::SwapTwoSymbolsOnCards | ( | int | card1, | |
int | symbol1, | |||
int | card2, | |||
int | symbol2 | |||
) | [inline, protected] |
Move symbol1 from card1 to card2, and symbol2 from card2 to card1.
Definition at line 287 of file dobble_ls.cc.
const int operations_research::DobbleOperator::num_cards_ [protected] |
Definition at line 294 of file dobble_ls.cc.
const int operations_research::DobbleOperator::num_symbols_ [protected] |
Definition at line 295 of file dobble_ls.cc.
const int operations_research::DobbleOperator::num_symbols_per_card_ [protected] |
Definition at line 296 of file dobble_ls.cc.
std::vector<std::vector<int> > operations_research::DobbleOperator::symbols_per_card_ [protected] |
Definition at line 297 of file dobble_ls.cc.