|
Dip
0.92.4
|
#include <KnapModel.h>


Public Member Functions | |
| KnapModel () | |
| KnapModel (int cap, std::vector< std::pair< int, int > > items, int *seq) | |
| ~KnapModel () | |
| int | getCapacity () const |
| Get the capacity of the knapsack. More... | |
| int | getNumItems () const |
| Get the number of items in the knapsack. More... | |
| int * | getSequence () const |
| Get the sequence of items in the knapsack. More... | |
| virtual void | readParameters (const int argnum, const char *const *arglist) |
| Read in Alps and Knap parameters. More... | |
| std::pair< int, int > | getItem (int i) const |
| Get the size of item i. More... | |
| void | setCapacity (int capacity) |
| Set the capacity of the knapsack. More... | |
| void | setSequence (const int *seq) |
| Set the sequence of items in the knapsack. More... | |
| void | addItem (int size, int cost) |
| Set the size of item i. More... | |
| void | readInstance (const char *dataFile) |
| Read in the problem data. More... | |
| void | orderItems () |
| Order the items based on their cost/size. More... | |
| virtual AlpsEncoded * | encode () const |
| The method that encodes the solution into a buffer. More... | |
| virtual void | decodeToSelf (AlpsEncoded &) |
| The method that decodes model data from the encoded form and fill member data. More... | |
Public Member Functions inherited from AlpsModel | |
| AlpsModel () | |
| Default construtor. More... | |
| virtual | ~AlpsModel () |
| Destructor. More... | |
| AlpsKnowledgeBroker * | getKnowledgeBroker () |
| Get knowledge broker. More... | |
| void | setKnowledgeBroker (AlpsKnowledgeBroker *b) |
| Set knowledge broker. More... | |
| std::string | getDataFile () const |
| Get the input file. More... | |
| void | setDataFile (std::string infile) |
| Set the data file. More... | |
| AlpsParams * | AlpsPar () |
| Access Alps Parameters. More... | |
| void | writeParameters (std::ostream &outstream) const |
| Write out parameters. More... | |
| virtual bool | setupSelf () |
Do necessary work to make model ready for use, such as classify variable and constraint types. More... | |
| virtual void | preprocess () |
| Preprocessing the model. More... | |
| virtual void | postprocess () |
| Postprocessing results. More... | |
| virtual AlpsTreeNode * | createRoot () |
| Create the root node. More... | |
| virtual void | modelLog () |
| Problem specific log. More... | |
| virtual void | nodeLog (AlpsTreeNode *node, bool force) |
| Node log. More... | |
| virtual bool | fathomAllNodes () |
| Return true if all nodes on this process can be fathomed. More... | |
| AlpsReturnStatus | encodeAlps (AlpsEncoded *encoded) const |
| Pack Alps portion of node into an encoded object. More... | |
| AlpsReturnStatus | decodeAlps (AlpsEncoded &encoded) |
| Unpack Alps portion of node from an encoded object. More... | |
| virtual void | registerKnowledge () |
| Register knowledge class. More... | |
| virtual void | sendGeneratedKnowledge () |
| Send generated knowledge. More... | |
| virtual void | receiveGeneratedKnowledge () |
| Receive generated knowledge. More... | |
| virtual AlpsEncoded * | packSharedKnowlege () |
| Pack knowledge to be shared with others into an encoded object. More... | |
| virtual void | unpackSharedKnowledge (AlpsEncoded &) |
| Unpack and store shared knowledge from an encoded object. More... | |
Public Member Functions inherited from AlpsKnowledge | |
| AlpsKnowledge () | |
| virtual | ~AlpsKnowledge () |
| KnowledgeType | getType () |
| void | setType (KnowledgeType t) |
| virtual AlpsReturnStatus | encode (AlpsEncoded *encoded) |
| Pack into a encode object. More... | |
| virtual AlpsKnowledge * | decode (AlpsEncoded &encoded) const |
| This method should decode and return a pointer to a brand new object, i.e., the method must create a new object on the heap from the decoded data instead of filling up the object for which the method was invoked. More... | |
| AlpsEncoded * | getEncoded () const |
| Get/set encoded. More... | |
| void | setEncoded (AlpsEncoded *e) |
Private Attributes | |
| int | capacity_ |
| Capacity of the knapsack. More... | |
| std::vector< std::pair< int, int > > | items_ |
| List of sizes and profits of the items. More... | |
| int * | sequence_ |
| The descent sequence based on ratio: profit/size. More... | |
| KnapParams * | KnapPar_ |
| Knap parameters. More... | |
Additional Inherited Members | |
Protected Attributes inherited from AlpsModel | |
| AlpsKnowledgeBroker * | broker_ |
| Knowledge broker. More... | |
| std::string | dataFile_ |
| Data file. More... | |
| AlpsParams * | AlpsPar_ |
| The parameter set that is used in Alps. More... | |
Protected Attributes inherited from AlpsKnowledge | |
| KnowledgeType | type_ |
Definition at line 26 of file KnapModel.h.
|
inline |
Definition at line 44 of file KnapModel.h.
|
inline |
Definition at line 45 of file KnapModel.h.
References items_.
|
inline |
Definition at line 52 of file KnapModel.h.
|
inline |
|
inline |
Get the number of items in the knapsack.
Definition at line 64 of file KnapModel.h.
References items_.
|
inline |
Get the sequence of items in the knapsack.
Definition at line 67 of file KnapModel.h.
References sequence_.
|
inlinevirtual |
Read in Alps and Knap parameters.
Reimplemented from AlpsModel.
Definition at line 72 of file KnapModel.h.
References AlpsModel::AlpsPar_, AlpsParams::entry(), KnapPar_, AlpsParams::msgLevel, and AlpsParameterSet::readFromArglist().
|
inline |
Get the size of item i.
Definition at line 83 of file KnapModel.h.
|
inline |
| void KnapModel::setSequence | ( | const int * | seq | ) |
Set the sequence of items in the knapsack.
|
inline |
|
virtual |
Read in the problem data.
Reimplemented from AlpsModel.
| void KnapModel::orderItems | ( | ) |
Order the items based on their cost/size.
|
virtual |
The method that encodes the solution into a buffer.
Reimplemented from AlpsKnowledge.
|
virtual |
The method that decodes model data from the encoded form and fill member data.
Reimplemented from AlpsModel.
|
private |
Capacity of the knapsack.
Definition at line 31 of file KnapModel.h.
Referenced by getCapacity(), and setCapacity().
|
private |
List of sizes and profits of the items.
Definition at line 34 of file KnapModel.h.
Referenced by addItem(), getItem(), getNumItems(), and KnapModel().
|
private |
The descent sequence based on ratio: profit/size.
Definition at line 37 of file KnapModel.h.
Referenced by getItem(), getSequence(), and ~KnapModel().
|
private |
Knap parameters.
Definition at line 40 of file KnapModel.h.
Referenced by readParameters(), and ~KnapModel().
1.8.5