|
Operational Research Library
1.0
|
#include <KnapsackProblem.h>


Public Member Functions | |
| KnapsackProblem (unsigned int objects, const std::vector< double > &weights, const std::vector< double > &profits, double capacity) | |
| Constructor. More... | |
| KnapsackProblem (unsigned int objects, double capacity, double minWeight, double maxWeight, double minProfit, double maxProfit, bool integerValues=false) | |
| Constructor. More... | |
| KnapsackProblem (const std::string &filename) | |
| Constructor. More... | |
| void | setData (unsigned int objects, const std::vector< double > &weights, const std::vector< double > &profits, double capacity) |
| Setter for knapsack problem data. More... | |
| void | generateData (unsigned int objects, double capacity, double minWeight, double maxWeight, double minProfit, double maxProfit, bool integerValues=false) |
| Generates knapsack problem data according to setup. More... | |
| void | readDataFromFile (const std::string &filename) |
| Reads knapsack problem data from a file with a filename. More... | |
| void | writeDataToFile (const std::string &filename) |
| Writes knapsack problem data to a file with a filename. More... | |
| void | showData () |
| Shows knapsack problem data. More... | |
| double | evaluateKP (const std::vector< unsigned int > &schedule) |
| Evaluates knapsack problem. More... | |
| double | evaluateKP (const std::vector< unsigned int > &schedule, const std::string &filename) |
| Evaluates knapsack problem to file with a filename. More... | |
| double | getCapacity () const |
| Getter for knapsack capacity. More... | |
| unsigned int | getObjects () const |
| Getter for number of objects. More... | |
| const std::vector< double > & | getProfits () const |
| Getter for profits of objects. More... | |
| const std::vector< double > & | getWeights () const |
| Getter for weights of objects. More... | |
Public Member Functions inherited from operational_research::IData | |
| virtual | ~IData () |
| Virtual destructor. More... | |
| operational_research::KnapsackProblem::KnapsackProblem | ( | unsigned int | objects, |
| const std::vector< double > & | weights, | ||
| const std::vector< double > & | profits, | ||
| double | capacity | ||
| ) |
Constructor.
| objects | Number of objects. |
| weights | Weights of objects. |
| profits | Profits of objects. |
| capacity | Knapsack capacity. |
| std::invalid_argument | exception. |
| operational_research::KnapsackProblem::KnapsackProblem | ( | unsigned int | objects, |
| double | capacity, | ||
| double | minWeight, | ||
| double | maxWeight, | ||
| double | minProfit, | ||
| double | maxProfit, | ||
| bool | integerValues = false |
||
| ) |
Constructor.
| objects | Number of objects. |
| capacity | Knapsack capacity. |
| minWeight | Minimal weight of object. |
| maxWeight | Maximal weight of object. |
| minProfit | Minimal profit of object. |
| maxProfit | Maximal profit of object. |
| integerValues | True if generated data is integer values, false if generated data is real values. |
| std::invalid_argument | exception. |
| operational_research::KnapsackProblem::KnapsackProblem | ( | const std::string & | filename | ) |
Constructor.
| filename | Filename. |
| std::runtime_error | exception. |
| std::invalid_argument | exception. |
| double operational_research::KnapsackProblem::evaluateKP | ( | const std::vector< unsigned int > & | schedule | ) |
Evaluates knapsack problem.
| schedule | Schedule. |
| std::invalid_argument | exception. |
| double operational_research::KnapsackProblem::evaluateKP | ( | const std::vector< unsigned int > & | schedule, |
| const std::string & | filename | ||
| ) |
Evaluates knapsack problem to file with a filename.
| schedule | Schedule. |
| filename | Filename. |
| std::invalid_argument | exception. |
| std::runtime_error | exception. |
| void operational_research::KnapsackProblem::generateData | ( | unsigned int | objects, |
| double | capacity, | ||
| double | minWeight, | ||
| double | maxWeight, | ||
| double | minProfit, | ||
| double | maxProfit, | ||
| bool | integerValues = false |
||
| ) |
Generates knapsack problem data according to setup.
| objects | Number of objects. |
| capacity | Knapsack capacity. |
| minWeight | Minimal weight of object. |
| maxWeight | Maximal weight of object. |
| minProfit | Minimal profit of object. |
| maxProfit | Maximal profit of object. |
| integerValues | True if generated data is integer values, false if generated data is real values. |
| std::invalid_argument | exception. |
|
inline |
Getter for knapsack capacity.
|
inline |
Getter for number of objects.
|
inline |
Getter for profits of objects.
|
inline |
Getter for weights of objects.
|
virtual |
Reads knapsack problem data from a file with a filename.
| filename | Filename. |
| std::runtime_error | exception. |
| std::invalid_argument | exception. |
Implements operational_research::IData.
| void operational_research::KnapsackProblem::setData | ( | unsigned int | objects, |
| const std::vector< double > & | weights, | ||
| const std::vector< double > & | profits, | ||
| double | capacity | ||
| ) |
Setter for knapsack problem data.
| objects | Number of objects. |
| weights | Weights of objects. |
| profits | Profits of objects. |
| capacity | Knapsack capacity. |
| std::invalid_argument | exception. |
|
virtual |
Shows knapsack problem data.
Implements operational_research::IData.
|
virtual |
Writes knapsack problem data to a file with a filename.
| filename | Filename. |
| std::runtime_error | exception. |
Implements operational_research::IData.
1.8.9.1