66 :
Script(opt), n(opt.
size()), noOfTriples((n*(n-1))/6),
67 triples(*this, noOfTriples,
IntSet::empty, 1, n, 3U, 3U) {
69 for (
int i=0;
i<noOfTriples;
i++) {
70 for (
int j=
i+1; j<noOfTriples; j++) {
75 rel(*
this, (x & y) == atmostOne);
84 if (opt.
model() == MODEL_NONE) {
95 }
else if (opt.
model() == MODEL_MATCHING) {
102 }
else if (opt.
model() == MODEL_SEQ) {
123 {(n+1)*(n+1), n+1, 1, -(n+1)*(n+1), -(n+1), -1},
124 {x1, x2, x3, y1, y2, y3},
134 for (
int i=0;
i<noOfTriples;
i++) {
135 os <<
"\t[" <<
i <<
"] = " << triples[
i] << std::endl;
161 opt.
parse(argc,argv);
162 Script::run<Steiner,DFS,SizeOptions>(
opt);
Steiner(const SizeOptions &opt)
Actual model.
void size(unsigned int s)
Set default size.
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
SetExpr singleton(const LinIntExpr &e)
Singleton expression.
Options for scripts with additional size parameter
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntPropLevel)
Post propagator for .
void 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 update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
int n
Order of the Steiner problem.
int main(int argc, char *argv[])
Main-function.
Use simple relation constraint.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
virtual void print(std::ostream &os) const
Print solution.
Steiner(Steiner &s)
Constructor for copying s.
SetVarBranch SET_VAR_NONE(void)
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
Use matching constraints.
SetVarArray triples
The steiner triples.
Gecode::IntArgs i({1, 2, 3, 4})
Use sequence constraints.
unsigned int size(I &i)
Size of all ranges of range iterator i.
SetValBranch SET_VAL_MIN_INC(void)
static const IntSet empty
Empty set.
BoolVar expr(Home home, const BoolExpr &e, IntPropLevel ipl)
Post Boolean expression and return its value.
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
Post propagator for SetVar SetOpType SetVar y
virtual Space * copy(void)
Copy during cloning.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
int noOfTriples
Number of Steiner triples.
Post propagator for SetVar x
void model(int v)
Set default model value.
Gecode toplevel namespace