[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] Calculate sqrt of var

**From**: |
Meketon, Marc |

**Subject**: |
Re: [Help-glpk] Calculate sqrt of var |

**Date**: |
Tue, 8 Apr 2014 19:11:44 -0500 |

My guess is that fee[m] is a const/param, so can you rewrite your constraint to
be the following?
fee[m]*fee[m] = 1000 + (100 + (sum {n in N} (n mod 47))) * (sum {l > in L}
prod[l,m]);
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Andrew Makhorin
Sent: Tuesday, April 08, 2014 3:34 PM
To: Tiago Costa
Cc: address@hidden
Subject: Re: [Help-glpk] Calculate sqrt of var
On Tue, 2014-04-08 at 18:46 +0100, Tiago Costa wrote:
>* Hi,*
>
>* I'm trying to apply the following restriction:*
>
>* subject to calc2 {m in M} :*
>* fee[m] = sqrt(1000 + (100 + (sum {n in N} (n mod 47))) * (sum {l*
>* in L} prod[l,m]));*
>
>* However since prod[l,m] is a var, I get "argument for sqrt has invalid*
>* type".*
>
>* I've read in the documentation that you can only calculate the sqrt of*
>* constants/params/etc so is there a workaround to calculate the sqrt of*
>* a var?*
>
>* Thanks*
>* --*
>* Tiago Costa*
>
Only linear constraints are allowed while sqrt makes the constraint non-linear.
However, using sqrt *below* the solve statement, i.e. when all the variables
have been computed, is allowed.
_______________________________________________
Help-glpk mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-glpk
This e-mail and any attachments may be confidential or legally privileged. If
you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.