简体   繁体   中英

Issue with IBM Optimization Studio CPLEX OPL?

I develop a program using IBM Optimization Studio CPLEX(OPL), I tried to do this line :

 If (P_p(t) >= (P_L(t))/(Einv ))

 Pb(t) = Pb0+(Eb_c/3600)*(Pp(t)-P_L(t))/Einv)

 t Є {t0,t0+1,,t0+nΔt} , Δt: step time

I did something like that :

maximize ....

subject to {
....

forall(j in NH: Pp[j] >= Pl[j]/Einv)
Pb[j] == Pb0 + (Eb_c/3600)*(Pp[j]- Pl[j]/Einv);

...
}

that give me this error : "decision variable (or expression) not allowed", and I tried a lot of solution but it's does not work, the problem that I can not find in any document, an expression or a way to do that?!

EDIT

But I don't have anything to add to explain this, the firt code I wrote in my topic, I should create it using studio CPLEX.

I tried to minimise the cost of power produced by a system, so inside subject to, I have to check a if condition for every time of simulation during period T, and if the if condition is correct then do the next line of code else we will pass to another value of Pb(t)?!

The issue is to use sample time T inside if condition and inside subject to!

Although this question is 3 years old I am going to answer anyway since this is a common problem.

You cannot use decision variables in the condition for a forall or if statement. You can achieve the what you want with logical constraints, though. In your case, what you need is an "implies" constraint (using the "=>" operator):

forall(j in NH) {
   (Pp[j] >= Pl[j]/Einv) => (Pb[j] == Pb0 + (Eb_c/3600)*(Pp[j]- Pl[j]/Einv));
}

The right side of the "=>" operator is enforced only if the left side is true.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM