[gecode-users] Question about IntVar declaration

Alejandro Arbelaez a_le_jo55 at yahoo.com
Wed Sep 20 20:42:11 CEST 2006


Hi all,

Is any different creating variables like

IntVar a(s, 0,Gecode::Limits::Int::int_max+10);

than

IntVar a;
a.init(s,0,Gecode::Limits::Int::int_max+10);

because when I tried to declare a variable with the first one, the program
returns an exception (that is OK because the domain is greater that the
limits), but when I tried with the second one, the program didn't return an
exception.


for example: in the following program, ttt is greater than gecode limits.


I'm working with:
Ubuntu 6.06: g++ 4.0.3 and gecode-1.3.0



#include "gecode/int.hh"
#include "gecode/kernel.hh"
#include <iostream>

using namespace Gecode;

class ZZZ : public Space {
public:
  ZZZ(void) {}
  virtual Space* copy(bool share) {
    return new ZZZ(*this);
  }
};

int main() {
  ZZZ A;
  IntVar ttt;
  IntSet bb(Gecode::Limits::Int::int_max+3,Gecode::Limits::Int::int_max+10);

  ////ttt.init(&A,bb);
  ttt.init(&A,0,Gecode::Limits::Int::int_max+3);

  std::cout<<"max: "<<Limits::Int::int_max<<std::endl;
  std::cout<<"ttt: "<<ttt<<std::endl;

  unsigned long pp;
  SpaceStatus estado = A.status(pp);

  if(estado==SS_FAILED) std::cout<<"FAILED"<<std::endl;
  if(estado==SS_SOLVED) std::cout<<"OK"<<std::endl;
  return 0;
}


Cheers,
Alejandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20060920/97f8e40d/attachment.htm>


More information about the gecode-users mailing list