I’m working on an optimization problem in JuMP where I need to ensure that certain constraints are enforced based on a binary variable. Here are the variables and constraints I have defined in my model:
Variable Definitions:
@variable(model, 0 <= x[1:n] <= 1)
@variable(model, 0 <= w[1:n, 1:T] <= 1)
@variable(model, 0 <= v[1:T] <= 1)
@variable(model, 0 <= wn[i=1:T, j=1:T] <= 1)
@variable(model, beta[1:T], Bin)
Constraints:
@constraint(model, sum_w[i=1:n], x[i] >= sum(w[i, j] for j in 1:T))
@constraint(model, sum_wn[i=1:T], v[i] >= sum(wn[i, j] for j in i:T))
@constraint(model, [t=1:T], v[t] <= beta[t])
@constraint(model, [i=1:n, t=1:T], w[i, t] <= 1 - beta[t])
@constraint(model, [i=1:T, t=1:T], wn[i, t] <= 1 - beta[t])
Desired Logic:
The binary variable \beta is used to enforce the following conditions:
When \beta[t] = 1:
-
Variable v[t] can take a positive value.
-
Variables w[i,t] and wn[i,t] must be zero.
When \beta[t] = 0:
-
Variable v[t] must be zero.
-
Variable wn[i,t] and w[i,t] can take positive values.
This is enforced by the last three constraints defined above.
To enforce that wn must hit its maximum possible values before w can take a positive value when \beta[t] = 0, I have defined the following constraint:
@constraint(model, [i=1:T, t=1:T], sum(wn[i, j] for j in i:T) - v[t] >= -beta[t])
Problem:
Despite the above constraints, the results suggest that the variables wn are not necessarily taking their maximum possible value or even positive values before the variable w takes a positive value.
Question:
What could be going wrong with my current approach?