Hi,

I have two Gecode models and in one (say class A) I create variables and I want the variables in the other class (say class B) be initialised with the domains of a subset of  variables from class A. This is similar to the 'kakuro.cpp' case study example in MPG with one difference that I want to initialise those variables in class B to take the exact domain as the variables passed from class A. I know this is possible by passing an array of IntSet and a Dom constraint to propagate the domains of the variables in class B, but I wanted to directly use the constructor of the IntVarArray:
IntVarArray (Space &home, const IntVarArgs &a)
Initialize from integer variable argument array a (copy elements). 
 
I attached a minimal example 'test.cpp' to demonstrate this problem. In the attached example class A is called PassVar and class B is called DistinctTest. The example finds the solutions to the model of class DistinctTest but it fails at class PassVar by throwing a segmentation fault, and I don't see why that is the case. If I remove the distinct constraint in class DistinctTest then both classes can successfully find all the solutions. According to Gecode reference initialising an IntVarArray with (Space &home, const IntVarArgs &a) should only initialise the new variables by copying the elements, but I think this might not to be the case here. Can you please have a look at the code and let me know if I'm doing something wrong here.


Attachment: test.cpp
Description: Binary data

Best regards,
Farshid

_______________________________________________
Gecode users mailing list
users@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to