I have a model which has the next lines
set J:={1..3}; #Número de centrales hidroeléctricas del sistema
set T:={1..3}; #Número de periodos del horizonte temporal
param Pmin{j in J, t in T};
param Pmax{j in J, t in T};
var v{j in J, t in T}, binary, >=0;
#constraint:
prodTer{j in J, t in T}: Pmin[j,t]*v[j,t] <= p[j,t] <= Pmax[j,t]*v[j,t];
when I try to compile appear the next error:
"leftmost expression in double inequality cannot be linear form
Context: , t in T } : Pmin [ j , t ] * v [ j , t ] <= p [ j , t ] <=
MathProg model processing error"
What's wrong in the restriction?
Split your double inequality into two single inequalities:
prodTer1{j in J, t in T}: Pmin[j,t]*v[j,t] <= p[j,t];
prodTer2{j in J, t in T}: p[j,t] <= Pmax[j,t]*v[j,t];
On the other hand, if I have a restriction like:
ContHidrica {i in I, t in T}: V[i,t] = V[i,t-1] + r[i,t]
How can I supply the value V[i,0] at the begining? or If I have
rampaBaj{j in J, t in T}: p[j,t] - p[j,t+1] <= X[j]
How can I for manipulate the subscripts to avoid go beyond limits?
Use predicates on specifying subscript domains, e.g.
ContHidrica {i in I, t in T: t != 0}: V[i,t] = V[i,t-1] + r[i,t]
rampaBaj{j in J, t in T: t != card(T)}: p[j,t] - p[j,t+1] <= X[j]
For more details see the language reference. See also examples included
in subdirectory glpk/examples.