[gecode-users] Dynamic creation of IntVarArgs
Christian Schulte
cschulte at kth.se
Tue Dec 2 13:00:26 CET 2008
That's the oldest trick from the schoolbook: when you create the tree,
maintain in each node a counter that tells you the number of nodes (or
leaves, or the nodes corresponding to a linear expression or whatever you
need) in the subtree.
As suggested earlier, this trick is used also in post linear expressions in
mini model.
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Max
Sent: Tuesday, December 02, 2008 12:52 PM
To: users at gecode.org
Subject: [gecode-users] Dynamic creation of IntVarArgs
Hello everybody,
i wanted to create an IntVarArgs array for using linear constraints.
I need this array in an recursive function where the size is calculated
at the end of the recursion(recursion size == array size).
Now i found out that a can not dynamically create an IntVarArgs or an
IntArgs.
This, seems reasonable, because i would have to destroy it somewhere,
and i don't know if gecode copies the reference it gets in the linear
call(i don't think so and it would be better not to do so).
BUT:
Why can i not create an IntVarArgs array without size and initializing
it with a size at a later time.
Without that, i would have to recurse my tree two times, one time for
evaluating the size of the array, and one time to fill it. This is bad.
Do i have overseen something ? Why is this feature not supported.
Any ideas how to solve my problem?
Thanks in advance.
Max
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list