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: [email protected]
[mailto:[email protected]] On Behalf Of
Andrew Makhorin
Sent: Tuesday, April 08, 2014 3:34 PM
To: Tiago Costa
Cc: [email protected]
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
[email protected]
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.
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk