Go to the documentation of this file.
43 std::vector< std::pair<int, int> >
items_;
52 KnapModel(
int cap, std::vector<std::pair<int, int> > items,
int* seq)
57 {
items_.insert(
items_.begin(), items.begin(), items.end()); }
83 std::cout <<
"Reading in KNAP parameters ..." << std::endl;
84 std::cout <<
"Reading in ALPS parameters ..." << std::endl;
95 inline std::pair<int, int>
getItem(
int i)
const {
107 {
items_.push_back(std::pair<int, int>(size, cost)); }
int getNumItems() const
Get the number of items in the knapsack.
void readFromArglist(const int argnum, const char *const *arglist)
Read parameters from the command line.
void addItem(int size, int cost)
Set the size of item i.
void setSequence(const int *seq)
Set the sequence of items in the knapsack.
AlpsModel is a base class for user application problem data.
int * getSequence() const
Get the sequence of items in the knapsack.
@ msgLevel
The level of printing messages on screen.
This class holds one node of the search tree.
virtual AlpsTreeNode * createRoot()
Create the root node.
void readInstance(const char *dataFile)
Read in the problem data.
void setCapacity(int capacity)
Set the capacity of the knapsack.
KnapModel & operator=(KnapModel const &)
AlpsParams * AlpsPar_
The parameter set that is used in Alps.
int getCapacity() const
Get the capacity of the knapsack.
The abstract base class of Alps knowledges generated during the search.
bool entry(const boolParams key) const
std::pair< int, int > getItem(int i) const
Get the size of item i.
virtual void readParameters(const int argnum, const char *const *arglist)
Read in Alps and Knap parameters.
AlpsEncoded * encode() const
Encode the content of this into an AlpsEncoded object and return a pointer to it.
std::vector< std::pair< int, int > > items_
List of sizes and profits of the items.
virtual AlpsReturnStatus decodeToSelf(AlpsEncoded &encoded)
Decode the given AlpsEncoded object into this.
int * sequence_
The descent sequence based on ratio: profit/size.
Holds a Knapsack tree node.
void orderItems()
Order the items based on their cost/size.
KnapParams * KnapPar_
Knap parameters.
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
Decode the given AlpsEncoded object into a new AlpsKnowledge object and return a pointer to it.
int capacity_
Capacity of the knapsack.
KnapModel(int cap, std::vector< std::pair< int, int > > items, int *seq)