15 #ifndef MMKP_MCKNAP_INCLUDED
16 #define MMKP_MCKNAP_INCLUDED
40 #include "UtilMacros.h"
72 void solveTrivialMaxSum(
const double * redCost,
73 const double * origCost,
76 double & varOrigCost);
80 return (i * m_nGroupCols) + j;
84 return make_pair(index / m_nGroupCols, index % m_nGroupCols);
87 void setMCKnapData(
const double capacity,
88 const double * weight);
90 void solveMCKnap(
const double * redCost,
91 const double * origCost,
93 vector<double> & solEls,
95 double & varOrigCost);
99 const int nGroupCols) :
104 m_nCols (nGroupRows * nGroupCols),
105 m_nGroupRows(nGroupRows),
106 m_nGroupCols(nGroupCols),
111 m_costDbl =
new double[m_nCols];
112 m_cost =
new int[m_nCols];
113 m_weight =
new int[m_nCols];
114 assert(m_costDbl && m_cost && m_weight);
121 for(i = 0; i < m_setset->size; i++){
126 free(m_setset->fset);
const int getIndexIJ(const int i, const int j) const
pair< int, int > getIndexInv(const int index) const
MMKP_MCKnap(const int nGroupRows, const int nGroupCols)