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