Element of decisionvariable is missing
AnsweredHello,
I have developed a bi-objective coverage model including an epsilon constraint method with gurobipy. It has three decisionvariables covered, multiple covered and assigned.
To test whether the results are correct, I have calculated 3 points. I have six partial results (for first objective and second objective).
I realized that the solution to a decision variable is not correct for two of the six solutions. A decision variable element is always missing. When I look at the assigned results, I can see that the element is assigned. It is used.
Why does Gurobi ignore the element? (e.g. covered[97] is missing but assigned[0,97] exists and is correct)
What could be the reason why covered[97] is lost? In the other test case it was covered[13] of a possible 99 which was not taken into account, although it is mapped in assigned.
I am grateful for any advice
-
Hi Madeira,
Your question reads as if the audience is familiar with your problem, and your model formulation (but they are not).
I think we will need to bridge this gap in order for anybody to be able to help. Feel free to post your formulation and a brief description of the problem, variables, and constraints, and illustrate where the issue is with a small example.
- Riley
0 -
Hi Riley,
thank you for your reply.
I put there my model formulation, my code and the description of the two samples which have the earlier mentioned deviation.
The sample covers 100 points. If that is too large I will try to find a smaller data set where the deviation is displayed.
Thank you.
Madeira
0 -
Hi Madeira,
The first thing I would change in your code is the where you compare
element.X != 0
If these variables are integer (or binary) then it is best to use a comparison such as
element.X >= 0.5
as sometimes integer variables don't take precise integer values. You could for example have a binary variable with value 0.000001 and this would be considered feasible under default settings. But using Python's != operator to compare to 0 would result in "True", when you actually want it to be considered as 0.
Why does Gurobi sometimes return non-integral values for integer variables?
I'd try making this change first and seeing if it solves the issue.
- Riley
0 -
Hi Riley,
thank you for the hint. I applied it.
First with 0.5, then 0.25 and then with 0.
The first two tries gave me the same deviation (97 was not included). With the last try I got all results from the solver. 97 is declared with 0 but the assign decision variable still assigns 97.I added a new document with screenshots and comments in the folder.
Thank you.
Madeira
0 -
Do the "assigned" variables in your code/analysis correspond to the "z" variables in your formulation?
0 -
Yes
0 -
Ok, so now the question is, if you think you have an incorrect solution:
1) which constraints does the solution violate
or
2) can you construct a solution with a better objective0
Please sign in to leave a comment.
Comments
7 comments