Go to the documentation of this file.
58 const static int n = 18;
72 for (
int i=0;
i<
n/2;
i++) {
73 q1[
i] = q[
i]; q2[
i] = q[
n/2 +
i];
95 if (q[
i].val() != s.
q[
i].val())
104 static std::string
name(
void) {
122 #ifdef GECODE_HAS_SET_VARS
127 static const int size = 16;
129 static const int distance = 4;
131 static const int bits = 8;
139 for (
int i=
x.size();
i--;)
142 for (
int i=0;
i<
x.size();
i++)
143 for (
int j=
i+1; j<
x.size(); j++)
167 x.update(*
this, s.x);
175 for (
int i=0;
i<
x.size();
i++) {
187 static std::string
name(
void) {
205 template<
class Model,
class ValBranch>
218 static std::string
str(
unsigned int i) {
225 :
Base(
"NoGoods::"+Model::name()+
"::"+Model::val(vb0)+
"::"+str(t0)+
226 "::"+(a0 ?
"+" :
"-")+
"::"+(n0 ?
"+" :
"-")),
227 vb(vb0),
t(t0),
a(a0),
n(n0) {}
230 Model* m =
new Model(vb,
a,
n);
232 Model* s_plain =
dfs(m);
242 Model* s =
static_cast<Model*
>(e->
next());
253 Model* s_nogoods =
dfs(m);
255 bool ok = ((s_nogoods != NULL) &&
256 ((
t != 1) || s_plain->same(*s_nogoods)));
276 for (
unsigned int t = 1;
t<=4;
t++) {
283 #ifdef GECODE_HAS_SET_VARS
Hamming(Hamming &s)
Constructor for copying s.
Queens(IntValBranch ivb, bool assign, bool null)
The actual problem.
Return selection strategy Select select(void) const
Create(void)
Perform creation and registration.
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
IntVarArray q
Position of queens on boards.
virtual Space * next(void)=0
Return next solution (NULL, if none exists or search has been stopped)
@ SEL_SPLIT_MIN
Select values not greater than mean of smallest and largest value.
Which values to select for branching first.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
virtual NoGoods & nogoods(void)
Return no-goods (the no-goods are empty)
Queens(Queens &s)
Constructor for cloning s.
Passing integer variables.
void dummy(Space &)
A dummy function for branching.
virtual Space * copy(void)
Perform copying during cloning.
unsigned int size(I &i)
Size of all ranges of range iterator i.
virtual bool run(void)
Run test.
bool n
Whether to also create branchers without no-good literals.
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
SetValBranch SET_VAL_MIN_EXC(void)
@ IPL_VAL
Value propagation.
bool same(const Hamming &s) const
Check whether two solutions are the same.
NoGoods(ValBranch vb0, unsigned int t0, bool a0, bool n0)
Initialize test.
Which values to select for branching first.
virtual void post(Space &home) const
Post no-goods.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
SetVarBranch SET_VAR_NONE(void)
static unsigned int nodeinc(void)
Return increment for node stop.
int size(void) const
Return size of array (number of elements)
@ SEL_MAX_INC
Include largest element.
Engine * dfsengine(Space *s, const Options &o)
Create depth-first engine.
int dfs(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for root.
Hamming(SetValBranch svb, bool assign, bool null)
Actual model.
Gecode toplevel namespace
SetValBranch SET_VAL_MAX_INC(void)
unsigned long int limit(void) const
Return current limit.
Base class for all tests to be run
No-goods recorded from restarts.
Example for testing integer no-goods.
Node * x
Pointer to corresponding Boolean expression node.
@ SEL_MAX_EXC
Exclude largest element.
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
bool same(const Queens &s) const
Check whether two solutions are the same.
Stop * stop
Stop object for stopping search.
unsigned int t
Number of threads to use.
@ SEL_SPLIT_MAX
Select values greater than mean of smallest and largest value.
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
unsigned int nogoods_limit
Depth limit for extraction of no-goods.
@ SEL_MAX
Select largest value.
IntValBranch INT_VALUES_MAX(void)
Try all values starting from largest.
Select select(void) const
Return selection strategy.
Search engine implementation interface
static std::string val(SetValBranch svb)
Return name for branching.
SetValBranch SET_VAL_MIN_INC(void)
Stop-object based on number of nodes
Value branching information.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
void assign(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatAssign vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with variable selection vars and value selection vals.
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
@ SEL_VALUES_MIN
Select all values starting from smallest.
@ SEL_MIN_INC
Include smallest element.
#define GECODE_NEVER
Assert that this command is never executed.
static std::string val(IntValBranch ivb)
Return name for branching.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
virtual bool stopped(void) const =0
Check whether engine has been stopped.
static std::string name(void)
Return name.
virtual Space * copy(void)
Copy during cloning.
static std::string name(void)
Return name.
static unsigned int nodeinc(void)
Return increment for node stop.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
static std::string str(unsigned int i)
Map unsigned integer to string.
ValBranch vb
How to branch.
SetValBranch SET_VAL_MAX_EXC(void)
Example for testing set no-goods.
Iterator for the greatest lower bound ranges of a set variable.
bool a
Whether to also assign some variables.
@ SEL_VALUES_MAX
Select all values starting from largest.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
unsigned long int n
Number of no-goods.
Example: Generating Hamming codes
int n
Number of negative literals for node type.
Gecode::IntArgs i({1, 2, 3, 4})
@ SEL_MIN_EXC
Exclude smallest element.
@ SEL_MIN
Select smallest value.
Help class to create and register tests.
IntValBranch INT_VAL_MAX(void)
Select largest value.
double threads
Number of threads to use.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
IntValBranch INT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.