I would like to find dual values and reduced costs after solving a MIP problem using CPLEX. IBM's solution in this case is to fix the integer variables to create a “fixed MIP problem”, then solve this continuous problem and obtain the duals and reduced costs from that.
I do this by using the following commands in the CPLEX Interactive Optimizer:
set timelimit 1200 set threads 1 read /tmp/tmpu8f4obrb.pyomo.lp optimize change problem fix optimize write /tmp/tmp55qy8xe5.cplex.sol
This works well for my problems most of the time, but sometimes the first optimization stage will reach the time limit and return an integer feasible solution, but then the second stage will report infeasibility, e.g.,
Infeasibility row 'c_u_x495386_': 0 <= -0.00011798.
I'm assuming this occurs because the initial solution isn’t quite integral, and then in the second stage CPLEX finds a constraint where one now-fixed variable is supposed to match up with another now-fixed variable or expression, and it doesn't quite work. (This is my assumption, but I could be wrong...)
So my question is, are there settings I can adjust for the first optimization to get a “more integral” solution or for the second optimization to tolerate the non-integrality of the first solution?
Looking a little deeper, I find that the infeasible constraint has the form
commit_amount <= 1505.86 * is_committed. In this problem,
commit_amount is a continuous variable that is separately constrained to equal
150.586 * unit_size, where
unit_size is a general integer variable.
is_committed is a binary variable. In the incumbent solution (before changing to a fixed mip),
commit_amount = 0 and
is_committed = -7.8347247411958421e-08. So when the integer variables are fixed, this constraint becomes
0 <= 1505.86 * -7.8347247411958421e-08 or
0 <= -0.00011798.
So my original intuition seems to be right: in the initial optimization, CPLEX has set the binary variable
is_committed to a small negative value. Then, when the integer variables are fixed at the incumbent values, the problem becomes infeasible. But I don't know how to get the second stage to solve under these conditions.