I was debating someone about the behavior of Gurobi. We have a model using indicator constraints.
Let's say you create
int target1_value = 1;
for (int col = 0; col < sims.cols; ++col)
gap_value[col] = model.AddVar(0, GRB.INFINITY, 0, GRB.CONTINUOUS, "gaps");
GRBVar gap = model.AddVar(-GRB.INFINITY, GRB.INFINITY, 0, GRB.CONTINUOUS, "gap");
b[col] = model.AddVar(0, 1, 0, GRB.BINARY, "b");
And then use
model.AddGenConstrIndicator(b[col], 1, gap == gap_value[col] - target1_value, "penalty_amt");
model.AddGenConstrIndicator(b[col], 0, gap == 0, "no_penalty_amt");
From my understanding of the documentation the model will seek to optimize the best values of b[col]. The debate was over whether or not b[col] is set to be 1 when the gap is positive or 0 otherwise.
Therefore, I understand that the gap being positive or not has nothing to do with the value of b[col], the model will choose this based on the constraints. What is debated is whether the value will be set based on the linear expression in the function argument.
Please sign in to leave a comment.