GUSS Grid for parallizeable timeseries NLP

Problems with modeling
Post Reply
zamry
User
User
Posts: 8
Joined: 1 year ago

GUSS Grid for parallizeable timeseries NLP

Post by zamry » 3 weeks ago

Hello,

I solve timeseries NLPs of 6 million variables in GAMS using the IPOPTH solver. The same model base is used for various objective analyses. The model is discretized at a 1 hr interval over a 24 hour duration. There exist some optional temporal constraints that link between subsequent timepoints. However, there are analyses in which the temporal constraints are not needed, which results in independent per-timepoint models that are parallelizable. See a crude example below,

Code: Select all

minimize  z_obj = sum(t, x(t))
s.t.
x(t)^2  +  y(t)^2  <=  a(t)^2
x_min(t)  <=  x(t)  <= x_max(t)
y_min(t)  <=  y(t)  <= y_max(t)
where a(t), x_min(t), x_max(t), y_min(t) and y_max(t) are timeseries input parameters. I want to solve such model using the GUSS Grid environment by defining the timepoints as parallel scenarios. This gussgrid.gms (https://www.gams.com/latest/gamslib_ml/ ... sgrid.html) serves as my reference while setting up the solve configuration. I realize that I'm not able to parallelize my model because the set of scenarios, in this case timepoint t, constitutes the index in equations, constraints and parameters that form the model. Is there a way to handle this kind of modelling situation to take advantage of GUSS Grid environment without significantly changing the model structure?
Last edited by zamry 3 weeks ago, edited 1 time in total.

Fred
Posts: 323
Joined: 6 years ago

Re: GUSS Grid for parallizeable timeseries NLP

Post by Fred » 3 weeks ago

Hi Zamry,

GUSS and the Grid Facility are two independent things that are used in combination in the gussgrid example you shared.
In your case, it seems that the grid facility could be useful but given the model setup as you describe it, using GUSS will not be straightforward at all.
So I suggest that you focus on "grid only" examples like trnsgrid or tgridmix.

I hope this helps!

Fred

zamry
User
User
Posts: 8
Joined: 1 year ago

Re: GUSS Grid for parallizeable timeseries NLP

Post by zamry » 3 weeks ago

Hi Fred,

Thanks for replying. My rough idea to form the loop is as follows,

Code: Select all

loop(t,

Solve   Model using NLP minimizing z_obj;

);
However, GAMS does not permit any controlling set inside the body of the loop since the scenario t constitutes the construct of my model. Seems like the only way to go for me is to drop time index t from the model variables, equations and parameters.

User avatar
bussieck
Moderator
Moderator
Posts: 859
Joined: 6 years ago

Re: GUSS Grid for parallizeable timeseries NLP

Post by bussieck » 3 weeks ago

Just make an alias of t and loop over that:

Code: Select all

alias (t,tt);
loop(tt,

Solve   Model using NLP minimizing z_obj;

);
-Michael

zamry
User
User
Posts: 8
Joined: 1 year ago

Re: GUSS Grid for parallizeable timeseries NLP

Post by zamry » 3 weeks ago

The alias definitely works but I'm still solving the entire timepoints in each loop. In a toy problem shown below, I'm expecting to solve only t1 in the first loop, and only t2 in the second loop.

Code: Select all

option LP = cbc;
option limrow = 0;
option limcol = 0;
option solprint = off;
option dispwidth = 20;


Set t 'hours'  / t1, t2 /;

Alias(t, tt);

Table data(t,*)
        Pload  Pgen_min  Pgen_max  gen_cost Pwind  wind_curt_cost
   t1   500    10        500       5        300    10
   t2   800    80        500       10       500    20
;

Variables
cost          'total dispatch cost'
Pgen(t)       'generator dispatch'
Pwind(t)      'wind dispatch'
Pwind_curt(t) 'wind curtailment'
;

Pgen.up(t) = data(t, 'Pgen_max');
Pgen.lo(t) = data(t, 'Pgen_min');

Pwind.up(t) = data(t,'Pwind');
Pwind.lo(t) = 0;

Pwind_curt.up(t) = data(t,'Pwind');
Pwind_curt.lo(t) = 0;

Equations
CostObj
PowerBalance
WindCurtailment
;

CostObj.. cost =e= sum(t, data(t,'gen_cost') * Pgen(t) + data(t,'wind_curt_cost') * Pwind_curt(t));
PowerBalance(t)..     Pwind(t) + Pgen(t) =e= data(t,'Pload');
WindCurtailment(t)..  Pwind(t) + Pwind_curt(t) =e= data(t,'Pwind');

Model DynamicEconomicDispatch / all /;


loop(tt,

solve DynamicEconomicDispatch using LP minimizing cost;
display Pgen.l, Pwind.l;

);

Post Reply