help-glpk
[Top][All Lists]

## [Fwd: Help w. Constraint Please]

 From: Andrew Makhorin Subject: [Fwd: Help w. Constraint Please] Date: Sat, 24 Oct 2020 14:00:42 +0300

```-------- Forwarded Message --------
From: Manuel Castro <manuel.joao.castro@icloud.com>
To: help-glpk@gnu.org
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.
>
> Constraint:
> subject to linctr19 {i in 1..365}:
> sum{j in (i - 1) * 48 + 1..(i * 48)} FlexibleLoadEfficiency *
>
> 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.
> 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 *
> sum (j in (i - 1) * 48 + 1..(i * 48)) (FlexibleLoadIncrease(j) -
> end-do
>
> How do I translate this into GMPL syntax??