help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Fwd: Help w. Constraint Please]


From: Meketon, Marc
Subject: RE: [Fwd: Help w. Constraint Please]
Date: Mon, 26 Oct 2020 03:50:21 +0000

Hi Manuel,

You should sign into the help-glpk group for these types of problems.

I was able to reconstruct and fix your immediate answer.

You had something like:

param FlexibleLoadEfficiency := 1.0;

var FlexibleLoadIncrease{1..(48*365)} >= 0;
var FlexibleLoadDecrease{1..(48*365)} >= 0;

subject to linctr19 {i in 1..365}:
  sum{j in (i - 1) * 48 + 1..(i * 48)} FlexibleLoadEfficiency *
    FlexibleLoadIncrease[j] - FlexibleLoadDecrease[j] = 0;

The problem is that you needed to add parenthesis to the constraint.  Change 
the last lines to:

subject to linctr19 {i in 1..365}:
  sum{j in (i - 1) * 48 + 1..(i * 48)} (FlexibleLoadEfficiency *
    FlexibleLoadIncrease[j] - FlexibleLoadDecrease[j]) = 0;

-----Original Message-----
From: Help-glpk <help-glpk-bounces+marc.meketon=oliverwyman.com@gnu.org> On 
Behalf Of Andrew Makhorin
Sent: Saturday, October 24, 2020 7:01 AM
To: help-glpk@gnu.org
Subject: [Fwd: Help w. Constraint Please]

-------- Forwarded Message --------
From: Manuel Castro <manuel.joao.castro@icloud.com>
To: help-glpk@gnu.org
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.


________________________________
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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]