[Cbc] Multiple Optimal Solutions
Gabrielle A. Grun
grun at cs.sfu.ca
Mon Feb 27 00:14:05 EST 2012
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
More information about the Cbc
mailing list