Solved

conditional constraint

  • 5 April 2022
  • 4 replies
  • 177 views

Userlevel 2
Badge +4

Dear All,

I want to model a conditional constraint of:

where QUR, QP, QT, and Gpv are variables, and load and Qmin are parameters. t is time index.

How to implement this function in AIMMS?
Thank You.

icon

Best answer by Marcel Hunting 7 April 2022, 15:52

View original

4 replies

Userlevel 2
Badge +4

Hello @Marcel Hunting ,

Thank you for the advice that has been given. I'll try to apply to the model I'm designing.

Userlevel 5
Badge +4

This is going to be ugly. Assuming that these are the only 5 options for QUR(t+1) (although not all possible combinations of Gpv(t) and QUR(t) are covered) you can use indicator constraints if you use CPLEX or Gurobi.

Introduce a new binary variable BV1(t) for the first option. Then add the following indicator constraints:

BV1(t) = 1  →  QUR(t+1) = QUR(t) + QP(t)
BV1(t) = 1  →  Gpv(t) >= load(t)
BV1(t) = 1  →  QUR(t) <= Qmin(t)

The left part of each of these constraints represents the activating condition.

For the second option introduce a new binary variable BV2(t) and the following indicator constraints:

BV2(t) = 1  →  QUR(t+1) = QUR(t) - QT(t)
BV2(t) = 1  →  Gpv(t) <= load(t) - eps
BV2(t) = 1  →  QUR(t) >= Qmin(t) + eps

AIMMS does not support inequality constraints of type ‘>’ or ‘<’ (except for CP problems) so you have to use a small value eps to transform them into ‘>=’ or ‘<=’ respectively.

In the same way, introduce BV3(t), BV4(t) and BV5(t) for the other three options, plus the corresponding indicator constraints.Then, finally, add the following constraint:

BV1(t) + BV2(t) + BV3(t) + BV4(t) + BV5(t) = 1

Note that this formulation does not allow, e.g., Gpv(t) >= load(t) and Qmin(t) < QUR(t) < Qmax(t). If that should be possible as well then this is not going to work (but what should then be the value of QUR(t+1)?).

Userlevel 2
Badge +4

Hello @Marcel Hunting,

The complete formulation of the constraint is:

Thank you...

Userlevel 5
Badge +4

Hi @rahmat. What should QUR(t+1) be if Gpv(t) >= load(t) and QUR(t) > Qmin(t), or Gpv(t) < load(t) and QUR(t) <= Qmin(t)?

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator