42 using namespace Gecode;
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) {
136 for (
int i=0;
i<noOfTriples;
i++) {
137 os <<
"\t[" <<
i <<
"] = " << triples[
i] << std::endl;
142 triples.update(*
this, share, s.
triples);
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 .
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
Use sequence constraints.
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 sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntConLevel)
Post propagator for .
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
SetVarArray triples
The steiner triples.
Use simple relation constraint.
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.
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.
Use matching constraints.