[gecode-users] problem using IntVarArgs

Christian Schulte cschulte at kth.se
Thu Jun 11 18:19:55 CEST 2009


Hi Kish,

Let me venture a guess: you did not initialize the arguments of IntVarArgs.
When you create an IntVarArgs object, its fields are uninitialized. So what
you might want do is

IntVarArgs x(n);
for (int i=0; i<n; i++)
   x[i].init(home, ..., ...);

Where ... are smallest and largest possible value.

Is that it?

Cheers
Christian

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Kish Shen
Sent: Thursday, June 11, 2009 5:59 PM
To: users at gecode.org
Subject: [gecode-users] problem using IntVarArgs

Hi,

I am running into a seg fault with posting simple constraints with a 
IntVarArgs. I am using GeCode 3.0.2.

What I want to do is to set a variable in IntVarArgs to a value. I tird 
the following two ways:

dom(*solver, alldiff[i], i)

and
rel(*solver, alldiff[i], IRT_EQ, i)

where alldiff is a IntVarArgs

Both seem to cause a seg fault.

I haven't used Gecode much, so I assume I am making some basic mistake 
-- can someone please let me know what I am doing wrong?

[For the context of what I am doing, I am trying to implement the 
distinct constraint, which takes a IntVarArgs. However, some of these 
variables may already be set to an integer value -- this is what I am 
trying to do here -- the distinct constraint have not been posted at 
this point]

Thanks in advance for any help!

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.

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





More information about the gecode-users mailing list