[Cbc] reading SOS item from CPLEX LP files

Kish Shen kish.shen at gmail.com
Mon Feb 19 12:54:52 EST 2018


John,

Thanks for your reply.

There is some complications. Firstly, I have actually been using version
2.8 of Cbc that I built nearly 2 years ago. Although I did download and
build Cbc 2.9, I forgot to change a symbolic link that still pointed to
2.8, and was linking agaist that rather than 2.9.

The bigger problem is that once I correctly linked against Cbc 2.9, I get
seg faults when adding even the simplest SOS to the CbcModel.

As you may remember, we don't directly write our programs in C++ to call
Cbc, but rather the program is written in ECLiPSe, and we provide an
interface which makes the call to Cbc's API. The call that is seg faulting
is:


    CbcModel* model = new CbcModel(static_cast<OsiSolverInterface
&>(*lpd->lp->S
    ....
      model->addObjects(lpd->lp->nsos, &(lpd->lp->mipobjects[0]));

mipobjects is defined as vector<CbcObjects*>, and has been filled with the
SOS information before the addObjects call.

I am trying to generate the standalone C/C++ code from the calls that our
interface makes, but I am having some trouble getting it compiled - I have
not done this for Cbc in serveral years, and our code has undergone major
revisions since.

>I am always interested in why Cbc is not doing well with SOS - if you feel
you can send me the file, I can look at why it is taking so long.

The program that does this is a commercial program, and I need to check if
I can send you the LP/MPS problem.

Cheers,

Kish


On Mon, Feb 19, 2018 at 4:36 PM, John Forrest <john.forrest at fastercoin.com>
wrote:

> Kish,
>
> In trunk stand-alone cbc does seem to write SOS information - I think I
> did something a few months ago to make it do that - but I can't remember
> what it was!
>
> I am always interested in why Cbc is not doing well with SOS - if you feel
> you can send me the file, I can look at why it is taking so long.
>
> John
> On 19/02/18 15:36, Kish Shen wrote:
>
> John,
>
> Many thanks for your fix. I have downloaded abd copied the CoinLpIO files
> as you suggested, and it does seem to work with the LP file -- I had to
> reintroduce the spaces, as I had edited the file to remove the spaces so
> that Cbc can read the file.
>
> On a somewhat related topic, I think the SOS information is not included
> in a LP or MPS formatted file written by Cbc (I assume via CoinUtils
> again). Is there anyway to include them, or is that not currently supported?
>
> This was in fact the reason I was reading a LP file written by CPLEX, as
> the file written by Cbc did not include the SOS information. I was trying
> to compare a problem that CPLEX solved much faster than Cbc - under 10
> seconds compared to something like 30,000 seconds for Cbc.
>
> Thanks again!
>
> Kish
>
>
> On Sun, Feb 18, 2018 at 7:40 PM, John Forrest <john.forrest at fastercoin.com
> > wrote:
>
>> Kish,
>>
>> This was more difficult to fix than I expected.  The coding for readLp
>> uses fscanf("%s") which is totally dependent on space as a separator.
>>
>> I think I have fixed in trunk (you can just copy over CoinLpIO.?pp to
>> stable.  I have tried it on all the .lp files I have - which is not that
>> many.  Some files had lines with more than 100K characters which caused
>> some problems.
>>
>> Please can people check I have not introduced any bugs.  Also if you want
>> any other cosmetic changes - now is the time to ask for them.
>>
>> John Forrest
>>
>> On 16/02/18 11:51, Kish Shen wrote:
>>
>> Hi,
>>
>> I posted about this to coin-discuss mailing list yesterday, but it has
>> not appear there, and there seems to be no messages for the list since Sept
>> 2017, so I am posting this here as well, in case something is wrong with
>> the coin-discuss mailing list.
>>
>> I am getting errors from Cbc when reading an LP format file generated by
>> CPLEX 12:
>>
>> ### CoinLpIO::readLp(): bad SOS item S1
>>
>> I assume this is from reading the SOS items in the LP file like:
>>
>>  s999:  S1 ::  x1154 : 1  x5539 : 2
>>
>> Looking at CoinLpIO.cpp, the code expects no space between S1 and ::
>>
>>             if (next>=buff&&(!strncmp(next,"S
>> 1::",4)||!strncmp(next,"S2::",4))) {
>>               setType = next[1]-'0';
>>               gotStart=true;
>>             } else {
>>               // error
>>               goodLine=0;
>>             }
>>
>> I edited the LP file and changed all the 'S1 ::' to 'S1::', and I then
>> got errors about x1154: repeatedly.
>> So it looks like the error handling does not advance to the next line
>> after finding an error.
>>
>> I edited removed all the spaces before ':' for the SOS items, and the
>> file was then read without errors.
>>
>> Should ReadLp be changed to read the SOS items generated by CPLEX with
>> the extra spaces?
>>
>> I am running the latest stable branch of Cbc 2.9, downloaded via svn co
>> about 2 days ago.
>>
>> Thanks and cheers,
>>
>> Kish
>>
>>
>>
>> _______________________________________________
>> Cbc mailing listCbc at list.coin-or.orghttps://list.coin-or.org/mailman/listinfo/cbc <https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwMDaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=hUwLPdHoUFhiZJnIH9lsq5WI66yqeNZGH_bh0U52-6Y&m=PTVwK7gCQ94nEgK5tqlJ5itu74UVQngOuy0Y4Nocyv0&s=v8v1KeZXn8bgawzs5cud59QfTf6HUrYGnA3_Bc0lyGM&e=>
>>
>>
>>
>> _______________________________________________
>> Cbc mailing list
>> Cbc at list.coin-or.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.co
>> in-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-ta5yRYsqeUs
>> EDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=hUwLPdHoUFhiZJnIH9lsq5WI66yq
>> eNZGH_bh0U52-6Y&m=PTVwK7gCQ94nEgK5tqlJ5itu74UVQngOuy0Y4Nocyv
>> 0&s=v8v1KeZXn8bgawzs5cud59QfTf6HUrYGnA3_Bc0lyGM&e=
>>
>>
>
>
> _______________________________________________
> Cbc mailing listCbc at list.coin-or.orghttps://list.coin-or.org/mailman/listinfo/cbc <https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwMDaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=hUwLPdHoUFhiZJnIH9lsq5WI66yqeNZGH_bh0U52-6Y&m=TslMSZNCcK2uXDEYYQND8SK3sZBd2LD4hr88cXsTii8&s=AXJUFPQIZ3uCackr6PZukKAdWeWIuUr4-itO76DQXJk&e=>
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.
> coin-2Dor.org_mailman_listinfo_cbc&d=DwICAg&c=Ngd-
> ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=hUwLPdHoUFhiZJnIH9lsq5WI66yqeN
> ZGH_bh0U52-6Y&m=TslMSZNCcK2uXDEYYQND8SK3sZBd2LD4hr88cXsTii8&s=
> AXJUFPQIZ3uCackr6PZukKAdWeWIuUr4-itO76DQXJk&e=
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20180219/8521aa81/attachment.html>


More information about the Cbc mailing list