Ejemplo n.º 1
0
 /// 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);
 }
Ejemplo n.º 2
0
	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;
	}
Ejemplo n.º 3
0
 /// 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);
 }
Ejemplo n.º 4
0
 /// 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]);
 }
Ejemplo n.º 5
0
 /// 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);
 }
Ejemplo n.º 6
0
 /// 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]);
 }
Ejemplo n.º 7
0
 /// 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);
 }
Ejemplo n.º 8
0
 /// 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);
 }
Ejemplo n.º 9
0
 /// 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);
 }
Ejemplo n.º 10
0
 /// 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);
 }
Ejemplo n.º 11
0
       /// 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);
       }
Ejemplo n.º 12
0
 /// 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);
 }
Ejemplo n.º 13
0
 /// 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);
 }
Ejemplo n.º 14
0
 /// 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);
 }
Ejemplo n.º 15
0
 /// 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);
 }
Ejemplo n.º 16
0
 /// 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);
 }
Ejemplo n.º 17
0
 /// 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);
 }
Ejemplo n.º 18
0
	void print() const {
		for (int i = 0; i < spec_vars.size(); i++)
			cout << spec_vars[i].val() << ' ';
	}
Ejemplo n.º 19
0
 /// 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);
 }
Ejemplo n.º 20
0
 /// Constructor for cloning \a s
 TestSpace(bool share, TestSpace& s) : Space(share,s) {
   x.update(*this,share,s.x);
 }
Ejemplo n.º 21
0
 /// 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);
 }
Ejemplo n.º 22
0
 /// 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);
 }
Ejemplo n.º 23
0
	SteadySpace(bool share, SteadySpace & o)
		: Space(share, o) {
		spec_vars.update(*this, share, o.spec_vars);
	}
Ejemplo n.º 24
0
 /// Constructor for cloning \a s
 Ass(bool share, Ass& s) : Gecode::Space(share,s) {
   x.update(*this, share, s.x);
 }