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;
137 x(*this,size,
IntSet::empty,1,bits) {
139 for (
int i=x.
size();
i--;)
140 cx[
i] =
expr(*
this, -x[
i]);
142 for (
int i=0; i<x.
size(); i++)
143 for (
int j=i+1; j<x.
size(); j++)
153 for (
int i=0; i<size/2; i++) {
154 x1[
i] = x[
i]; x2[
i] = x[size/2 +
i];
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 Which values to select for branching first.
virtual Space * copy(void)
Perform copying during cloning.
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
unsigned long int limit(void) const
Return current limit.
Search engine implementation interface
unsigned int nogoods_limit
Depth limit for extraction of no-goods.
unsigned int t
Number of threads to use.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Help class to create and register tests.
bool same(const Hamming &s) const
Check whether two solutions are the same.
bool a
Whether to also assign some variables.
Return selection strategy Select select(void) const
static std::string val(SetValBranch svb)
Return name for branching.
Stop-object based on number of nodes
int size(void) const
Return size of array (number of elements)
NoGoods(ValBranch vb0, unsigned int t0, bool a0, bool n0)
Initialize test.
static std::string str(unsigned int i)
Map unsigned integer to string.
ValBranch vb
How to branch.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
Engine * dfsengine(Space *s, const Options &o)
Create depth-first engine.
Which values to select for branching first.
Hamming(Hamming &s)
Constructor for copying s.
virtual void post(Space &home) const
Post no-goods.
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
Example for testing set no-goods.
virtual bool run(void)
Run test.
SetVarBranch SET_VAR_NONE(void)
Example for testing integer no-goods.
static std::string val(IntValBranch ivb)
Return name for branching.
Hamming(SetValBranch svb, bool assign, bool null)
Actual model.
IntAssign INT_ASSIGN_MIN(void)
Select smallest value.
static std::string name(void)
Return name.
Create(void)
Perform creation and registration.
double threads
Number of threads to use.
Exclude smallest element.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Select all values starting from largest.
int dfs(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for root.
Select select(void) const
Return selection strategy.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
unsigned int size(I &i)
Size of all ranges of range iterator i.
IntValBranch INT_VAL_SPLIT_MAX(void)
Select values greater than mean of smallest and largest value.
Base class for all tests to be run
Iterator for the greatest lower bound ranges of a set variable.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
Queens(IntValBranch ivb, bool assign, bool null)
The actual problem.
IntVarArray q
Position of queens on boards.
Passing integer variables.
SetValBranch SET_VAL_MIN_EXC(void)
Select values greater than mean of smallest and largest value.
SetValBranch SET_VAL_MIN_INC(void)
Queens(Queens &s)
Constructor for cloning s.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
SetValBranch SET_VAL_MAX_EXC(void)
IntValBranch INT_VAL_MAX(void)
Select largest value.
SetValBranch SET_VAL_MAX_INC(void)
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Value branching information.
IntValBranch INT_VALUES_MIN(void)
Try all values starting from smallest.
Select values not greater than mean of smallest and largest value.
Node * x
Pointer to corresponding Boolean expression node.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
No-goods recorded from restarts.
virtual NoGoods & nogoods(void)
Return no-goods (the no-goods are empty)
IntValBranch INT_VALUES_MAX(void)
Try all values starting from largest.
virtual Space * next(void)=0
Return next solution (NULL, if none exists or search has been stopped)
virtual Space * copy(void)
Copy during cloning.
Include smallest element.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
static unsigned int nodeinc(void)
Return increment for node stop.
static unsigned int nodeinc(void)
Return increment for node stop.
Stop * stop
Stop object for stopping search.
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
Gecode toplevel namespace
void assign(Home home, const FloatVarArgs &x, FloatAssign fa, FloatBranchFilter bf, FloatVarValPrint vvp)
Assign all x with value selection vals.
bool same(const Queens &s) const
Check whether two solutions are the same.
#define GECODE_NEVER
Assert that this command is never executed.
bool n
Whether to also create branchers without no-good literals.
static std::string name(void)
Return name.
Select all values starting from smallest.
void dummy(Space &)
A dummy function for branching.
virtual bool stopped(void) const =0
Check whether engine has been stopped.