dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
MinKnap.h
Go to the documentation of this file.
1 
72 /* ======================================================================
73  definitions
74  ====================================================================== */
75 
76 #ifndef DIGNEA_KP_MinKnap_HEURISTIC_H
77 #define DIGNEA_KP_MinKnap_HEURISTIC_H
78 
79 #include <dignea/core/Heuristic.h>
80 #include <dignea/problems/KPNR.h>
81 
82 #include <nlohmann/json.hpp>
83 #include <vector>
84 
85 using json = nlohmann::json;
86 using namespace std;
92 class MinKnap : public Heuristic<BoolFloatSolution> {
93  public:
94  MinKnap();
95 
96  virtual ~MinKnap() = default;
97 
98  void run() override;
99 
100  string getName() const { return "MinKnap KP"; };
101 
102  string getID() const { return "MinKnap"; }
103 
104  void setProblem(shared_ptr<KP> prob);
105 
106  void setProblem(KP *prob);
107 
108  Front<BoolFloatSolution> getResults() const override;
109 };
110 
111 #endif // DIGNEA_KP_MinKnap_HEURISTIC_H
nlohmann::json json
Definition: MinKnap.h:85
Front class which stores the final results of an EA execution.
Definition: Front.h:26
Base heuristic class. This is the skeleton for future heuristic implementations. Extends AbstractEA f...
Definition: Heuristic.h:19
Class representing a Knapsack Problem.
Definition: KP.h:28
MinKnap Heuristic for the Knapsack Problem. Tries to insert each item in the knapsack while there is ...
Definition: MinKnap.h:92
string getID() const
Returns the identificator of the algorithm, this is used in the to_json method. Must be implemented i...
Definition: MinKnap.h:102
string getName() const
Returns the name of the algorithm, this is used in the to_json method. Must be implemented in the sub...
Definition: MinKnap.h:100