From rod at frowd.net Wed Feb 1 00:08:01 2012 From: rod at frowd.net (Rod Frowd) Date: Wed, 01 Feb 2012 15:08:01 +1000 Subject: [Cbc] CoinMP cbc memory leak? Message-ID: <4F28C8B1.7070502@frowd.net> Hi I have been running CoinMP under valgrind and it is picking up a memory leak: ==9402== 9,028 (1,920 direct, 7,108 indirect) bytes in 2 blocks are definitely lost in loss record 40 of 40 ==9402== at 0x4C28B35: operator new(unsigned long) (vg_replace_malloc.c:261) ==9402== by 0x4E3A321: CbcCreateSolverObject() (in /usr/local/lib/libCoinMP.so.0) ==9402== by 0x4E3CA55: CbcOptimizeProblem (in /usr/local/lib/libCoinMP.so.0) I looked at the code and for some reason the delete of the osi object has been commented out in the free routine: HCBC CbcCreateSolverObject(void) { PCBC pCbc; pCbc = (PCBC)malloc(sizeof(CBCINFO)); if (!pCbc) { return NULL; } memset(pCbc, 0, sizeof(CBCINFO)); pCbc->clp = new ClpSimplex(); pCbc->clp_presolve = new ClpSolve(); pCbc->osi = new OsiClpSolverInterface(pCbc->clp); pCbc->cbc = NULL; /* ERRORFIX 2/22/05: Crashes if not NULL when trying to set message handler */ pCbc->msghandler = NULL; pCbc->iterhandler = NULL; pCbc->nodehandler = NULL; return (HCBC)pCbc; } void CbcClearSolverObject(HCBC hCbc) { PCBC pCbc = (PCBC)hCbc; if (!pCbc) { return; } if (pCbc->clp) delete pCbc->clp; if (pCbc->clp_presolve) delete pCbc->clp_presolve; //if (pCbc->osi) delete pCbc->osi; if (pCbc->cbc) delete pCbc->cbc; if (pCbc->msghandler) delete pCbc->msghandler; if (pCbc->iterhandler) delete pCbc->iterhandler; if (pCbc->nodehandler) delete pCbc->nodehandler; free(pCbc); } Does anyone know why this was commented out? It is not a big memory leak, but I am going to be doing thousands of MonteCarlo iterations and I need this to run tight and clean. Rod Frowd From haroldo.santos at gmail.com Wed Feb 8 08:40:00 2012 From: haroldo.santos at gmail.com (Haroldo Gambini Santos) Date: Wed, 08 Feb 2012 11:40:00 -0200 Subject: [Cbc] ZeroHalf cuts Message-ID: <4F327B30.8080505@gmail.com> Hi, In CBC there are some includes (which can be conditionally compiled) for ZeroHalf cuts. #include "CglZeroHalf.hpp" Since for my problem these cuts would be very useful, I checked CglTrunk and CBC trunk searching for this code but didn't find it. Will this code be included in CBC/Cgl ? Cheers, Haroldo -- ============================================================= Haroldo Gambini Santos Computing Department - Universidade Federal de Ouro Preto - UFOP email: haroldo [at ] iceb.ufop.br home/research page: www.decom.ufop.br/haroldo/ From dibarra21 at hotmail.com Wed Feb 15 14:25:25 2012 From: dibarra21 at hotmail.com (=?iso-8859-1?B?RGF2aWQgSWJhcnJhIEfzbWV6IChkZWwgTW9udGUp?=) Date: Wed, 15 Feb 2012 20:25:25 +0100 Subject: [Cbc] Parallel CBC Message-ID: Hello, I did tests using CBC (Cbc-2.7.5) and openMP to solve several problems (scenarios) in parallel. I did it using both windows (Visual Studio 2010) and Linux and it was possible because of the great "recipes" that you give in your page, thank you for that. And It works properly but I found something odd with the internal CBC timer. I measured the time taken by solving N problems with M Cores (threads) with time.h routines, everithing it's nice when I use one core (or thread) but gets strange if M>1, look the table: M=N time.h CBC intenal timers---------------------------------1 57s 54s2 61s 110.79s,112.92s (two problems in parallel)3 61s 166s,172s,173s4 62s 273s,239s,239s,240s5 91s 324s, ..., 369s...7 129s 763.1s,771s, ..., 798s Is It CBC time "correct"? What's the meaning? Why is It happening like that? regards David Ibarra -------------- next part -------------- An HTML attachment was scrubbed... URL: From satish.amirisetti at gmail.com Tue Feb 21 03:50:27 2012 From: satish.amirisetti at gmail.com (satish amirisetti) Date: Tue, 21 Feb 2012 14:20:27 +0530 Subject: [Cbc] Multiple Optimal Solutions Message-ID: Hi all, I am using pyomo with Cbc as solver to solve a problem for which i have multiple optimal solutions. How can I get all the solutions available from Cbc solution pool. Please help me. Thanks, Satish -------------- next part -------------- An HTML attachment was scrubbed... URL: From haroldo.santos at gmail.com Tue Feb 21 08:39:21 2012 From: haroldo.santos at gmail.com (Haroldo Gambini Santos) Date: Tue, 21 Feb 2012 11:39:21 -0200 Subject: [Cbc] Multiple Optimal Solutions In-Reply-To: References: Message-ID: <4F439E89.8030000@gmail.com> Hi Satish, Please note that CBC will exit as soon as the lower bound reaches the upper bound - unless you "slowdown" this event (disabling all cuts?) CBC will not find *all* optimal solutions. That said, you can configure how many solutions will be saved and access then (in C++) using: bool CbcModel::setMaximumSolutions(int value) const double* CbcModel::savedSolution(int which) const Cheers, Haroldo On 21-02-2012 06:50, satish amirisetti wrote: > Hi all, > I am using pyomo with Cbc as solver to solve a problem > for which i have multiple optimal solutions. How can I get all the > solutions available from Cbc solution pool. Please help me. > > > Thanks, > Satish > > > > _______________________________________________ > Cbc mailing list > Cbc at list.coin-or.org > http://list.coin-or.org/mailman/listinfo/cbc -- ============================================================= Haroldo Gambini Santos Computing Department - Universidade Federal de Ouro Preto - UFOP email: haroldo [at ] iceb.ufop.br haroldo.santos [at] gmail.com home/research page: www.decom.ufop.br/haroldo/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From grun at cs.sfu.ca Mon Feb 27 00:14:05 2012 From: grun at cs.sfu.ca (Gabrielle A. Grun) Date: Sun, 26 Feb 2012 21:14:05 -0800 Subject: [Cbc] Multiple Optimal Solutions In-Reply-To: <4F439E89.8030000@gmail.com> References: <4F439E89.8030000@gmail.com> Message-ID: <7DEC886E523043769915E7629525ADA1@grunPC> Hi Haroldo, As far as I am concerned, setting the maximum number of solutions only sets a halting condition for Cbc to terminate when the maximum count is reached even if optimality is not reached. One can also stop on a time limit, a gap, maximum node count etc. It seems that none of the savedSolutions_ may be optimal (if optimality is not reached). It is an array of integer solution that includes the best solution. If things work "normally", one of these solutions is optimal.[?] Code modifications are needed to find multiple optimal answers. class CbcModel { public: enum CbcIntParam { /** The maximum number of nodes before terminating */ CbcMaxNumNode = 0, /** The maximum number of solutions before terminating */ CbcMaxNumSol, /** Fathoming discipline .... The snippets of code are all from CbcModel.hpp [trunk version[. /** Set the \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink desired. */ inline bool setMaximumSolutions( int value) { return setIntParam(CbcMaxNumSol, value); } ......... /// Set number of solutions (so heuristics will be different) inline void setSolutionCount(int value) { numberSolutions_ = value; } /// Number of saved solutions (including best) int numberSavedSolutions() const; /// Maximum number of extra saved solutions inline int maximumSavedSolutions() const { return maximumSavedSolutions_; } /// Set maximum number of extra saved solutions void setMaximumSavedSolutions(int value); /// Return a saved solution (0==best) - NULL if off end const double * savedSolution(int which) const; /// Return a saved solution objective (0==best) - COIN_DBL_MAX if off end double savedSolutionObjective(int which) const; .......... /// Array holding the incumbent (best) solution. double * bestSolution_; /// Arrays holding other solutions. double ** savedSolutions_; Thanks. Gabrielle ----- Original Message ----- From: Haroldo Gambini Santos To: cbc at list.coin-or.org Sent: Tuesday, February 21, 2012 5:39 AM Subject: Re: [Cbc] Multiple Optimal Solutions Hi Satish, Please note that CBC will exit as soon as the lower bound reaches the upper bound - unless you "slowdown" this event (disabling all cuts?) CBC will not find *all* optimal solutions. That said, you can configure how many solutions will be saved and access then (in C++) using: bool CbcModel::setMaximumSolutions(int value) const double* CbcModel::savedSolution(int which) const Cheers, Haroldo On 21-02-2012 06:50, satish amirisetti wrote: Hi all, I am using pyomo with Cbc as solver to solve a problem for which i have multiple optimal solutions. How can I get all the solutions available from Cbc solution pool. Please help me. Thanks, Satish _______________________________________________ Cbc mailing list Cbc at list.coin-or.org http://list.coin-or.org/mailman/listinfo/cbc -- ============================================================= Haroldo Gambini Santos Computing Department - Universidade Federal de Ouro Preto - UFOP email: haroldo [at ] iceb.ufop.br haroldo.santos [at] gmail.com home/research page: www.decom.ufop.br/haroldo/ _______________________________________________ Cbc mailing list Cbc at list.coin-or.org http://list.coin-or.org/mailman/listinfo/cbc From acw at ascent.com Mon Feb 27 14:13:54 2012 From: acw at ascent.com (acw at ascent.com) Date: Mon, 27 Feb 2012 14:13:54 -0500 Subject: [Cbc] Logging intermediate solutions Message-ID: Is there a command-line option to make the standard Cbc executable log intermediate solutions as they are found? Using default settings, the _fact_ that a solution has been found is logged, but we would like it to log the solution itself (printing the values of all nonzero variables). The reason we want this is that we have a different sort of solver running in parallel with Cbc, and we would like to be able to feed it "hints" as the solution process proceeds. Our solution so far has been to actually modify the Cbc main driver loop, in the source, to log store each solution as it is found. But it is risky and inconvenient having to repeat this source-surgery every time a new and improved version of Cbc appears. It would be a stabler solution to just interact with Cbc through the command-line interface. -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.forrest at fastercoin.com Tue Feb 28 04:05:32 2012 From: john.forrest at fastercoin.com (John Forrest) Date: Tue, 28 Feb 2012 09:05:32 +0000 Subject: [Cbc] Logging intermediate solutions In-Reply-To: References: Message-ID: <4F4C98DC.5030207@fastercoin.com> Probably easiest to use Cbc/examples/driver4.cpp which acts like the standard executable. If you look for ::event, you will see that that prints solution every time. As it is, it has a drawback if preprocessing has been done. driver4.cpp prints variables in preprocessed model. To fix that you need to use originalColumns() from the CglPreProcess object which did preprocessing. Normally this will be the global variable cbcPreProcessPointer. John Forrest On 27/02/12 19:13, acw at ascent.com wrote: > Is there a command-line option to make the standard Cbc executable log > intermediate solutions as they are found? Using default settings, the > _fact_ that a solution has been found is logged, but we would like it > to log the solution itself (printing the values of all nonzero > variables). > > The reason we want this is that we have a different sort of solver > running in parallel with Cbc, and we would like to be able to feed it > "hints" as the solution process proceeds. > > Our solution so far has been to actually modify the Cbc main driver > loop, in the source, to log store each solution as it is found. But > it is risky and inconvenient having to repeat this source-surgery > every time a new and improved version of Cbc appears. It would be a > stabler solution to just interact with Cbc through the command-line > interface. > > > _______________________________________________ > Cbc mailing list > Cbc at list.coin-or.org > http://list.coin-or.org/mailman/listinfo/cbc -------------- next part -------------- An HTML attachment was scrubbed... URL: From haroldo.santos at gmail.com Tue Feb 28 10:17:24 2012 From: haroldo.santos at gmail.com (Haroldo Santos) Date: Tue, 28 Feb 2012 12:17:24 -0300 Subject: [Cbc] Multiple Optimal Solutions In-Reply-To: <7DEC886E523043769915E7629525ADA1@grunPC> References: <4F439E89.8030000@gmail.com> <7DEC886E523043769915E7629525ADA1@grunPC> Message-ID: Hi Gabrielle, On Mon, Feb 27, 2012 at 2:14 AM, Gabrielle A. Grun wrote: > > > > Hi Haroldo, > > As far as I am concerned, setting the maximum number of solutions only > sets a halting condition for Cbc to terminate when the maximum count is > reached even if optimality is not reached. One can also stop on a time > limit, a gap, maximum node count etc. > Thanks for clarifying it. I never used this option. > > It seems that none of the savedSolutions_ may be optimal (if optimality is > not reached). It is an array of integer solution that includes the best solution. If > things work "normally", one of these solutions is optimal.[?] > Yes, there is no guarantee, it is more likely that only intermediate, sub-optimal solutions are saved and finally (if optimallity was reached), one or more optimal solutions (more if the dual bounds were bad, making it hard to prune nodes) > > Code modifications are needed to find multiple optimal answers. > > Thanks. > > > class CbcModel { > > public: > > enum CbcIntParam { > /** The maximum number of nodes before terminating */ > CbcMaxNumNode = 0, > /** The maximum number of solutions before terminating */ > CbcMaxNumSol, > /** Fathoming discipline > > .... > > The snippets of code are all from CbcModel.hpp [trunk version[. > /** Set the > \link CbcModel::CbcMaxNumSol maximum number of solutions \endlink > desired. > */ > inline bool setMaximumSolutions( int value) { > return setIntParam(CbcMaxNumSol, value); > } > > > ......... > > > /// Set number of solutions (so heuristics will be different) > inline void setSolutionCount(int value) { > numberSolutions_ = value; > } > /// Number of saved solutions (including best) > int numberSavedSolutions() const; > /// Maximum number of extra saved solutions > inline int maximumSavedSolutions() const { > return maximumSavedSolutions_; > } > /// Set maximum number of extra saved solutions > void setMaximumSavedSolutions(int value); > /// Return a saved solution (0==best) - NULL if off end > const double * savedSolution(int which) const; > /// Return a saved solution objective (0==best) - COIN_DBL_MAX if off end > double savedSolutionObjective(int which) const; > > > > > .......... > > /// Array holding the incumbent (best) solution. > double * bestSolution_; > /// Arrays holding other solutions. > double ** savedSolutions_; > > Thanks. > > > Gabrielle > ----- Original Message ----- From: Haroldo Gambini Santos > To: cbc at list.coin-or.org > Sent: Tuesday, February 21, 2012 5:39 AM > Subject: Re: [Cbc] Multiple Optimal Solutions > > > > Hi Satish, > > Please note that CBC will exit as soon as the lower bound reaches the > upper bound - unless you "slowdown" this event (disabling all cuts?) CBC > will not find *all* optimal solutions. That said, you can configure how > many solutions will be saved and access then (in C++) using: > > bool CbcModel::setMaximumSolutions(**int value) > const double* CbcModel::savedSolution(int which) const > > Cheers, > > Haroldo > > On 21-02-2012 06:50, satish amirisetti wrote: > Hi all, > I am using pyomo with Cbc as solver to solve a problem for which i have > multiple optimal solutions. How can I get all the solutions available from > Cbc solution pool. Please help me. > > > Thanks, > Satish > > > > > ______________________________**_________________ > Cbc mailing list > Cbc at list.coin-or.org > http://list.coin-or.org/**mailman/listinfo/cbc > > > > > -- > ==============================**==============================**= > Haroldo Gambini Santos > Computing Department - Universidade Federal de Ouro Preto - UFOP > email: haroldo [at ] iceb.ufop.br > haroldo.santos [at] gmail.com > home/research page: www.decom.ufop.br/haroldo/ > > > > > > ______________________________**_________________ > Cbc mailing list > Cbc at list.coin-or.org > http://list.coin-or.org/**mailman/listinfo/cbc > -- ============================================================= Haroldo Gambini Santos Computing Department - Universidade Federal de Ouro Preto - UFOP email: haroldo [at ] iceb.ufop.br home/research page: www.decom.ufop.br/haroldo/ "Computer science is no more about computers than astronomy is about telescopes." Edsger Dijkstra -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.forrest at fastercoin.com Wed Feb 29 03:55:45 2012 From: john.forrest at fastercoin.com (John Forrest) Date: Wed, 29 Feb 2012 08:55:45 +0000 Subject: [Cbc] Multiple Optimal Solutions In-Reply-To: References: <4F439E89.8030000@gmail.com> <7DEC886E523043769915E7629525ADA1@grunPC> Message-ID: <4F4DE811.6000502@fastercoin.com> Seeing the discussion of multiple solutions, I have made a few changes to Cbc/trunk. I have modified Cbc/examples/driver4.cpp to show how you can print solutions to preprocessed problem. This example can be used in Cbc/stable, but then user has to know if they are doing preprocessing as the test may not be correct. The values of the variables which are still in the problem are printed correctly with the correct sequence number (or name). The values of variables which were preprocessed out are not printed. If the change below to Cbc is satisfactory then, at greater computational expense, the complete solution could be printed. Cbc trunk has been altered so that postprocessing can be done several times on different solutions. As Cbc trunk normally uses Cgl/stable and as stable code should not be modified too much, I have had to temporarily make it a conditional compile. So add -DKEEP_POSTPROCESS to CXXDEFS in configure. When Cgl/trunk migrates to stable, this will not be necessary. Multiple solutions can now be printed or printed to file from the executable. There is a new integer parameter maxSolutions and a new command nextB(estsolution) which acts like "solution", but works on the second best solution and then moves all others up. The best solution is never touched. So - cbc ...... -solve -solution best.sol -nextbest 2.sol -nextbest 3.sol -solution best2.sol would put the best solution to best.sol and best2.sol while the second best goes to 2.sol and the third best to 3.sol. There is no action if no solution. This was all a quick fix - I hope it helps. John Forrest