[gecode-users] Dynamically constructing a model using solution of an IntVar
Ajit Dingankar
Ajit.Dingankar at gmail.com
Thu Aug 15 05:33:22 CEST 2013
> That's more difficult. Let's say your variable that contains the required
array length is called x. You
> either need to decompose your model into two parts (the first part
determining x, the second part then
> using that solution to construct a new model with the right length), or
you need to allocate an array with
> the maximum possible length and use constraints to say that everything
beyond index x is ignored.
>
> Cheers,
> Guido
Thanks, Guido! I was thinking about an approach similar to your first
suggestion which may be better suited for my situation (in addition to
being more memory efficient ;-) since it's a natural fit for my solution
requirement: I need to solve for every legal length but the data should
be randomly picked (one solution for every length) since the data space
is very large and most solutions don't add any insight into the problem
over that of a single representative solution.
I couldn't find an example of model decomposition in MPG, so I'd really
appreciate any pointers or hints of handling the underlying space; mainly
if I can/must use a different space for the second model. I think I've
to use a different space and the variables in the first model can't be
constrained by those in the second model in this approach. If there are
any such constraints, I must use the second approach of maximum possible
length.
Thanks,
Ajit
====
More information about the users
mailing list