本文整理汇总了C++中gecode::IntVarArray类的典型用法代码示例。如果您正苦于以下问题:C++ IntVarArray类的具体用法?C++ IntVarArray怎么用?C++ IntVarArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntVarArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: post
/// 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: post
/// 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);
}
示例3: post
/// 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);
}
示例4: post
/// 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);
}
示例5: post
/// 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);
}
示例6: post
/// 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);
}
示例7: post
/// 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);
}
示例8: post
/// 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);
}
示例9: post
/// 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);
}
示例10: post
/// 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);
}
示例11: getSolution
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;
}
示例12: IntTestSpace
/// 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);
}
示例13: print
void print() const {
for (int i = 0; i < spec_vars.size(); i++)
cout << spec_vars[i].val() << ' ';
}
示例14: TestSpace
/// Constructor for cloning \a s
TestSpace(bool share, TestSpace& s) : Space(share,s) {
x.update(*this,share,s.x);
}
示例15: Space
SteadySpace(bool share, SteadySpace & o)
: Space(share, o) {
spec_vars.update(*this, share, o.spec_vars);
}