[gecode-users] Float values and element constraint

Dani G daniel.garcialorenzo at gmail.com
Tue Feb 21 19:45:12 CET 2017


Hello Arshad,

You should check the mail archives. I just posted a similar question few
months ago and here is the answer:

http://www.gecode.org/pipermail/users/2016-November/004911.html

In any case, I would really try to convert your float variables into a
Integer one. For example, in a similar problem I used cents (integer)
instead of dollars (float), just by multiplying by 100 my input values...
In any case, I find float variables more complicated to use.

Regards

Daniel


2017-02-21 13:59 GMT+01:00 Arshad Khan <khan.m.arshad at gmail.com>:

> Hello All,
>
> I am a Gecode novice and seeking your expert help on one of the issue that
> I am facing when using float values.
>
> In the example warehouse.cpp, the supply cost from a warehouse to a store
> is defined using an int value matrix (c_supply). This matrix is later
> used in one of the constraint that computes the cost. Now I want to use a
> cost matrix of float values. However, the constraint uses an 'element'
> constraint to compute the cost which is not defined for float values. How
> can I convert the constraint to use float values? Any help is greatly
> appreciated.
>
> For your reference, the relevant code from the example is follows:
>
> // Compute cost for each warehouse
> for (int s=0; s<n_stores; s++) {
>    IntArgs c(n_warehouses, c_supply[s]);
>    c_store[s] = expr(*this, element(c, supplier[s]));
> }
>
> (What I want is to have a FloatValArgs type for c.)
>
> Thanks and Regards
> Arshad
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20170221/86fdf7c9/attachment.html>


More information about the users mailing list