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--; ) {
100 x.update(*
this, share, s.
x);
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;
140 Script::run<Partition,DFS,SizeOptions>(
opt);
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 .
int size(void) const
Return size of array (number of elements)
virtual void print(std::ostream &os) const
Print solution.
Partition(bool share, Partition &s)
Constructor used during cloning s.
struct Gecode::@511::NNF::@54::@55 b
For binary nodes (and, or, eqv)
Partition(const SizeOptions &opt)
Actual model.
Parametric base-class for scripts.
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.
struct Gecode::@511::NNF::@54::@56 a
For atomic nodes.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
IntVarArray y
Second group of numbers.
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
Node * x
Pointer to corresponding Boolean expression node.
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.
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.
void icl(IntConLevel i)
Set default integer consistency level.