Why does Gurobi sometimes violate constraints during the solving process in order to achieve a better solution?
Awaiting user inputGurobi’ result violates the constraint S=max{v_1,v_2} by always choosing v_1 to minimize the objective R. I suspect this happens because R is minimized when S always equals v_1(Conflict between objective function and constraints). How can this situation be resolved?(Gurobi did not return 'infeasible' error)
The original problem is as follows:
min R
s.t.
S=max{v_1,v_2}; R=(S+t)-v_1
t is a parameter, and x is a binary variable representing task assignment results. Gurobi returns x values as 0 or 1. However, S always equals v1 (regardless of the size of v1 and v2) no matter what constraints I apply.
I've tried four different approaches to solve the S value problem, also adding penalty terms to the objective function. However, the problem remains unsolved:
Method 1: v_1-v_2≤My; v_2-v_1≤M(1-y); S≥v_1; S≥v_2; S≤v_1+M(1-y); S≤v_2+My
Method 2: v_1-v_2≤My; v_2-v_1≤M(1-y); S≥v_1; S≥v_2; S=v_1 y+v_2 (1-y)
Method 3: We use the Gurobi function addGenConstrMax.
Method 4: v_1-v_2≤My; v_2-v_1≤M(1-y); S≤v_1+M(1-y); S≥v_1-M(1-y); S≤v_2+My; S≥v_2-My
-
Hi,
Where does the variablex
appear in your model? Please provide more details.
Regards
-Ahmed0 -
Also, please see our KB article How do I diagnose a wrong solution? which provides a number of tips on how to troubleshoot this type of issue. - Gwyneth
0
Please sign in to leave a comment.
Comments
3 comments