How to write an if then logical constraint given part of the input related to a decision variable?
If you have two binary variables X, Y and you want to express the constraint X implies Y via a linear inequality you can use the logical equivalent statement (not X) or Y, which in linear programming translates to:
$$(1-X) + Y \geq 1$$
In Gurobi-Code this would be: model.addConstr((1-X) + Y &gt;= 1, name="implication").