[gecode-users] gcc interface
Stefano Gualandi
stefano.gualandi at fastwebnet.it
Fri Nov 25 17:50:35 CET 2005
Thanks a lot, Patrick, the simple example works fine with your
corrections.
I do appreciate your support :-)
cheers,
Stefano
> Hi Stefano,
>
> First: You got it quite right. That is what the gcc interface for
> cardinality variables is supposed to do.
>
> Second:
>
> Unfortunately, the current testing forced me to remove the gcc
> interface for variable cardinalities temporarily, because they are not
> fully tested and might still have some inconsistencies in the
> propagation algorithm.
>
> However, depending on your subversion-checkout,
> you can give your model a shot.
> Starting with your script, should work.
> But, therer were some minor errors in it and i provided you with a
> fixed script that should work for this simple test.
>
> Finally I hope you'll find this helpfull
> and I'm trying hard to get things fixed.
>
> Best regards,
> Patrick Pekczynski
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFDh0tUH+YA8TLXsgkRAtkwAKCBuF0suHQcUfVIqkK8hv6NKExNzwCfZudA
> ZaVVZT59mfLfsdO0FTPXpWs=
> =zfj5
> -----END PGP SIGNATURE-----
>
> /* Author: Stefano Gualandi, gualandi at elet.polimi.it
> */
>
> #include "support.hh"
> #include <int.hh>
>
> class MyModel : public Example {
>
> private:
> IntVarArray xs;
> public:
> MyModel(const Options& o)
> : xs(this, 3, 0, 3) {
>
> // this would do it for cardinality variables
> // IntVarArgs c(4);
> // for(int i = 0; i < 3; i++) {
> // c[i].init(this, 0, 1);
> // }
> // c[3].init(this, 0, 3);
>
> // gcc(this, xs, c, ICL_DEF);
>
> // This does the trick for fixed cardinalities
> IntArgs c(12,
> 0,0,1,
> 1,0,1,
> 2,0,1,
> 3,0,3);
> gcc(this, xs, c, 12, 3, ICL_DEF);
>
> branch(this, xs, BVAR_SIZE_MIN, BVAL_MIN);
> }
>
> /// Constructor for cloning \a s
> MyModel(bool share, MyModel& s) : Example(share,s) {
> xs.update(this, share, s.xs);
> }
>
> /// Perform copying during cloning
> virtual Space*
> copy(bool share) {
> return new MyModel(share, *this);
> }
>
> virtual void
> print(void) {
>
> // print services
> for (int i = 0; i < xs.size(); i++)
> std::cout << "\t var: " << i <<"\t value " << xs[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);
>
> // note the change here for the search engine
> Example::run<MyModel, DFS>(opt);
> return 0;
> }
>
More information about the gecode-users
mailing list