Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
Public Member Functions | |
SymbolsSharedByTwoCardsConstraint (Solver *const solver, const std::vector< IntVar * > &card1_symbol_vars, const std::vector< IntVar * > &card2_symbol_vars, IntVar *const num_symbols_in_common_var) | |
This constructor does not take any ownership on its arguments. | |
virtual | ~SymbolsSharedByTwoCardsConstraint () |
virtual void | Post () |
Adds observers (named Demon) to variable events. | |
virtual void | InitialPropagate () |
This is the main propagation method. |
This constraint maintains: sum_i(card1_symbol_vars[i]*card2_symbol_vars[i]) == count_var. with all card_symbol_vars[i] being boolean variables.
Definition at line 63 of file dobble_ls.cc.
operations_research::SymbolsSharedByTwoCardsConstraint::SymbolsSharedByTwoCardsConstraint | ( | Solver *const | solver, | |
const std::vector< IntVar * > & | card1_symbol_vars, | |||
const std::vector< IntVar * > & | card2_symbol_vars, | |||
IntVar *const | num_symbols_in_common_var | |||
) | [inline] |
This constructor does not take any ownership on its arguments.
Definition at line 66 of file dobble_ls.cc.
virtual operations_research::SymbolsSharedByTwoCardsConstraint::~SymbolsSharedByTwoCardsConstraint | ( | ) | [inline, virtual] |
Definition at line 87 of file dobble_ls.cc.
virtual void operations_research::SymbolsSharedByTwoCardsConstraint::Post | ( | ) | [inline, virtual] |
Adds observers (named Demon) to variable events.
These demons are responsible for implementing the propagation algorithm of the constraint.
Definition at line 92 of file dobble_ls.cc.
virtual void operations_research::SymbolsSharedByTwoCardsConstraint::InitialPropagate | ( | ) | [inline, virtual] |
This is the main propagation method.
It scans all card1_symbol_vars * card2_symbol_vars and increments 3 counters:
Then we know that num_symbols_in_common_var is in the range [min_symbols_in_common .. max_symbols_in_common].
Now, if num_symbols_in_common_var->Max() == min_symbols_in_common, then all products that contribute to max_symbols_in_common but not to min_symbols_in_common should be set to 0.
Conversely, if num_symbols_in_common_var->Min() == max_symbols_in_common, then all products that contribute to max_symbols_in_common should be set to 1.
Definition at line 128 of file dobble_ls.cc.