[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Setting Constarints
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Setting Constarints |
Date: |
Thu, 4 Oct 2007 16:20:39 +0400 |
> I do understand that I should write all the constraints in one
> go, but the moment I introduce a second constraint, however simple
> the constraint may be, it just throws up a error which I am unable
> to fix.
> I have gone through about 20 examples of using glpsol and some
> how Iam unable to get it working.
> The constraint that I would like to set is
> s.t cons1 : sum { i in FOOD : i <> 1 and i<> 2 and i <= 3 } h[i]
> >= 5.6 ;
Aha, now it is understood.
You cannot use 1, 2, 3 as values of i, because these values are not
in FOOD:
set FOOD := SMP Maltrodexin WPC SPI Sugar Inulin Coco MaltEx Fat VM MM;
Instead you should write something like i != 'SMP' and i != 'Sugar', etc.
It is better to define another set like this:
set FOOD2 := SMP Sugar ... ;
and use it in the predicate:
s.t cons1 : sum { i in FOOD : i not in FOOD2 } h[i] >= 5.6 ;