57 const int n =
opt.size();
66 for (
int i =
n;
i--; ) {
72 for (
int i =
n;
i--; ) {
73 c[
i] = 1;
c[
n+
i] = -1;
80 for (
int i =
n;
i--; ) {
111 for (
int i = 0;
i <
x.
size();
i++) {
113 b +=
x[
i].val()*
x[
i].val();
116 os <<
" = " <<
a <<
", " <<
b << std::endl <<
"\t";
118 for (
int i = 0;
i <
y.
size();
i++) {
120 b +=
y[
i].val()*
y[
i].val();
123 os <<
" = " <<
a <<
", " <<
b << std::endl;
137 Script::run<Partition,DFS,SizeOptions>(
opt);
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.
Parametric base-class for scripts.
Passing integer arguments.
Passing integer variables.
Options for scripts with additional size parameter
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.
Example: partition numbers into two groups
int main(int argc, char *argv[])
Main-functiona.
virtual void print(std::ostream &os) const
Print solution.
Partition(Partition &s)
Constructor used during cloning s.
IntVarArray y
Second group of numbers.
Partition(const SizeOptions &opt)
Actual model.
virtual Space * copy(void)
Copying during cloning.
IntVarArray x
First group of numbers.
void parse(int argc, char *argv[])
Parse commandline arguments.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
@ IPL_BND
Bounds propagation.
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode toplevel namespace
IntVarBranch INT_VAR_AFC_SIZE_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count divided by domain size with decay factor d.
void sqr(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
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 .
IntValBranch INT_VAL_MIN(void)
Select smallest value.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i({1, 2, 3, 4})