# [Osi] Question about function getRowPrice()

Ted Ralphs ted at lehigh.edu
Mon May 25 02:50:14 EDT 2009

```There is a notion of duality for integer programs, but it is far more
complex than in the linear case. In general, there is no linear
function that plays for the same role for IPs as the dual vector plays
for LPs. Depending on what exactly you want to do with the dual after
you get it, e.g., sensitivity analysis, we are experimenting with
providing some of that functionality in SYMPHONY, so you may take a
look at that. If you want to know more of the story on IP duality,
here is a paper that discusses it:

http://coral.ie.lehigh.edu/~ted/files/papers/MILPD06.pdf

Cheers,

Ted

On Sun, May 24, 2009 at 11:18 PM, Matthew Galati <magh at lehigh.edu> wrote:
> Since your problem is an integer program, it does not know how to calculate
> duals. When you ask for the dual what exactly do you want back? The optimal
> duals of an integer program is a research question that (as far as I
> understand) nobody knows how to answer.
>
> Do you want the dual solution to the LP relaxation? If so, solve the LP
> first, then get the duals.
>
> For OSI folks, you should probably change this to return an error and
> warning message - rather than to quietly return 0.0.
>
> Thanks,
> Matt
>
>
>
>
>> Hi all,
>>
>> I tried to use function getRowPrice() to get the solution of dual solution
>> from an IP problem. But I received the result contain all zero value. I
>> don't know the reason why. Can anyone give me an suggestion?
>>
>>
>> my IP problem is:
>>
>> NAME EXAMPLE
>> ROWS
>>  N OBJ
>>  L ROW1
>>  L ROW2
>>  L ROW3
>> COLUMNS
>>  INT1 'MARKER' 'INTORG'
>>  COL1 OBJ 20
>>  COL1 ROW1 1  ROW3 1
>>  COL2 OBJ 20
>>  COL2 ROW1 1  ROW2 1
>>  COL3 OBJ 20
>>  COL3 ROW2 1  ROW3 1
>>  COL4 OBJ 5
>>  COL4 ROW3 1
>>  COL5 OBJ 5
>>  COL5 ROW1 1
>>  COL6 OBJ 5
>>  COL6 ROW2 1
>>  INT1END 'MARKER' 'INTEND'
>> RHS
>>  RHS ROW1 1
>>  RHS ROW2 1
>>  RHS ROW3 1
>> ENDATA
>>
>> and my code is:
>>
>> ...
>>
>> model.setObjSense(-1);
>> model.branchAndBound();
>> //..................get dual solution................
>>
>> OsiSolverInterface * solver;
>>
>> if (preProcess) {
>>
>> process.postProcess(*model.solver());
>>
>> // Solution now back in solver1
>>
>> solver = & solver1;
>>
>> }
>>
>> else {
>>
>> solver = model.solver();
>>
>> }
>>
>> const double *dualSolution= solver->getRowPrice();
>> int numberRows=model.getNumRows();
>> int iRows;
>>
>> for(iRows=0;iRows<numberRows;iRows++){
>>     double value=dualSolution[iRows];
>>     std::cout<<value<<std::endl;
>>   }
>>
>> the result I got is (0,0,0).
>>
>> Thanks,
>>
>> Danh Hua
>>
>> _______________________________________________
>> Osi mailing list
>> Osi at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/osi
>>
>
>
> _______________________________________________
> Osi mailing list
> Osi at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/osi
>
>

--
Dr. Ted Ralphs
Associate Professor, Lehigh University (permanent)
Visiting Professor, University of Newcastle (current)
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted

Sent from Newcastle, Nsw, Australia

```