58 : x(*this,opt.
size(),1,2*opt.
size()),
60 const int n = opt.
size();
69 for (
int i = n;
i--; ) {
70 xy[
i] = x[
i]; xy[n+
i] = y[
i];
75 for (
int i = n;
i--; ) {
76 c[
i] = 1; c[n+
i] = -1;
83 for (
int i = n;
i--; ) {
85 sy[
i] = sxy[n+
i] =
expr(*
this,
sqr(y[i]));
114 for (
int i = 0;
i < x.
size();
i++) {
116 b += x[
i].val()*x[
i].val();
119 os <<
" = " << a <<
", " << b << std::endl <<
"\t";
121 for (
int i = 0;
i < y.
size();
i++) {
123 b += y[
i].val()*y[
i].val();
126 os <<
" = " << a <<
", " << b << std::endl;
139 opt.
parse(argc,argv);
140 Script::run<Partition,DFS,SizeOptions>(
opt);
void size(unsigned int s)
Set default size.
IntVarArray x
First group of numbers.
Options for scripts with additional size parameter
Example: partition numbers into two groups
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
Partition(bool share, Partition &s)
Constructor used during cloning s.
virtual void print(std::ostream &os) const
Print solution.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Partition(const SizeOptions &opt)
Actual model.
Parametric base-class for scripts.
void decay(double d)
Set default decay factor.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
IntValBranch INT_VAL_MIN(void)
Select smallest value.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Passing integer variables.
Passing integer arguments.
IntVarArray y
Second group of numbers.
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
int main(int argc, char *argv[])
Main-functiona.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
IntVarBranch INT_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl)
Select variable with largest accumulated failure count divided by domain size with decay factor d...
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
Bounds propagation or consistency.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
virtual Space * copy(bool share)
Copying during cloning.
BrancherHandle branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
int size(void) const
Return size of array (number of elements)
void icl(IntConLevel i)
Set default integer consistency level.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.