# CbcHeuristicGreedySOS Class Reference

Greedy heuristic for SOS and L rows (and positive elements). More...

`#include <CbcHeuristicGreedy.hpp>`

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

List of all members.

## Public Member Functions
| CbcHeuristicGreedySOS ()
| CbcHeuristicGreedySOS (CbcModel &model)
| CbcHeuristicGreedySOS (const CbcHeuristicGreedySOS &)
| ~CbcHeuristicGreedySOS ()
virtual CbcHeuristic * | clone () const
| Clone.
CbcHeuristicGreedySOS & | operator= (const CbcHeuristicGreedySOS &rhs)
| Assignment operator.
virtual void | generateCpp (FILE *fp)
| Create C++ lines to get to current state.
virtual void | setModel (CbcModel *model)
| update model (This is needed if cliques update matrix etc)
virtual int | solution (double &objectiveValue, double *newSolution)
| returns 0 if no solution, 1 if valid solution.
virtual void | validate ()
| Validate model i.e. sets when_ to 0 if necessary (may be NULL).
virtual void | resetModel (CbcModel *model)
| Resets stuff if model changes.
int | algorithm () const
void | setAlgorithm (int value)
int | numberTimes () const
void | setNumberTimes (int value)
## Protected Member Functions
void | gutsOfConstructor (CbcModel *model)
| Guts of constructor from a CbcModel.
## Protected Attributes
double * | originalRhs_
CoinPackedMatrix | matrix_
int | originalNumberRows_
int | algorithm_
int | numberTimes_
| Do this many times.

## Detailed Description

Greedy heuristic for SOS and L rows (and positive elements).

Definition at line 193 of file CbcHeuristicGreedy.hpp.

## Constructor & Destructor Documentation

CbcHeuristicGreedySOS::CbcHeuristicGreedySOS | ( |  | ) |

CbcHeuristicGreedySOS::CbcHeuristicGreedySOS | ( | CbcModel & | model | ) |

CbcHeuristicGreedySOS::CbcHeuristicGreedySOS | ( | const CbcHeuristicGreedySOS & |  | ) |

CbcHeuristicGreedySOS::~CbcHeuristicGreedySOS | ( |  | ) |

## Member Function Documentation

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

Clone.

Implements CbcHeuristic.

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

Assignment operator.

Reimplemented from CbcHeuristic.

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

Create C++ lines to get to current state.

Reimplemented from CbcHeuristic.

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

update model (This is needed if cliques update matrix etc)

Reimplemented from CbcHeuristic.

virtual int CbcHeuristicGreedySOS::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 CbcHeuristicGreedySOS::validate | ( |  | ) | `[virtual]`

Validate model i.e. sets when_ to 0 if necessary (may be NULL).

Reimplemented from CbcHeuristic.

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

Resets stuff if model changes.

Implements CbcHeuristic.

int CbcHeuristicGreedySOS::algorithm | ( |  | ) | const`[inline]`

Definition at line 245 of file CbcHeuristicGreedy.hpp.

void CbcHeuristicGreedySOS::setAlgorithm | ( | int | value | ) | `[inline]`

Definition at line 248 of file CbcHeuristicGreedy.hpp.

int CbcHeuristicGreedySOS::numberTimes | ( |  | ) | const`[inline]`

Definition at line 252 of file CbcHeuristicGreedy.hpp.

void CbcHeuristicGreedySOS::setNumberTimes | ( | int | value | ) | `[inline]`

Definition at line 255 of file CbcHeuristicGreedy.hpp.

void CbcHeuristicGreedySOS::gutsOfConstructor | ( | CbcModel * | model | ) | `[protected]`

Guts of constructor from a CbcModel.

## Member Data Documentation

double* CbcHeuristicGreedySOS::originalRhs_`[protected]`

Definition at line 265 of file CbcHeuristicGreedy.hpp.

CoinPackedMatrix CbcHeuristicGreedySOS::matrix_`[protected]`

Definition at line 267 of file CbcHeuristicGreedy.hpp.

int CbcHeuristicGreedySOS::originalNumberRows_`[protected]`

Definition at line 269 of file CbcHeuristicGreedy.hpp.

int CbcHeuristicGreedySOS::algorithm_`[protected]`

Definition at line 272 of file CbcHeuristicGreedy.hpp.

int CbcHeuristicGreedySOS::numberTimes_`[protected]`

Do this many times.

Definition at line 274 of file CbcHeuristicGreedy.hpp.

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

- /home/coin/svn-release/Cbc-2.7.8/Cbc/src/CbcHeuristicGreedy.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines