dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
BPPDomain.h
Go to the documentation of this file.
1 
11 #ifndef DIGNEA_BPPDOMAIN_H
12 #define DIGNEA_BPPDOMAIN_H
13 
16 #include <dignea/problems/BPP.h>
17 #include <dignea/types/SolutionTypes.h>
18 #include <dignea/utilities/random/PseudoRandom.h>
19 
20 #include <random>
21 #include <ranges>
31 class BPPDomain : public AbstractDomain<BPP, BPPInstance> {
32  public:
33  BPPDomain();
34 
35  explicit BPPDomain(const int &numberOfVars, const int &numberOfObjs = 1,
36  const int &capacity = 100);
37 
38  virtual ~BPPDomain() = default;
39 
40  BPPDomain(const string &pathToInstance) = delete;
41 
42  BPPDomain(const int &numberOfVars, const int &numberOfObjs,
43  const int &capacity, const int &minW, const int &maxW);
44 
45  shared_ptr<BPP> genOptProblem(const BPPInstance &instance) const override;
46 
47  void evaluate(BPPInstance &solution) const override;
48 
49  vector<BPPInstance> createSolutions(const int &maxSolutions) const override;
50 
51  void beforeEvaluation(vector<BPPInstance> &) override;
52 
53  void afterEvaluation(vector<BPPInstance> &) override;
54 
55  BPPInstance createSolution() const override;
56 
57  BPPInstance createSolution(ParallelPRNG &engine) const override;
58 
59  bool evaluateConstraints(BPPInstance &solution) const override {
60  return true;
61  }
62 
63  int getOptimizationDirection(const int i) const override;
64 
65  string getName() const override { return "BPPDomain"; }
66 
67  float getUpperLimit(const int i) const override;
68 
69  float getLowerLimit(const int i) const override;
70 
71  int getMaxWeight() const { return maxWeight; }
72 
73  int getMinWeight() const { return minWeight; }
74 
75  void setMaxWeight(int maxWeight) { BPPDomain::maxWeight = maxWeight; }
76 
77  void setMinWeight(int minWeight) { BPPDomain::minWeight = minWeight; }
78 
79  json to_json() const override;
80 
81  private:
82  BPPInstance createSolution(const int &instanceIndex,
83  const int &maxInstances) const;
84 
85  protected:
86  int maxWeight;
87  int minWeight;
88  int defaultCapacity;
89 
90  public:
91  // Unimplemented Methods
92  void readData(const string &path) override{};
93 };
94 
95 #endif
EIG Instance Generation Problem. Abstract Problem for the EIG. This problem will be used as a supercl...
Definition: AbstractDomain.h:28
Instance Generator for Bin-Packing Problem.
Definition: BPPDomain.h:31
float getLowerLimit(const int i) const override
Definition: BPPDomain.cpp:105
vector< BPPInstance > createSolutions(const int &maxSolutions) const override
Definition: BPPDomain.cpp:73
json to_json() const override
Creates a JSON object with the information of the Problem.
Definition: BPPDomain.cpp:211
float getUpperLimit(const int i) const override
Definition: BPPDomain.cpp:91
void beforeEvaluation(vector< BPPInstance > &) override
Definition: BPPDomain.cpp:150
void afterEvaluation(vector< BPPInstance > &) override
Method applied after evaluation the population of solutions.
Definition: BPPDomain.cpp:160
int getOptimizationDirection(const int i) const override
Definition: BPPDomain.cpp:136
void evaluate(BPPInstance &solution) const override
Definition: BPPDomain.cpp:47
BPPInstance createSolution() const override
Definition: BPPDomain.cpp:53
shared_ptr< BPP > genOptProblem(const BPPInstance &instance) const override
Creates a Optimisation Problem for the Configurations on the EIG In this case, BPP Problem.
Definition: BPPDomain.cpp:119
string getName() const override
Returns the name of the problem. This method must be implemented in the subclasses.
Definition: BPPDomain.h:65
Instance Bin-Packing Problem Solution. Class which represents the solution for the Instance Bin-Packi...
Definition: BPPInstance.h:28
int numberOfVars
Definition: Problem.h:155
int numberOfObjs
Definition: Problem.h:159