12 #ifndef __DIGNEA_BPP_H__
13 #define __DIGNEA_BPP_H__
15 #include <dignea/core/Problem.h>
16 #include <dignea/types/SolutionTypes.h>
17 #include <dignea/utilities/random/PseudoRandom.h>
31 virtual ~
BPP() =
default;
33 BPP(
const string &pathToInstance);
35 BPP(
const int &
numberOfVars,
const int &capacity,
const vector<int> &items);
45 string getName()
const override {
return "Bin-Packing Problem"; };
57 int getCapacity()
const {
return capacity; };
61 const vector<int> &getItems()
const {
return items; };
63 void readData(
const string &path)
override;
72 std::string pathToInstance;
Class to represent the Bin Packing Problem.
Definition: BPP.h:27
json to_json() const override
Definition: BPP.cpp:225
BPP()
Construct a new BPP::BPP object.
Definition: BPP.cpp:10
bool evaluateConstraints(IntIntSolution &ptr) const override
Method to evaluate whether a solution is feasible or not. This method must be implemented in the subc...
Definition: BPP.h:49
void setCapacity(int capacity)
Updates the capacity of the instance.
Definition: BPP.cpp:203
float getLowerLimit(int i) const override
Returns the lower limit of the variable i In this case, the lower limit is 0.
Definition: BPP.cpp:126
void evaluate(IntIntSolution &solution) const override
Evaluates a bin assignment for the BPP instances represented in the object The fitness of the solutio...
Definition: BPP.cpp:145
float getUpperLimit(int i) const override
Returns the upper limit of the variable i In this case, the upper limit is the number of items - 1.
Definition: BPP.cpp:111
int getOptimizationDirection(const int i) const override
Gets the optimization direction of the problem. For the BPP is should always be Minimize.
Definition: BPP.cpp:212
string getName() const override
Returns the name of the problem. This method must be implemented in the subclasses.
Definition: BPP.h:45
void readData(const string &path) override
Reads the data from the file in the path. The file should contain a proper BPP instance with the foll...
Definition: BPP.cpp:80
IntIntSolution createSolution() const override
Creates a random solution for the BPP Each items is assigned to a random bin in the range [0,...
Definition: BPP.cpp:178
Class to represent a Problem in the tool. It includes the basic information for a problem a few metho...
Definition: Problem.h:29
int numberOfVars
Definition: Problem.h:155
Class to represent a solution to the optimization problems in the tool.
Definition: Solution.h:25