Alps  2.0.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
KnapSolution Class Reference

#include <KnapSolution.h>

+ Inheritance diagram for KnapSolution:
+ Collaboration diagram for KnapSolution:

Public Member Functions

 KnapSolution (KnapModel *model)
 
 KnapSolution (KnapModel *model, int s, int *&sol, int v)
 
virtual ~KnapSolution ()
 
double getObjValue () const
 Get the best solution value. More...
 
virtual double getQuality () const
 
int getSize () const
 Get the size of the solution. More...
 
int getSolution (int i) const
 Get item i in the solution vector. More...
 
virtual void print (std::ostream &os) const
 Print out the solution. More...
 
virtual AlpsReturnStatus encode (AlpsEncoded *encoded) const
 Encode this into the given AlpsEncoded object. More...
 
virtual AlpsReturnStatus decodeToSelf (AlpsEncoded &encoded)
 Decode the given AlpsEncoded object into this. More...
 
virtual AlpsKnowledgedecode (AlpsEncoded &encoded) const
 Decode the given AlpsEncoded object into a new KnapSolution and return a pointer to it. More...
 
virtual AlpsReturnStatus encode (AlpsEncoded *encoded) const
 Encode this into the given AlpsEncoded object. More...
 
- Public Member Functions inherited from AlpsSolution
 AlpsSolution ()
 Default constructor. More...
 
 AlpsSolution (const AlpsNodeIndex_t i, const int d)
 Constructor to set index and depth. More...
 
virtual ~AlpsSolution ()
 Destructor. More...
 
AlpsNodeIndex_t getIndex ()
 Get index where solution was found. More...
 
void setIndex (const AlpsNodeIndex_t i)
 Set index where solution was found. More...
 
int getDepth ()
 Get depth where solution was found. More...
 
void setDepth (const int d)
 Set depth where solution was found. More...
 
AlpsEncodedencode () const
 Get encode defined in AlpsKnowledge. More...
 
virtual AlpsReturnStatus encode (AlpsEncoded *encoded) const
 Get encode defined in AlpsKnowledge. More...
 
- Public Member Functions inherited from AlpsKnowledge
 AlpsKnowledge ()
 Default constructor. More...
 
 AlpsKnowledge (AlpsKnowledgeType type)
 
 AlpsKnowledge (AlpsKnowledgeType type, AlpsKnowledgeBroker *broker)
 
virtual ~AlpsKnowledge ()
 Destructor. More...
 
AlpsKnowledgeType getType () const
 Get knowledge type. More...
 
void setType (AlpsKnowledgeType t)
 Set knowledge type. More...
 
AlpsKnowledgeBrokerbroker ()
 Get pointer to the knowledge broker. More...
 
const AlpsKnowledgeBrokerbroker () const
 Get pointer to the knowledge broker. More...
 
void setBroker (AlpsKnowledgeBroker *broker)
 Set knowledge broker. More...
 
AlpsEncodedencode () const
 Encode the content of this into an AlpsEncoded object and return a pointer to it. More...
 

Private Member Functions

 KnapSolution (KnapSolution const &other)
 Disable copy constructor. More...
 
KnapSolutionoperator= (KnapSolution const &rhs)
 Disable copy assignment operator. More...
 

Private Attributes

KnapModelmodel_
 
int size_
 The solution (indicator vector for the items) and its value. More...
 
int * solution_
 
int value_
 

Additional Inherited Members

- Public Attributes inherited from AlpsKnowledge
AlpsKnowledgeBrokerbroker_
 

Detailed Description

Definition at line 32 of file KnapSolution.h.

Constructor & Destructor Documentation

◆ KnapSolution() [1/3]

KnapSolution::KnapSolution ( KnapModel model)

◆ KnapSolution() [2/3]

KnapSolution::KnapSolution ( KnapModel model,
int  s,
int *&  sol,
int  v 
)

◆ ~KnapSolution()

virtual KnapSolution::~KnapSolution ( )
virtual

◆ KnapSolution() [3/3]

KnapSolution::KnapSolution ( KnapSolution const &  other)
private

Disable copy constructor.

Member Function Documentation

◆ getObjValue()

double KnapSolution::getObjValue ( ) const
inline

Get the best solution value.

Definition at line 45 of file KnapSolution.h.

◆ getQuality()

virtual double KnapSolution::getQuality ( ) const
inlinevirtual

Definition at line 47 of file KnapSolution.h.

◆ getSize()

int KnapSolution::getSize ( ) const
inline

Get the size of the solution.

Definition at line 50 of file KnapSolution.h.

◆ getSolution()

int KnapSolution::getSolution ( int  i) const
inline

Get item i in the solution vector.

Definition at line 53 of file KnapSolution.h.

◆ print()

virtual void KnapSolution::print ( std::ostream &  os) const
virtual

Print out the solution.

Reimplemented from AlpsSolution.

◆ encode() [1/2]

virtual AlpsReturnStatus KnapSolution::encode ( AlpsEncoded encoded) const
virtual

Encode this into the given AlpsEncoded object.

Reimplemented from AlpsSolution.

◆ decodeToSelf()

virtual AlpsReturnStatus KnapSolution::decodeToSelf ( AlpsEncoded encoded)
inlinevirtual

Decode the given AlpsEncoded object into this.

Reimplemented from AlpsSolution.

Definition at line 62 of file KnapSolution.h.

◆ decode()

virtual AlpsKnowledge* KnapSolution::decode ( AlpsEncoded encoded) const
virtual

Decode the given AlpsEncoded object into a new KnapSolution and return a pointer to it.

Implements AlpsKnowledge.

◆ operator=()

KnapSolution& KnapSolution::operator= ( KnapSolution const &  rhs)
private

Disable copy assignment operator.

◆ encode() [2/2]

virtual AlpsReturnStatus AlpsSolution::encode
inline

Encode this into the given AlpsEncoded object.

Definition at line 88 of file AlpsSolution.h.

Member Data Documentation

◆ model_

KnapModel* KnapSolution::model_
private

Definition at line 33 of file KnapSolution.h.

◆ size_

int KnapSolution::size_
private

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

Definition at line 35 of file KnapSolution.h.

◆ solution_

int* KnapSolution::solution_
private

Definition at line 36 of file KnapSolution.h.

◆ value_

int KnapSolution::value_
private

Definition at line 37 of file KnapSolution.h.


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