[Fwd: Help w. Constraint Please]
Andrew Makhorin <[email protected]> Sat, 24 Oct 2020 14:00:42 +0300
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <[email protected]> |
-------- Forwarded Message -------- From: Manuel Castro <[email protected]> To: [email protected] Subject: Help w. Constraint Please Date: Sat, 24 Oct 2020 09:02:40 -0000 > Hi there, > > I would be thankful if you could help me in clarifying my questions > below. > I really appreciate your support. Many thanks in advance. > > Constraint: > subject to linctr19 {i in 1..365}: > sum{j in (i - 1) * 48 + 1..(i * 48)} FlexibleLoadEfficiency * > FlexibleLoadIncrease[j] - FlexibleLoadDecrease[j] = 0; > > Error: > \AppData\Local\Temp\SolverStudio 2i2iz0tk\model.txt:139: j not defined > Context: ...cy * FlexibleLoadIncrease [ j ] - FlexibleLoadDecrease [ j > ] > MathProg model processing error > > What I am trying to achieve: > My index "i" represents a day. So I will have 365 days in total (i.e. > 1 year). I want the constraint to be evaluated on a daily basis. > My FlexibleLoadIncrease and FlexibleLoadDecrease decision variables > will be arrays of 17520 elements each. This means I will have a > representation of 1 full year on 30min basis. So each day is > represented by 48 time periods. > > Coming back to my contraint, I want to assess it on a daily basis and > for each day I want to make the sum of the 48 half hour periods. Thus, > for day i=1, I will have the sum of j from 1 to 48, for day i=2, I > will have the sum of j from 49 to 96, for day i=3, I will have the sum > of j from 97 to 144 and so on... I am struggling to represent this in > GMPL. > > I had this constraint in a different language which was "mosel" from > Fico XPRESS. There I represented it as follow and works well: > forall (i in 1.. 365) do > sum (j in (i - 1) * 48 + 1..(i * 48)) (FlexibleLoadEfficiency * > FlexibleLoadIncrease(j) - FlexibleLoadDecrease(j)) = 0 > sum (j in (i - 1) * 48 + 1..(i * 48)) (FlexibleLoadIncrease(j) - > FlexibleLoadEnergyRating(j) * LoadPowerProfile(i)) <= 0 > end-do > > How do I translate this into GMPL syntax?? > Many thanks for your help in advance. It's really appreciated. > > Kind regards, > Manuel.