Please check the description of the element constraint, it does exactly what you need: mapping values to some other values (or, with other words, generalizing array access by allowing a variable as array index).
The case studies in MPG also contain uses of the element constraint.
Best
Christian
--
Christian Schulte, web.ict.kth.se/~cschulte/
From: [email protected] [mailto:[email protected]] On Behalf Of Tales Pinheiro de Andrade
Sent: Thursday, November 25, 2010 8:49 PM
To: [email protected]
Subject: [gecode-users] Cost for values in domain
Sorry, I sent the message below with wrong mail account.
Begin forwarded message:
Date: 25 November 2010 4:48:17 PM
To: [email protected]
Subject: Cost for values in domainHi, all
First, sorry about the bad English.
I'm searching in MPG.pdf, but still didn't find anything.
Is it possible to give cost to values in domain? I have n variables, each one with integer domain = {-1, 0, 1}. But I want to give costs for each value in each domain, and minimize the cost of the selection, obeying some other constrints.
For example: for variables z, y, z, the costs for values {-1, 0, 1} are:
Cx = {50, 20, 30}
Cy = {30, 40, 30}
Cz = {60, 20, 20}
And I want to select x, y, z minimizing Cx + Cy + Cz.
I first tought in create a bool variable for each cost in each variable. So I would get 3X more variables, with contraint that only one shoul be true. And do something like this: maximize
b_1x*c_1x + b_2x*c_2x + b_3x*c_3x +
b_1y*c_1y + b_2y*c_2y + b_3y*c_3y +
b_1z*c_1z + b_2z*c_2z + b_3z*c_3z
Is there a better way to do this?
Thank you
_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
