[gecode-users] question about 'element' constraint
Stefano Gualandi
gualandi at elet.polimi.it
Wed Nov 16 16:46:13 CET 2005
Hi,
I am observing a strange behavior with the element constraint with
domain consistency, when the vector is an array of variables (i.e.,
using doc notation: x_y0 = y1). For instance, in the attached script,
it enlarges the domain of y1.
Any hints?
Please notice, that it works if we use bound consistency (ICL_BND).
thanks in advance,
Stefano
-------------- next part --------------
#include "support.hh"
class MyModel : public Example {
private:
IntVarArray xs;
IntVarArray ys;
IntVarArray ts;
public:
MyModel(const Options& o)
: xs(this, 3, 0, 2), ys(this, 6, 13, 30), ts(this, 6, 10, 20)
{
element(this, ts, xs[0], ys[0], ICL_DOM); // or ICL_BND
branch(this, xs, BVAR_SIZE_MIN, BVAL_MIN);
}
MyModel(bool share, MyModel& s) : Example(share,s) {
xs.update(this, share, s.xs);
ys.update(this, share, s.ys);
ts.update(this, share, s.ts);
}
virtual Space*
copy(bool share) {
return new MyModel(share, *this);
}
virtual void
print(void) {
for (int i = 0; i < xs.size(); i++)
std::cout << "\t x: " << xs[i] << " - y: " << ys[i] << " - t: " << ts[i] << std::endl;
std::cout << std::endl;
}
};
int
main(int argc, char** argv) {
Options opt("New Model");
opt.n = 6;
opt.iterations = 200;
opt.c_d = 5;
opt.parse(argc,argv);
Example::run<MyModel,DFS<MyModel> >(opt);
return 0;
}
-------------- next part --------------
More information about the gecode-users
mailing list