/// Post constraint on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { using namespace Gecode; BoolVarArgs y(x.size()); for (int i=x.size(); i--; ) y[i] = channel(home, x[i]); nvalues(home, y, irt, m); }
vector<int> getSolution() const { vector<int> result(spec_vars.size(), 0u); for (int i = 0; i < spec_vars.size(); i++) result[i] = spec_vars[i].val(); return result; }
/// Post constraint on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { Gecode::BoolVarArgs c(x.size()); for (int i=0; i<x.size(); i++) { c[i]=Gecode::channel(home,x[i]); } Gecode::sequence(home,c,s,q,l,u); }
/// Post constraint on \a xy virtual void post(Gecode::Space& home, Gecode::IntVarArray& xy) { int n = xy.size() - 1; Gecode::IntVarArgs x(n); for (int i=n; i--; ) x[i] = xy[i]; Gecode::nvalues(home, x, irt, xy[n]); }
/// Post constraint on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { using namespace Gecode; int n=x.size()-1; Gecode::BoolVarArgs b(n); for (int i=n; i--; ) b[i]=channel(home,x[i]); channel(home, b, x[n], o); }
/// Post constraint on \a xy virtual void post(Gecode::Space& home, Gecode::IntVarArray& xy) { using namespace Gecode; int n = xy.size() - 1; BoolVarArgs x(n); for (int i=n; i--; ) x[i] = channel(home, xy[i]); nvalues(home, x, irt, xy[n]); }
/// Post wait on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { Gecode::BoolVarArgs b(x.size()); for (int i=b.size(); i--; ) b[i]=Gecode::channel(home,x[i]); if (b.size() > 1) Gecode::wait(home, b, &c); else Gecode::wait(home, b[0], &c); }
/// Post constraint on \a xy virtual void post(Gecode::Space& home, Gecode::IntVarArray& xy) { using namespace Gecode; int n = xy.size() / 2; IntVarArgs x(n), y(n); for (int i=0; i<n; i++) { x[i]=xy[2*i+0]; y[i]=xy[2*i+1]; } nooverlap(home, x, w, y, h); }
/// Post constraint on \a xwyho virtual void post(Gecode::Space& home, Gecode::IntVarArray& xyo) { using namespace Gecode; int n = xyo.size() / 3; IntVarArgs x(n), y(n); BoolVarArgs o(n); for (int i=0; i<n; i++) { x[i]=xyo[3*i+0]; y[i]=xyo[3*i+1]; o[i]=expr(home, xyo[3*i+2] > 0); } nooverlap(home, x, w, y, h, o); }
/// Post constraint on \a xwyh virtual void post(Gecode::Space& home, Gecode::IntVarArray& xwyh) { using namespace Gecode; int n = xwyh.size() / 4; IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); for (int i=0; i<n; i++) { x0[i]=xwyh[4*i+0]; w[i]=xwyh[4*i+1]; x1[i]=expr(home, x0[i] + w[i]); y0[i]=xwyh[4*i+2]; h[i]=xwyh[4*i+3]; y1[i]=expr(home, y0[i] + h[i]); } nooverlap(home, x0, w, x1, y0, h, y1); }
/// Post constraint on \a xy virtual void post(Gecode::Space& home, Gecode::IntVarArray& xy) { using namespace Gecode; // Number of cardinality variables int m = xy.size()-n; IntVarArgs x(n), y(m); for (int i=0; i<n; i++) x[i]=xy[i]; for (int i=0; i<m; i++) y[i]=xy[n+i]; count(home, x, y, ipl); }
/// Post constraint on \a xwyho virtual void post(Gecode::Space& home, Gecode::IntVarArray& xwyho) { using namespace Gecode; int n = (xwyho.size() - 2) / 2; IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); BoolVarArgs o(n); for (int i=0; i<n; i++) { x0[i]=xwyho[2*i+0]; w[i]=xwyho[2*i+1]; x1[i]=expr(home, x0[i] + w[i]); y0[i]=xwyho[2*i+0]; h[i]=xwyho[2*i+1]; y1[i]=expr(home, y0[i] + h[i]); o[i]=expr(home, xwyho[2*n + (i % 2)] > 0); } nooverlap(home, x0, w, x1, y0, h, y1, o); }
/// Post constraint on \a xy virtual void post(Gecode::Space& home, Gecode::IntVarArray& xy) { using namespace Gecode; // Number of cardinality variables int m = xy.size()-n; IntVarArgs x(n), y(m); for (int i=0; i<n; i++) x[i]=xy[i]; for (int i=0; i<m; i++) y[i]=xy[n+i]; IntArgs values(m); for (int i=m; i--;) values[i] = i+dom.min(); count(home,x,y,values,icl); }
/// Post constraint on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { Gecode::IntVarArgs y(8); for (int i=x.size(); i--; ) y[i]=y[4+i]=x[i]; Gecode::count(home, y, 0, irt, 4); }
/// Post reified constraint on \a x for \a b virtual void post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::BoolVar b) { assert(x.size() == 1); Gecode::dom(home, x[0], -2, 2, b); }
/// Constructor for cloning \a s IntTestSpace(bool share, IntTestSpace& s) : Gecode::Space(share,s), vara(s.vara), varb(s.varb), val(s.val) { x.update(*this, share, s.x); }
/// Post wait on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { if (x.size() > 1) Gecode::wait(home, x, &c); else Gecode::wait(home, x[0], &c); }
void print() const { for (int i = 0; i < spec_vars.size(); i++) cout << spec_vars[i].val() << ' '; }
/// Post reified constraint on \a x for \a r virtual void post(Gecode::Space& home, Gecode::IntVarArray& x, Gecode::Reify r) { assert(x.size() == 1); Gecode::dom(home, x[0], -2, 2, r); }
/// Constructor for cloning \a s TestSpace(bool share, TestSpace& s) : Space(share,s) { x.update(*this,share,s.x); }
/// Post constraint on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { Gecode::IntArgs c(x.size()); for (int i=0; i<x.size(); i++) c[i]=i; Gecode::distinct(home, c, x, icl); }
/// Post constraint on \a x virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { if (x.size() == 1) Gecode::dom(home, x[0], -2, 2); else Gecode::dom(home, x, -2, 2); }
SteadySpace(bool share, SteadySpace & o) : Space(share, o) { spec_vars.update(*this, share, o.spec_vars); }
/// Constructor for cloning \a s Ass(bool share, Ass& s) : Gecode::Space(share,s) { x.update(*this, share, s.x); }