[CoinMp] New Patch for 1.4.0 CoinMP

Bjarni Kristjansson bjarni at maximalsoftware.com
Thu Oct 29 21:36:06 EDT 2009


Hi Stuart,

Here are the changes on the rest of the items I have implemented so far:

2) changes some solver options for better performance

I see from the previous emails you referred to, that Rod Frowd seems
to have suggested these new default values in February 2008.  Since
there have been lot of changes to CLP and CBC since then, I think we
should stay with the current defaults for now, unless he or someone
else can suggest some good reason to change them.


3) adds branch priorities

I added the code to LoadPriorities with minor changes.  If you use
them in your application, it would be good if you could confirm this
actually works before I go ahead an build a new zip file.


5) puts in an option for MaxSeconds

Added call to clp->setMaximumSeconds(COIN_REAL_MAXSECONDS) in coinSetClpOptions


7) outputs better status messages from cbc

Regarding the status code, according to the documentation in
CbcModel.hpp, the following status codes are returned from
cbc->status():

/** Secondary status of problem
        -1 unset (status_ will also be -1)
        0 search completed with solution
        1 linear relaxation not feasible (or worse than cutoff)
        2 stopped on gap
        3 stopped on nodes
        4 stopped on time
        5 stopped on user event
        6 stopped on solutions
        7 linear relaxation unbounded
    */

Please let me know, if for some cases the current cbc->status() call
in CoinMP code does not return these values correctly. If they do
return correctly, is there any particular status code that you think
is missing from CBC and we should add in CoinMP?

I will wait creating a new point release and zip file until sometime
this weekend or next week.  Please let me know if there are any more
changes or bugs that need to be fixed before I go ahead.

Best regards,

Bjarni



On Thu, Oct 29, 2009 at 7:00 PM, Stuart Mitchell
<s.mitchell at auckland.ac.nz> wrote:
> Thanks for your quick response (see below for comments)
>
> Bjarni Kristjansson wrote:
>>
>> Hi Stuart,
>>
>> I have some questions on the other 4 items or need to review them further:
>>
>> 2) changes some solver options for better performance
>>
>> COIN_INT_SCALING  set to 5 was 3
>> COIN_INT_PERTURBATION    set to 50 was 100
>> COIN_INT_PRIMALPIVOTALG  set to 4 was 1
>> COIN_INT_DUALPIVOTALG    set to 3 was 1
>>
>> Were these option changes based on different defaults in the CLP code
>> or rather based on testing different options that are giving better
>> performance on average?  Typically default values in CoinMP should
>> match the default values that John Forrest uses in his testing code
>> and only changed from those if there is a really good reason to.
>
> I would have thought that to but this patch was from this email to the
> mailing list (sorry I can't track it down). I'm not too attached to them
> unless someone on the list can speak up?
>
>> 3) adds branch priorities
>>
>> Need to review this bit further, but can probably go in soon.
>
> Thanks
>>
>> 5) puts in an option for MaxSeconds
>>
>> The existing COIN_REAL_MAXSECONDS option seems to be missing a
>> corresponding call in the CoinMP.  Could not see any new code for
>> MaxSeconds in the patch file.  Should be relatively easy to figure
>> out.
>
> I have only used it for COIN_REAL_MIPMAXSECONDS sorry if that was already in
> there I just remembered fiddling with it at the same time as MIPFRACGAP
>
>>
>> 7) outputs better status messages from cbc
>>
>> Need also to review this bit further.
>
> Yes this was the best I could come up with given that I could not find
> status messages for cbc. I think I got the numbers from CPLEX.
>>
>> There were also number of additions in the patch file to unitTest.cpp,
>> which I have not looked at yet.
>
> Adds tests to check the added functionality.
> Importantly also checks the status variables for infeasible problems
>
> Vinaka
> Stu
>
>>
>> Best regards and thanks for keeping track of all these requests.
>>
>> Bjarni
>>
>>
>>
>> On Wed, Oct 28, 2009 at 9:50 PM, Stuart Mitchell
>> <s.mitchell at auckland.ac.nz> wrote:
>>>
>>> It has taken me all morning but I have the patch file for this now
>>>
>>> This Patch takes contributions from Larry Taylor, Ron Frowd and Myself
>>> and
>>> 1) corrects the setting of some parameters that are real not ints
>>> 2) changes some solver options for better performance
>>> 3) adds branch priorities
>>> 4) fixes a bug with the msgcallback
>>> 5) puts in an option for MaxSeconds
>>> 6) puts in an option for FractionGap
>>> 7) outputs better status messages from cbc
>>> 8) is able to write MPS files for integer problems
>>>
>>> Can we PLEASE have this integrated with the code as I need it for pulp-or
>>> which is dependent on this solver.
>>>
>>> Stu
>>>
>>>
>>> Stuart Mitchell wrote:
>>>>
>>>> hey there is a version 1.4.0 that fixes this problem
>>>>
>>>> Finally!!!
>>>>
>>>> There are still the other issues that we identified.
>>>>
>>>> So I am building a patch for this as we speak
>>>>
>>>> Stu
>>>>
>>>>
>>>> Rod Frowd wrote:
>>>>>
>>>>> Ming:
>>>>>
>>>>> I posted this several years ago:
>>>>>
>>>>> "I have been running the CBC MIP repetitively from CoinMP.dll and it
>>>>> seems to be leaking memory and growing in size.
>>>>>
>>>>> I have added a delete of the cbc object into CoinMP.cpp as follows. It
>>>>> looks like this will also delete the cut generator objects created as
>>>>> its
>>>>> destructor includes deletion of the cut generators.
>>>>>
>>>>> SOLVAPI int CoinUnloadProblem(HPROB hProb)
>>>>> {
>>>>>  PCOIN pCoin = (PCOIN)hProb;
>>>>>    if (pCoin) {
>>>>>      delete pCoin->clp;
>>>>>      if (pCoin->RowLower) free(pCoin->RowLower);
>>>>>      if (pCoin->RowUpper) free(pCoin->RowUpper);
>>>>>      if (pCoin->IsInt) free(pCoin->IsInt);
>>>>>      delete pCoin->cbc;
>>>>>      pCoin->cbc = NULL;
>>>>>  }
>>>>>  free(pCoin);
>>>>>  pCoin = NULL;
>>>>>  return SOLV_SUCCESS;
>>>>> }
>>>>>
>>>>> "
>>>>>
>>>>> And I think Stuart Mitchell from NZ also raised a ticket about this.
>>>>>
>>>>> Rod
>>>>>
>>>>> ming lu wrote:
>>>>>>>
>>>>>>> Hi All,
>>>>>>>
>>>>>>> It looks that CoinUnloadProblem doesn't release resource correctly.
>>>>>>> The cbc was not released, this causes a huge memory leak problem.
>>>>>>> Also
>>>>>>> following members are not explicitly released:
>>>>>>>
>>>>>>>                              ClpSolve *clp_presolve;
>>>>>>>                              OsiClpSolverInterface *osi;
>>>>>>>                              CBMessageHandler *msghandler;
>>>>>>>                              CBIterHandler *iterhandler;
>>>>>>>                              CBNodeHandler *nodehandler;
>>>>>>>
>>>>>>>                              CglProbing *probing;
>>>>>>>                              CglGomory *gomory;
>>>>>>>                              CglKnapsackCover *knapsack;
>>>>>>>                              CglOddHole *oddhole;
>>>>>>>                              CglClique *clique;
>>>>>>>                              CglLiftAndProject *liftpro;
>>>>>>>                              CglSimpleRounding *rounding;
>>>>>>>
>>>>>>> Could someone take a look?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Ming
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> CoinMp mailing list
>>>>>> CoinMp at list.coin-or.org
>>>>>> http://list.coin-or.org/mailman/listinfo/coinmp
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> CoinMp mailing list
>>>>> CoinMp at list.coin-or.org
>>>>> http://list.coin-or.org/mailman/listinfo/coinmp
>>>
>>> --
>>> ___________________________________
>>> Dr Stuart Mitchell
>>> Research Fellow
>>> Light Metals Research Centre (LMRC)
>>> University of Auckland
>>> Private Bag 92019
>>> Auckland
>>> New Zealand
>>>
>>> Ph (wk)  +64 9 3737599 ext 84867
>>>  (ddi) +64 9 9234867
>>>  (fax) +64 9 3737925
>>>  (mb)  +64 21 441331
>>> ___________________________________
>>>
>>>
>>>
>>> ---------- Forwarded message ----------
>>> From: "Larry A. Taylor" <ltaylor at seas.ucla.edu>
>>> To: Rod Frowd <rod at frowd.net>, coinmp at list.coin-or.org
>>> Date: Mon, 18 Feb 2008 16:39:46 -0800
>>> Subject: Re: [CoinMp] CoinMP.dll errors
>>> See Ticket #1 for this project:
>>> https://projects.coin-or.org/CoinMP/ticket/1
>>>
>>> LAT
>>>
>>> At 01:33 AM 2/18/2008, Rod Frowd wrote:
>>>>
>>>> I found that the CoinMP.dll did not work when built from source, though
>>>> the downloaded binary dll did. It was giving primal infeasible
>>>> errors, when the problem was feasible,
>>>>
>>>> Upon looking  at the source code I found the problem below, some of the
>>>> real tolerances were being set to zero as the CoinGetIntOption was being
>>>> called instead of the CoinGetRealOption? The built from source dll works
>>>> after this change.
>>>>
>>>> Index: CoinMP.cpp
>>>> ===================================================================
>>>> --- CoinMP.cpp    (revision 53)
>>>> +++ CoinMP.cpp    (working copy)
>>>> @@ -646,10 +646,10 @@
>>>>
>>>>    pCoin->clp->setMaximumIterations(CoinGetIntOption(hProb,
>>>> COIN_INT_MAXITER));
>>>>
>>>> -    pCoin->clp->setPrimalObjectiveLimit(CoinGetIntOption(hProb,
>>>> COIN_REAL_PRIMALOBJLIM));
>>>> -    pCoin->clp->setDualObjectiveLimit(CoinGetIntOption(hProb,
>>>> COIN_REAL_DUALOBJLIM));
>>>> -    pCoin->clp->setPrimalTolerance(CoinGetIntOption(hProb,
>>>> COIN_REAL_PRIMALOBJTOL));
>>>> -    pCoin->clp->setDualTolerance(CoinGetIntOption(hProb,
>>>> COIN_REAL_DUALOBJTOL));
>>>> +    pCoin->clp->setPrimalObjectiveLimit(CoinGetRealOption(hProb,
>>>> COIN_REAL_PRIMALOBJLIM));
>>>> +    pCoin->clp->setDualObjectiveLimit(CoinGetRealOption(hProb,
>>>> COIN_REAL_DUALOBJLIM));
>>>> +    pCoin->clp->setPrimalTolerance(CoinGetRealOption(hProb,
>>>> COIN_REAL_PRIMALOBJTOL));
>>>> +    pCoin->clp->setDualTolerance(CoinGetRealOption(hProb,
>>>> COIN_REAL_DUALOBJTOL));
>>>>
>>>>    /* check if it has been changed, leave alone otherwise */
>>>>   ClpPrimalColumnSteepest primalSteepest(CoinGetIntOption(hProb,
>>>> COIN_INT_PRIMALPIVOTALG));
>>>> @@ -659,7 +659,7 @@
>>>>   pCoin->clp->setDualRowPivotAlgorithm(dualSteepest);
>>>>
>>>>    if (CoinGetIntOption(hProb, COIN_INT_CRASHIND)) {
>>>> -        pCoin->clp->crash(CoinGetIntOption(hProb, COIN_REAL_CRASHGAP),
>>>> +        pCoin->clp->crash(CoinGetRealOption(hProb, COIN_REAL_CRASHGAP),
>>>>                                CoinGetIntOption(hProb,
>>>> COIN_INT_CRASHPIVOT));
>>>>    }
>>>>    switch (CoinGetIntOption(hProb,COIN_INT_SOLVEMETHOD)) {
>>>>
>>>>
>>>>
>>>> Another issue I found is that the default options were not set the same
>>>> as in the CLP executable, making CoinMP.dll a lot slower. I was able to
>>>> speed it up by a factor of 3 with the following parameter changes:
>>>>
>>>> COIN_INT_SCALING  set to 5 was 3
>>>> COIN_INT_PERTURBATION    set to 50 was 100
>>>> COIN_INT_PRIMALPIVOTALG  set to 4 was 1
>>>> COIN_INT_DUALPIVOTALG    set to 3 was 1
>>>>
>>>>
>>>> Rod Frowd
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> CoinMp mailing list
>>>> CoinMp at list.coin-or.org
>>>> http://list.coin-or.org/mailman/listinfo/coinmp
>>>
>>> _______________________________________________
>>> CoinMp mailing list
>>> CoinMp at list.coin-or.org
>>> http://list.coin-or.org/mailman/listinfo/coinmp
>>>
>>>
>>> ---------- Forwarded message ----------
>>> From: Rod Frowd <rod at frowd.net>
>>> To: coinmp at list.coin-or.org
>>> Date: Mon, 18 Feb 2008 19:33:51 +1000
>>> Subject: [CoinMp] CoinMP.dll errors
>>> I found that the CoinMP.dll did not work when built from source, though
>>> the downloaded binary dll did. It was giving primal infeasible errors,
>>> when
>>> the problem was feasible,
>>>
>>> Upon looking  at the source code I found the problem below, some of the
>>> real tolerances were being set to zero as the CoinGetIntOption was being
>>> called instead of the CoinGetRealOption? The built from source dll works
>>> after this change.
>>>
>>> Index: CoinMP.cpp
>>> ===================================================================
>>> --- CoinMP.cpp    (revision 53)
>>> +++ CoinMP.cpp    (working copy)
>>> @@ -646,10 +646,10 @@
>>>
>>>   pCoin->clp->setMaximumIterations(CoinGetIntOption(hProb,
>>> COIN_INT_MAXITER));
>>>
>>> -    pCoin->clp->setPrimalObjectiveLimit(CoinGetIntOption(hProb,
>>> COIN_REAL_PRIMALOBJLIM));
>>> -    pCoin->clp->setDualObjectiveLimit(CoinGetIntOption(hProb,
>>> COIN_REAL_DUALOBJLIM));
>>> -    pCoin->clp->setPrimalTolerance(CoinGetIntOption(hProb,
>>> COIN_REAL_PRIMALOBJTOL));
>>> -    pCoin->clp->setDualTolerance(CoinGetIntOption(hProb,
>>> COIN_REAL_DUALOBJTOL));
>>> +    pCoin->clp->setPrimalObjectiveLimit(CoinGetRealOption(hProb,
>>> COIN_REAL_PRIMALOBJLIM));
>>> +    pCoin->clp->setDualObjectiveLimit(CoinGetRealOption(hProb,
>>> COIN_REAL_DUALOBJLIM));
>>> +    pCoin->clp->setPrimalTolerance(CoinGetRealOption(hProb,
>>> COIN_REAL_PRIMALOBJTOL));
>>> +    pCoin->clp->setDualTolerance(CoinGetRealOption(hProb,
>>> COIN_REAL_DUALOBJTOL));
>>>
>>>   /* check if it has been changed, leave alone otherwise */
>>>  ClpPrimalColumnSteepest primalSteepest(CoinGetIntOption(hProb,
>>> COIN_INT_PRIMALPIVOTALG));
>>> @@ -659,7 +659,7 @@
>>>  pCoin->clp->setDualRowPivotAlgorithm(dualSteepest);
>>>
>>>   if (CoinGetIntOption(hProb, COIN_INT_CRASHIND)) {
>>> -        pCoin->clp->crash(CoinGetIntOption(hProb, COIN_REAL_CRASHGAP),
>>> +        pCoin->clp->crash(CoinGetRealOption(hProb, COIN_REAL_CRASHGAP),
>>>                               CoinGetIntOption(hProb,
>>> COIN_INT_CRASHPIVOT));
>>>   }
>>>   switch (CoinGetIntOption(hProb,COIN_INT_SOLVEMETHOD)) {
>>>
>>>
>>>
>>> Another issue I found is that the default options were not set the same
>>> as in the CLP executable, making CoinMP.dll a lot slower. I was able to
>>> speed it up by a factor of 3 with the following parameter changes:
>>>
>>> COIN_INT_SCALING  set to 5 was 3
>>> COIN_INT_PERTURBATION    set to 50 was 100
>>> COIN_INT_PRIMALPIVOTALG  set to 4 was 1
>>> COIN_INT_DUALPIVOTALG    set to 3 was 1
>>>
>>>
>>> Rod Frowd
>>>
>>>
>>> _______________________________________________
>>> CoinMp mailing list
>>> CoinMp at list.coin-or.org
>>> http://list.coin-or.org/mailman/listinfo/coinmp
>>>
>>>
>
> --
> ___________________________________
> Dr Stuart Mitchell
> Research Fellow
> Light Metals Research Centre (LMRC)
> University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
>
> Ph (wk)  +64 9 3737599 ext 84867
>   (ddi) +64 9 9234867
>   (fax) +64 9 3737925
>   (mb)  +64 21 441331
> ___________________________________
>
>




More information about the CoinMp mailing list