Dual Value-Yalmip-gurobi

626 views
Skip to first unread message

Mohammad M

unread,
Aug 12, 2014, 1:44:12 AM8/12/14
to yal...@googlegroups.com
I am using Gurobi as my solver in Yalmip to solve a MIP probelm (linear). I would like to have dual variable values as well, but when I use dual(F(1)) I will get NaN. Is there any special structure that I should follow to get dual variables?

Regards,
Mohammad

Johan Löfberg

unread,
Aug 12, 2014, 2:37:11 AM8/12/14
to yal...@googlegroups.com

Mohammad M

unread,
Aug 12, 2014, 11:41:37 AM8/12/14
to yal...@googlegroups.com
Thanks, I did what was mentioned in the link. It solved but seems with some errors. Do you have recommendation for fixing it. I should mention that primal problem is feasible and most of the constraints are soft, so it shouldn't go to infeasibility. After some iteration results I have got these messages:


Barrier performed 43 iterations in 0.62 seconds
Numerical trouble encountered

Model may be infeasible or unbounded.  Consider using the
homogeneous algorithm (through parameter 'BarHomogeneous')

Crossover log...

       0 DPushes remaining with DInf 4.7395234e-09                 1s
Warning: Markowitz tolerance tightened to 0.5

   19066 PPushes remaining with PInf 2.1651819e-01                 1s
       0 PPushes remaining with PInf 5.3348364e-02                 1s

  Push phase complete: Pinf 5.3348364e-02, Dinf 4.7395234e-09      1s

Iteration    Objective       Primal Inf.    Dual Inf.      Time
   19695    3.7151943e+13   0.000000e+00   6.484482e+06      1s
Iteration    Objective       Primal Inf.    Dual Inf.      Time
       0   -8.4351990e+27   4.784590e+39   1.683037e-02      0s
Warning: 1 variables dropped from basis

Solved with dual simplex
Solved in 7244 iterations and 2.58 seconds
Optimal objective  3.715194326e+13
Warning: unscaled primal violation = 126.987 and residual = 1.19209e-07
Warning: unscaled dual violation = 0.0230012 and residual = 0.0342296

Johan Löfberg

unread,
Aug 12, 2014, 2:18:14 PM8/12/14
to yal...@googlegroups.com
Before trying to address this, my first question would be: do you have any reason for doing like it is described in the link. I am not in any sense saying that it is a reasonable way to compute anything worth calling a dual in a MIP. I am just showing how you can compute the duals for some kind of optimal relaxation of the MIP. In general, these values probably have absolutely no relevance. In other words, if it weren't for what is stated in the link, is this what you would be interested in computing and what is the justification for that?

Johan Löfberg

unread,
Aug 12, 2014, 2:19:14 PM8/12/14
to yal...@googlegroups.com
...and answering your question is impossible anyway since you haven't supplied any reproducible code.

Mohammad M

unread,
Aug 12, 2014, 2:52:51 PM8/12/14
to yal...@googlegroups.com
When I am calculating dual variables, my problem is linear programming and not MIP anymore ( I consider all binary variables as just parameters). I just didnt know I should add term " 'relaxed',2 " in stdpsetting. I am going to use it to apply bender decomposition and it is gonna be my sub-problem, and I am going to use dual variable to create cuts.

Johan Löfberg

unread,
Aug 12, 2014, 2:59:46 PM8/12/14
to yal...@googlegroups.com
My guess is that the integer solver and the continuous solver in Gurobi have different tolerances. The solution which is considered feasible in the integer solver, is not feasible in the tolerances used by the continuous solver, and even worse, the problem is not even feasible.

Hence, the only hack I can see is to crank up the tolerances in the integer solver and/or weaken the tolerances in the continuous solve. Alternatively, solve a slightly tightened problem in the MIP solve.

Mohammad M

unread,
Aug 12, 2014, 3:38:31 PM8/12/14
to yal...@googlegroups.com
Thanks alot for all your help Johan. I always set the tolerance manually in all my codes when I am calling a solver to make sure my simulation is consistent. I have CPLEX solver as well, but I strongly prefer to use GUROBI because it solves my problem much faster. I will spend more time on my code, and lets hope I can fix it.
Reply all
Reply to author
Forward
0 new messages