55 x(*this,opt.size(),1,2*opt.size()),
56 y(*this,opt.size(),1,2*opt.size()) {
57 const int n = opt.size();
66 for (
int i = n; i--; ) {
67 xy[i] =
x[i]; xy[n+i] =
y[i];
72 for (
int i = n; i--; ) {
73 c[i] = 1; c[n+i] = -1;
80 for (
int i = n; i--; ) {
81 sx[i] = sxy[i] =
expr(*
this,
sqr(
x[i]));
82 sy[i] = sxy[n+i] =
expr(*
this,
sqr(
y[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;
136 opt.
parse(argc,argv);
static void run(const Options &opt, Script *s=NULL)
Passing integer arguments.
Passing integer variables.
Options for scripts with additional size parameter
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.
Driver::ScriptBase< Driver::IgnoreStepOption< Space > > Script
Base-class for scripts.
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 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.
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.