[gecode-users] Float values and element constraint

Arshad Khan khan.m.arshad at gmail.com
Wed Feb 22 02:56:13 CET 2017


Hi Daniel

Thanks for your reply and link to the post. I tried searching the archive
but seems like gmane is having some issues at the moment.

Conversion of floats to int is a good proposition. I was also thinking on
the same lines but wanted to find if a direct approach using floats could
be used. Also, the suggestion from Guido on use of implication to break the
element constraint looks interesting too.

Regards
Arshad

On Wed, Feb 22, 2017 at 2:45 AM, Dani G <daniel.garcialorenzo at gmail.com>
wrote:

> 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/20170222/13040782/attachment.html>


More information about the users mailing list