[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Calculate sqrt of var
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Calculate sqrt of var |
Date: |
Tue, 08 Apr 2014 23:34:27 +0400 |
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.
- Re: [Help-glpk] Calculate sqrt of var,
Andrew Makhorin <=