70 : n(opt.
size()), noOfTriples((n*(n-1))/6),
71 triples(*this, noOfTriples,
IntSet::empty, 1, n, 3, 3) {
73 for (
int i=0;
i<noOfTriples;
i++) {
74 for (
int j=
i+1; j<noOfTriples; j++) {
79 rel(*
this, (x & y) == atmostOne);
88 if (opt.
model() == MODEL_NONE) {
99 }
else if (opt.
model() == MODEL_MATCHING) {
106 }
else if (opt.
model() == MODEL_SEQ) {
126 linear(*
this,
IntArgs(6,(n+1)*(n+1),n+1,1,-(n+1)*(n+1),-(n+1),-1),
136 for (
int i=0;
i<noOfTriples;
i++) {
137 os <<
"\t[" <<
i <<
"] = " << triples[
i] << std::endl;
147 return new Steiner(share,*
this);
163 opt.
parse(argc,argv);
164 Script::run<Steiner,DFS,SizeOptions>(
opt);
Steiner(const SizeOptions &opt)
Actual model.
void size(unsigned int s)
Set default size.
SetExpr singleton(const LinIntExpr &e)
Singleton expression.
Options for scripts with additional size parameter
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
Post propagator for and .
Use sequence constraints.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
Use simple relation constraint.
SetVarBranch SET_VAR_NONE(void)
Select first unassigned variable.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
SetValBranch SET_VAL_MIN_INC(void)
Include smallest element.
int n
Order of the Steiner problem.
int main(int argc, char *argv[])
Main-function.
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
Post propagator for and .
Parametric base-class for scripts.
void iterations(unsigned int i)
Set default number of iterations.
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntConLevel)
Post propagator for .
Use matching constraints.
Gecode::IntArgs i(4, 1, 2, 3, 4)
SetVarArray triples
The steiner triples.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Steiner(bool share, Steiner &s)
Constructor for copying s.
virtual void print(std::ostream &os) const
Print solution.
Passing integer variables.
Passing integer arguments.
static const IntSet empty
Empty set.
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
Node * x
Pointer to corresponding Boolean expression node.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
int noOfTriples
Number of Steiner triples.
void model(int v)
Set default model value.
Gecode toplevel namespace
virtual Space * copy(bool share)
Copy 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.