38 using namespace Gecode;
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++) {
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;
162 Script::run<Steiner,DFS,SizeOptions>(
opt);
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Parametric base-class for scripts.
static const IntSet empty
Empty set.
void iterations(unsigned int i)
Set default number of iterations.
void model(int v)
Set default model value.
Options for scripts with additional size parameter
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
int main(int argc, char *argv[])
Main-function.
virtual void print(std::ostream &os) const
Print solution.
Steiner(const SizeOptions &opt)
Actual model.
Steiner(Steiner &s)
Constructor for copying s.
int n
Order of the Steiner problem.
SetVarArray triples
The steiner triples.
@ MODEL_MATCHING
Use matching constraints.
@ MODEL_SEQ
Use sequence constraints.
@ MODEL_NONE
Use simple relation constraint.
int noOfTriples
Number of Steiner triples.
virtual Space * copy(void)
Copy during cloning.
void sequence(Home home, const IntVarArgs &x, const IntSet &s, int q, int l, int u, IntPropLevel)
Post propagator for .
void channelSorted(Home home, const IntVarArgs &x, SetVar y)
void atmostOne(Home home, const SetVarArgs &xa, unsigned int c)
Post propagator for SetVar SetOpType SetVar y
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntArgs i({1, 2, 3, 4})
SetExpr singleton(const LinIntExpr &e)
Singleton expression.
SetValBranch SET_VAL_MIN_INC(void)
SetVarBranch SET_VAR_NONE(void)