# KnapSolution Class Reference

`#include <KnapSolution.h>`

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

List of all members.

## Public Member Functions
| KnapSolution (const KnapModel *m)
| KnapSolution (int s, int *&sol, int v, const KnapModel *m)
| ~KnapSolution ()
double | getObjValue () const
| Get the best solution value.
virtual double | getQuality () const
int | getSize () const
| Get the size of the solution.
int | getSolution (int i) const
| Get item i in the solution vector.
const KnapModel * | getModel () const
| Get model data.
virtual void | print (std::ostream &os) const
| Print out the solution.
virtual AlpsEncoded * | encode () const
| The method that encodes the node into a encoded object.
virtual AlpsKnowledge * | decode (AlpsEncoded &) const
| The method that decodes the node from a encoded object.
## Private Attributes
int | size_
| The solution (indicator vector for the items) and its value.
int * | solution_
int | value_
const KnapModel * | model_
| To access model data.

## Detailed Description

Definition at line 24 of file KnapSolution.h.

## Constructor & Destructor Documentation

KnapSolution::KnapSolution | ( | const KnapModel * | m | ) | `[inline]`

Definition at line 35 of file KnapSolution.h.

KnapSolution::KnapSolution | ( | int | s,
|  | int *& | sol,
|  | int | v,
|  | const KnapModel * | m |
| ) |  |  | `[inline]`

Definition at line 42 of file KnapSolution.h.

KnapSolution::~KnapSolution | ( |  | ) | `[inline]`

Definition at line 49 of file KnapSolution.h.

## Member Function Documentation

double KnapSolution::getObjValue | ( |  | ) | const`[inline]`

Get the best solution value.

Definition at line 57 of file KnapSolution.h.

virtual double KnapSolution::getQuality | ( |  | ) | const`[inline, virtual]`

Definition at line 59 of file KnapSolution.h.

int KnapSolution::getSize | ( |  | ) | const`[inline]`

Get the size of the solution.

Definition at line 62 of file KnapSolution.h.

int KnapSolution::getSolution | ( | int | i | ) | const`[inline]`

Get item i in the solution vector.

Definition at line 65 of file KnapSolution.h.

const KnapModel* KnapSolution::getModel | ( |  | ) | const`[inline]`

Get model data.

Definition at line 68 of file KnapSolution.h.

virtual void KnapSolution::print | ( | std::ostream & | os | ) | const`[virtual]`

Print out the solution.

Reimplemented from AlpsSolution.

virtual AlpsEncoded* KnapSolution::encode | ( |  | ) | const`[virtual]`

The method that encodes the node into a encoded object.

Reimplemented from AlpsKnowledge.

virtual AlpsKnowledge* KnapSolution::decode | ( | AlpsEncoded & |  | ) | const`[virtual]`

The method that decodes the node from a encoded object.

Reimplemented from AlpsKnowledge.

## Member Data Documentation

int KnapSolution::size_`[private]`

The solution (indicator vector for the items) and its value.

Definition at line 27 of file KnapSolution.h.

int* KnapSolution::solution_`[private]`

Definition at line 28 of file KnapSolution.h.

int KnapSolution::value_`[private]`

Definition at line 29 of file KnapSolution.h.

const KnapModel* KnapSolution::model_`[private]`

To access model data.

Definition at line 32 of file KnapSolution.h.

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

- /home/coin/svn-release/Alps-1.4.8/Alps/examples/Knap/KnapSolution.h