[Osi] row names ignored in OsiSolverInterface::writeLp

Stefan Vigerske stefan at math.hu-berlin.de
Sat Oct 8 10:30:52 EDT 2011


Hi,

> It didn't work either. I had already tried that one, but setObjName only
> sets an OsiSolverInterface attribute which is not used by writeLp :-( Maybe
> writeLp should use that attribute instead of getRowName(getNumRows(()) ?

Nope, it works for me.
The objective name attribute is added to the end of the rownames array 
that is assembled in OsiSolverInterface::writeLp and then passed to 
CoinLpIO.
There was a bug, but that was fixed on 30th of July, see CHANGELOG. That 
fix made it into Osi releases >= 0.105.1.

Stefan

>
> Thanks!
>
> Dani.
>
> On Sat, Oct 8, 2011 at 3:39 PM, Stefan Vigerske<stefan at math.hu-berlin.de>wrote:
>
>> Hi,
>>
>> does it work if you set the objective name via
>>   problem.setObjName ( "obj_func" );
>> ?
>>
>> The warning from CoinLpIO isn't that precise on it, I agree.
>>
>> Stefan
>>
>> Am 08.10.2011 10:38, schrieb Dani Pérez:
>>
>>> Hi,
>>>
>>> I think I came across an Osi bug or a non-documented behavior of
>>> OsiSolverInterface::writeLp.
>>>
>>> The problem arises when I set all rows and columns' names and I
>>> use setIntParam (OsiNameDiscipline,2). I get the following error in
>>> writeLp
>>> (with Osi compiled with --enable-debug):
>>>
>>> Coin3007W ### CoinLpIO::is_invalid_name(): Name is empty
>>> Coin3007W ### CoinLpIO::are_invalid_names(): Invalid name: vnames[1]:
>>> (null)
>>> Coin3007W ### CoinLpIO::**setLpDataRowAndColNames(): Invalid row names
>>> Use getPreviousNames() to get the old row names.
>>> Now using default row names.
>>>
>>>
>>> I've been debugging it a bit and it seems that writeLp expects the
>>> objective
>>> function name to be stored in the names vector at position getNumRows()
>>> (as
>>> stated in documentation<https://**projects.coin-or.org/Osi/**
>>> browser/trunk/Osi/src/Osi/**OsiSolverInterface.hpp?rev=**1811#L892<https://projects.coin-or.org/Osi/browser/trunk/Osi/src/Osi/OsiSolverInterface.hpp?rev=1811#L892>
>>>>
>>>
>>> indeed).
>>> Nevertheless, adding setRowName ( getNumRows(), "obj_func_name" ) won't
>>> fix
>>> it.
>>>
>>> The problem seems to be that setRowName will
>>> check<https://projects.coin-**or.org/Osi/browser/trunk/Osi/**src/OsiGlpk/
>>> **OsiGlpkSolverInterface.cpp?**rev=1811#L3417<https://projects.coin-or.org/Osi/browser/trunk/Osi/src/OsiGlpk/OsiGlpkSolverInterface.cpp?rev=1811#L3417>
>>>> if
>>>
>>> the index is greater or equal to getNumRows() and then silently
>>> return,
>>> in contradiction with the documentation. Is my understanding wrong? Is
>>> there
>>> another way to set the objective function name and get rid of the message?
>>> Did I hit a bug?
>>>
>>> Thanks,
>>>
>>> Dani.
>>>
>>> PS: I attach the code reproducing the problem with the compilation line on
>>> top of the file. I'm using Osi-0.105, a source release dating back to 21
>>> September 2011. The trunk code seems to behave similarly but I didn't
>>> check
>>> it. I'm using OsiGlpkSolverInterface (I didn't try other solvers)
>>>
>>>
>>>
>>>
>>> ______________________________**_________________
>>> Osi mailing list
>>> Osi at list.coin-or.org
>>> http://list.coin-or.org/**mailman/listinfo/osi<http://list.coin-or.org/mailman/listinfo/osi>
>>>
>>
>>
>




More information about the Osi mailing list