[AMPL 24819] linearizing conditional constraints

Dear team,

I have developed the next constraints for the next conational:

I want a binary variable let say z[t]=0, when 0<= v[t] < VMAX, that means, while v[t] is zero in t, then z[t] = 0, On other hand, z[t]=1, when VMIN <= v[t] <= VMAX. To get that I formulated the next two constraints:

  1. v[t] >= VMIN*z[t]
  2. v[t] <= (VMIN - eps)(1 - z[t]) +VMAXz[t], where eps is a smallest 1E-5 value.

In this case, I want to use the binary variable z[t] the next equation:

r[t] = x[t] + s[t] + H[t], where r, x, y are no negative variables and H[t] is a parameter. Here I want to say that while z[t]=0, that is 0<= v[t] < VMAX, then r[t] = H[t] and x[t] = s[t] = 0, and only after v[t] reached the VMIN value, that is VMIN <= v[t] <= VMAX, then r[t] = x[t] + s[t] + H[t], where x and s are positive different of zero. To get that I made:

r[t] = x[t] + s[t] + H[t]

x[t] <= Mz[t]
s[t] <= M
z[t]

Please help me checking the proposed formulation, and if you have another best option to formulate that, your suggestions always will be important.

Regards

Julio

Are you saying that you want z[t] and v[t] to be related like this?

z[t] = 0 ==> v[t] = 0
z[t] = 1 ==> VMIN <= v[t] <= VMAX

That can be written equivalently as these linear constraints:

v[t] >= VMIN * z[t]
v[t] <= VMAX * z[t]

However, the constraints you have written imply that

z[t] = 0 <==> 0 <= v[t] <= VMIN - eps
z[t] = 1 <==> VMIN <= v[t] <= VMAX

If that is what you want, then your constraints are correct. 1e-5 would be a reasonable value to try for eps.

For your other constraints x[t] <= Mz[t] and s[t] <= Mz[t], it should be clear that they only say z[t] = 0 ==> x[t] = 0 and z[t] = 0 ==> s[t] = 0.

In general, if you want to check constraints involving a binary variable, just substitute 0 for the variable and see what constraints you get, then substitute 1 for the variable and see what constraints you get.

Thanks, Robert, for your reply.

To understand mare clearly mu problem. I have an equation v[t] = x[t] + s[t] + other variables, and I have other related equation r[t] = x[t] + s[t] + H[t], where r, x, y are no negative variables and H[t] is a parameter, also VMIN <= v[t] <= VMAX, where VMIN is not zero. v[t] represents the water volume of a reservoir. I start in the first-time t0 of analysis with the reservoir empty, so, I want that while 0 <= v[t] < VMIN i.e. While v[t] does not reach the VMIN the variables x[t] = s[t] = 0 and r[t]=H[t] where H[t] is an external inflow.

Summarizing, I want to do that:

z[t] = 0 if 0 <= v[t] < VMIN
z[t] = 1 if VMIN <= v[t] <= VMAX

and

r[t] = x[t] + s[t] + H[t]

x[t] <= Mz[t]
s[t] <= M
z[t]

Would represent the equations in the previous email the above equations.

Regards

Julio

Given your description of the constraints that you want to include, your linearization looks correct to me.

Thanks dear Robert