help-glpk
[Top][All Lists]
Advanced

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

Constraint modelling on a subset


From: Philippe Jugla
Subject: Constraint modelling on a subset
Date: Tue, 23 Mar 2021 21:28:01 +0000

Hello, 

 

I am rather new to GLPK and I am seeking help regarding the modelling of a constraint in a unit commitment problem. 

I hope someone will kindly help me on this one. 

 

I am trying to model a constraint which constrains a sum, but on a sequence of subsets of an initial set TIME. 

A bit of context with a simple example below : 

 

#sets 

set TIME := 1..T; 

set PLANTS :=P1, P2; 

 

#parameters 

param T; 

param max_startups_year {PLANTS}; 

param max_startups_week {PLANTS}; 

 

#variable 

var startup {p in PLANTS, t in TIME} binary; 

 

#constraint 1 

subject to C1 {p in PLANTS}: 

sum {t in TIME} startup[p,t] <= max_startups_year[p]; 

 

Now this is where I am struggling : I would like to constrain sum of startup[p,t] with parameter max_startups_week[p] but on subsets of the set TIME with step k (let’s say k=5). 

 

The following works but obviously is not flexible at all. 

It gives you the idea of what I would like to do : 

 

sum {t in 0..5} startup[p,t] <= max_startups_week[p]; 

sum {t in 6..10} startup[p,t] <= max_startups_week[p]; 

 

Etc… 

 

sum {t in T-5..T} startup[p,t] <= max_startups_week[p]; 

 


I have tried to define another set TIME_2 but it’s not satisfying as it is hard-coded as well… 

 

Set TIME_2 := (0..5 union 6..10.. union [etc] union T-5..T)  

subject to C2 {p in PLANTS}: 

sum {s in TIME_2} startup[p,s] <= max_startups_week[p]; 

 

How would you work this constraint out to be robust and flexible ? At the end, the number of steps k should be a parameter. 

To simplify things, let’s say that k divides exactly set TIME. 

 

Thanks very much for your help, 

 

Philippe 



reply via email to

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