[gecode-users] Segmentation fault in a very simple model
Alfredo Esteban
aetdev at gmail.com
Tue Aug 4 15:42:16 CEST 2009
Hello,
I'm getting started with Gecode reading "Modeling with Gecode". I have
experience in Constraint Programming using iLog software.
I installed Gecode and I created a project to test it. I used SendMoreMoney
example. Everything is ok and I can compile and execute this example.
However, when I tried to build my own simple model, compilation is ok but I
get a segmentation fault when posting a linear constraint. It is very
strange because I imitated SendMoreMoney example. I searched in mailing list
but I didn't find anything.
I show you the code. In main.cpp we have:
int main(int argc, char* argv[]) {
SchoolTimeTable* problem = new SchoolTimeTable();
[...]
return 0;
}
In schoolTimeTable.h we have:
#include <gecode/int.hh>
using namespace Gecode;
class SchoolTimeTable : public Space {
protected:
BoolVarArray m_vars;
public:
SchoolTimeTable(void);
SchoolTimeTable(bool share, SchoolTimeTable& s);
virtual Space* copy(bool share);
void print(void) const;
};
In schoolTimeTable.cpp we have:
#include "schoolTimeTable.h"
#include <gecode/search.hh>
SchoolTimeTable::SchoolTimeTable(void){
m_vars = BoolVarArray(*this,900);
BoolVarArgs borrame(3);
for (int i=0; i<3; i++) borrame[i]=m_vars[i];
linear(*this,borrame,IRT_EQ,2); // SIGSEGV IS HERE
}
SchoolTimeTable::SchoolTimeTable(bool share, SchoolTimeTable& s)
: Space(share, s) {
m_vars.update(*this, share, s.m_vars);
}
Space* SchoolTimeTable::copy(bool share) {
return new SchoolTimeTable(share,*this);
}
Technical data:
OS: Debian GNU/Linux Squeeze
Gecode version: 3.1.0
gcc version: 4.3.3
gdb version: 6.8
Thank you very much,
Alfredo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090804/1833cbe3/attachment.htm>
More information about the gecode-users
mailing list