1 #ifndef KNAPSACKPROBLEM_H
2 #define KNAPSACKPROBLEM_H
29 std::vector<double> weights;
32 std::vector<double> profits;
42 bool checkSchedule(
const std::vector<unsigned int>& schedule);
51 void writeResultToFile(
const std::vector<unsigned int>& schedule,
double costFunctionValue,
const std::string& filename);
62 KnapsackProblem(
unsigned int objects,
const std::vector<double>& weights,
const std::vector<double>& profits,
double capacity);
75 KnapsackProblem(
unsigned int objects,
double capacity,
double minWeight,
double maxWeight,
double minProfit,
double maxProfit,
bool integerValues =
false);
93 void setData(
unsigned int objects,
const std::vector<double>& weights,
const std::vector<double>& profits,
double capacity);
106 void generateData(
unsigned int objects,
double capacity,
double minWeight,
double maxWeight,
double minProfit,
double maxProfit,
bool integerValues =
false);
134 double evaluateKP(
const std::vector<unsigned int>& schedule);
144 double evaluateKP(
const std::vector<unsigned int>& schedule,
const std::string& filename);
181 #endif // KNAPSACKPROBLEM_H
void readDataFromFile(const std::string &filename)
Reads knapsack problem data from a file with a filename.
Definition: KnapsackProblem.cpp:144
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.
Definition: KnapsackProblem.cpp:78
Interface for reading, writing and displaying data.
const std::vector< double > & getWeights() const
Getter for weights of objects.
Definition: KnapsackProblem.h:174
KnapsackProblem(unsigned int objects, const std::vector< double > &weights, const std::vector< double > &profits, double capacity)
Constructor.
Definition: KnapsackProblem.cpp:11
Definition: BinPackingProblem.cpp:3
double evaluateKP(const std::vector< unsigned int > &schedule)
Evaluates knapsack problem.
Definition: KnapsackProblem.cpp:44
const std::vector< double > & getProfits() const
Getter for profits of objects.
Definition: KnapsackProblem.h:166
Definition: KnapsackProblem.h:22
void showData()
Shows knapsack problem data.
Definition: KnapsackProblem.cpp:268
void writeDataToFile(const std::string &filename)
Writes knapsack problem data to a file with a filename.
Definition: KnapsackProblem.cpp:280
Simple pseudo random number generator class.
void setData(unsigned int objects, const std::vector< double > &weights, const std::vector< double > &profits, double capacity)
Setter for knapsack problem data.
Definition: KnapsackProblem.cpp:227
unsigned int getObjects() const
Getter for number of objects.
Definition: KnapsackProblem.h:158
double getCapacity() const
Getter for knapsack capacity.
Definition: KnapsackProblem.h:150