coin-Bcp
|
#include <KS.hpp>
Public Member Functions | |
Knapsack (int n, double cap, const double *c, const double *w) | |
~Knapsack () | |
void | setCosts (const double *c) |
void | setCapacity (double cap) |
void | optimize (double lb=0.0, double minimp=1e-6) |
Return true/false depending on whether the problem is feasible. More... | |
const int * | getBestSol () const |
const double | getBestVal () const |
Private Member Functions | |
void | sortItems (const double *c, const double *w) |
Private Attributes | |
double | cap_ |
The capacity of the knapsack. More... | |
int | n_ |
The number of items. More... | |
int * | perm_ |
The permutation corresponding to the ordering (element perm[i] is the i-th in the original order. More... | |
const double * | cost_ |
The cost of each item (the order is after doing the cost/weight ordering) More... | |
const double * | weight_ |
The weight of the items (the order is after doing the cost/weight ordering) More... | |
int * | x |
The optimal solution in terms of the input order. More... | |
double | z |
The optimal solution value. More... | |
|
inline |
Definition at line 101 of file KS.hpp.
References sortItems().
|
inline |
|
inlineprivate |
Definition at line 55 of file KS.hpp.
References triplet::c, cost_, triplet::i, n_, perm_, ratioComp(), triplet::w, and weight_.
Referenced by Knapsack(), and setCosts().
|
inline |
Definition at line 113 of file KS.hpp.
References sortItems(), and weight_.
|
inline |
void Knapsack::optimize | ( | double | lb = 0.0 , |
double | minimp = 1e-6 |
||
) |
|
inline |
|
inline |
|
private |
The capacity of the knapsack.
Definition at line 82 of file KS.hpp.
Referenced by optimize(), and setCapacity().
|
private |
The number of items.
Definition at line 84 of file KS.hpp.
Referenced by optimize(), and sortItems().
|
private |
The permutation corresponding to the ordering (element perm[i] is the i-th in the original order.
Definition at line 87 of file KS.hpp.
Referenced by optimize(), sortItems(), and ~Knapsack().
|
private |
The cost of each item (the order is after doing the cost/weight ordering)
Definition at line 90 of file KS.hpp.
Referenced by optimize(), sortItems(), and ~Knapsack().
|
private |
The weight of the items (the order is after doing the cost/weight ordering)
Definition at line 93 of file KS.hpp.
Referenced by optimize(), setCosts(), sortItems(), and ~Knapsack().
|
private |
The optimal solution in terms of the input order.
Definition at line 96 of file KS.hpp.
Referenced by getBestSol(), optimize(), and ~Knapsack().
|
private |
The optimal solution value.
Definition at line 98 of file KS.hpp.
Referenced by getBestVal(), and optimize().