[gecode-users] Cost for values in domain

Tales Pinheiro de Andrade tales at talesp.inf.br
Thu Nov 25 20:54:42 CET 2010


Wow, that was fast!

Thank you!

On 25 Nov, 2010,at 04:53 PM, Christian Schulte <cschulte at kth.se> wrote:

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: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf Of Tales Pinheiro de Andrade
Sent: Thursday, November 25, 2010 8:49 PM
To: users at gecode.org
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: users at gecode.org
Subject: Cost for values in domain

Hi, 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20101125/f8b55898/attachment.htm>


More information about the users mailing list