[gecode-users] Question about IntVar declaration

Christian Schulte schulte at imit.kth.se
Wed Sep 20 21:44:40 CEST 2006


That's clearly a bug: init should also raise an exception (even the docs say
so). It's called limits because they are the limits ;-)
 
Thanks for pointing out. I'll fix it tomorrow in the trunk.
 
Christian

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Alejandro Arbelaez
Sent: Wednesday, September 20, 2006 8:42 PM
To: users at gecode.org
Subject: [gecode-users] Question about IntVar declaration



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/0a26f44c/attachment.htm>


More information about the gecode-users mailing list