GAP_Knapsack Class Reference

#include <GAP_Knapsack.h>

Collaboration diagram for GAP_Knapsack:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Access get methods.



const int getLength () const
const double getCapacity () const
const double * getProfit () const
const double * getWeight () const
const double * getProfitSort () const
const double * getWeightSort () const
const int * getSolution () const
const double getOptObj () const
const SOR_IntDblArrgetRatio () const
double * getMutableProfit ()
double * getMutableWeight ()
Set methods.



void setLength (const int length)
Helper Methods.



void populateAndSortRatio (const double *profit=0, const double *weight=0)
int solveKnapsack ()
Constructor and Destructor



 GAP_Knapsack (const int length, const double capacity, const double *profit, const double *weight)
 Default constructor.
 ~GAP_Knapsack ()
 Default constructor.

Private Member Functions

Copy Constructors

Disable the default copy constructors.



 GAP_Knapsack (const GAP_Knapsack &)
GAP_Knapsackoperator= (const GAP_Knapsack &)

Private Attributes

int m_length
 GAP_Knapsack problem instance data.
double m_capacity
double * m_profit
double * m_weight
double * m_profitSort
double * m_weightSort
int * m_solution
double m_optObj
SOR_IntDblArrm_ratio

Detailed Description

A class to store an instance of the Knapsack Problem

max sum{j = 0..n-1} p[j] x[j] s.t. sum{j = 0..n-1} w[j] x[j] <= b x binary

Definition at line 34 of file GAP_Knapsack.h.


Constructor & Destructor Documentation

GAP_Knapsack::GAP_Knapsack ( const GAP_Knapsack  )  [private]
GAP_Knapsack::GAP_Knapsack ( const int  length,
const double  capacity,
const double *  profit,
const double *  weight 
) [inline]

Default constructor.

Takes an instance of UtilParameters

Definition at line 106 of file GAP_Knapsack.h.

References CoinAssert, CoinAssertHint, m_profit, m_profitSort, m_ratio, m_solution, m_weight, m_weightSort, and SOR_IntDblArrNew().

GAP_Knapsack::~GAP_Knapsack (  )  [inline]

Default constructor.

Takes an instance of UtilParameters

Definition at line 136 of file GAP_Knapsack.h.

References m_profit, m_profitSort, m_ratio, m_solution, m_weight, m_weightSort, SOR_IntDblArrFree(), and UTIL_DELARR.


Member Function Documentation

const int GAP_Knapsack::getLength (  )  const [inline]

Definition at line 50 of file GAP_Knapsack.h.

References m_length.

const double GAP_Knapsack::getCapacity (  )  const [inline]

Definition at line 51 of file GAP_Knapsack.h.

References m_capacity.

const double* GAP_Knapsack::getProfit (  )  const [inline]

Definition at line 52 of file GAP_Knapsack.h.

References m_profit.

const double* GAP_Knapsack::getWeight (  )  const [inline]

Definition at line 53 of file GAP_Knapsack.h.

References m_weight.

const double* GAP_Knapsack::getProfitSort (  )  const [inline]

Definition at line 54 of file GAP_Knapsack.h.

References m_profitSort.

const double* GAP_Knapsack::getWeightSort (  )  const [inline]

Definition at line 55 of file GAP_Knapsack.h.

References m_weightSort.

const int* GAP_Knapsack::getSolution (  )  const [inline]

Definition at line 56 of file GAP_Knapsack.h.

References m_solution.

const double GAP_Knapsack::getOptObj (  )  const [inline]

Definition at line 57 of file GAP_Knapsack.h.

References m_optObj.

const SOR_IntDblArr* GAP_Knapsack::getRatio (  )  const [inline]

Definition at line 58 of file GAP_Knapsack.h.

References m_ratio.

double* GAP_Knapsack::getMutableProfit (  )  [inline]

Definition at line 59 of file GAP_Knapsack.h.

References m_profit.

double* GAP_Knapsack::getMutableWeight (  )  [inline]

Definition at line 60 of file GAP_Knapsack.h.

References m_weight.

void GAP_Knapsack::setLength ( const int  length  )  [inline]

Definition at line 63 of file GAP_Knapsack.h.

References m_length.

void GAP_Knapsack::populateAndSortRatio ( const double *  profit = 0,
const double *  weight = 0 
) [inline]
int GAP_Knapsack::solveKnapsack (  )  [inline]
GAP_Knapsack& GAP_Knapsack::operator= ( const GAP_Knapsack  )  [private]

Member Data Documentation

int GAP_Knapsack::m_length [private]

GAP_Knapsack problem instance data.

Definition at line 38 of file GAP_Knapsack.h.

Referenced by getLength(), populateAndSortRatio(), setLength(), and solveKnapsack().

double GAP_Knapsack::m_capacity [private]

Definition at line 39 of file GAP_Knapsack.h.

Referenced by getCapacity(), and solveKnapsack().

double* GAP_Knapsack::m_profit [private]
double* GAP_Knapsack::m_weight [private]
double* GAP_Knapsack::m_profitSort [private]
double* GAP_Knapsack::m_weightSort [private]
int* GAP_Knapsack::m_solution [private]

Definition at line 44 of file GAP_Knapsack.h.

Referenced by GAP_Knapsack(), getSolution(), solveKnapsack(), and ~GAP_Knapsack().

double GAP_Knapsack::m_optObj [private]

Definition at line 45 of file GAP_Knapsack.h.

Referenced by getOptObj(), and solveKnapsack().

Definition at line 46 of file GAP_Knapsack.h.

Referenced by GAP_Knapsack(), getRatio(), populateAndSortRatio(), and ~GAP_Knapsack().


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

Generated on 12 Feb 2015 for Dip-All by  doxygen 1.6.1