# CbcSerendipity Class Reference

heuristic - just picks up any good solution found by solver - see OsiBabSolver More...

`#include <CbcHeuristic.hpp>`

Inheritance diagram for CbcSerendipity:
[legend]
Collaboration diagram for CbcSerendipity:
[legend]

List of all members.

## Public Member Functions
| CbcSerendipity ()
| CbcSerendipity (CbcModel &model)
| CbcSerendipity (const CbcSerendipity &)
| ~CbcSerendipity ()
CbcSerendipity & | operator= (const CbcSerendipity &rhs)
| Assignment operator.
virtual CbcHeuristic * | clone () const
| Clone.
virtual void | generateCpp (FILE *fp)
| Create C++ lines to get to current state.
virtual void | setModel (CbcModel *model)
| update model
virtual int | solution (double &objectiveValue, double *newSolution)
| returns 0 if no solution, 1 if valid solution.
virtual void | resetModel (CbcModel *model)
| Resets stuff if model changes.

## Detailed Description

heuristic - just picks up any good solution found by solver - see OsiBabSolver

Definition at line 552 of file CbcHeuristic.hpp.

## Constructor & Destructor Documentation

CbcSerendipity::CbcSerendipity | ( |  | ) |

CbcSerendipity::CbcSerendipity | ( | CbcModel & | model | ) |

CbcSerendipity::CbcSerendipity | ( | const CbcSerendipity & |  | ) |

CbcSerendipity::~CbcSerendipity | ( |  | ) |

## Member Function Documentation

CbcSerendipity& CbcSerendipity::operator= | ( | const CbcSerendipity & | rhs | ) |

Assignment operator.

Reimplemented from CbcHeuristic.

virtual CbcHeuristic* CbcSerendipity::clone | ( |  | ) | const`[virtual]`

Clone.

Implements CbcHeuristic.

virtual void CbcSerendipity::generateCpp | ( | FILE * | fp | ) | `[virtual]`

Create C++ lines to get to current state.

Reimplemented from CbcHeuristic.

virtual void CbcSerendipity::setModel | ( | CbcModel * | model | ) | `[virtual]`

update model

Reimplemented from CbcHeuristic.

virtual int CbcSerendipity::solution | ( | double & | objectiveValue,
|  | double * | newSolution |
| ) |  |  | `[virtual]`

returns 0 if no solution, 1 if valid solution.

Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise.

Implements CbcHeuristic.

virtual void CbcSerendipity::resetModel | ( | CbcModel * | model | ) | `[virtual]`

Resets stuff if model changes.

Implements CbcHeuristic.

The documentation for this class was generated from the following file:

- /home/coin/svn-release/Cbc-2.8.1/Cbc/src/CbcHeuristic.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines