示例#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);
 }
示例#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;
	}
示例#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);
 }
示例#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]);
 }
示例#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);
 }
示例#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]);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#11
0
文件: gcc.cpp 项目: Gecode/gecode
       /// 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);
       }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#18
0
	void print() const {
		for (int i = 0; i < spec_vars.size(); i++)
			cout << spec_vars[i].val() << ' ';
	}
示例#19
0
文件: dom.cpp 项目: MGKhKhD/easy-IP
 /// 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);
 }
示例#20
0
 /// Constructor for cloning \a s
 TestSpace(bool share, TestSpace& s) : Space(share,s) {
   x.update(*this,share,s.x);
 }
示例#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);
 }
示例#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);
 }
示例#23
0
	SteadySpace(bool share, SteadySpace & o)
		: Space(share, o) {
		spec_vars.update(*this, share, o.spec_vars);
	}
示例#24
0
 /// Constructor for cloning \a s
 Ass(bool share, Ass& s) : Gecode::Space(share,s) {
   x.update(*this, share, s.x);
 }