12 #ifndef __EIG_SOLUTION_H__
13 #define __EIG_SOLUTION_H__
15 #include <dignea/core/Front.h>
16 #include <dignea/core/Solution.h>
29 template <
typename V,
typename O>
35 const int &nCons = 0);
69 virtual vector<float>
getFeatures()
const {
return features; }
117 this->portFitness = fitness;
128 this->avgPortFitness = fitness;
155 os <<
"Not implemented in AbstractInstance" << std::endl;
206 template <
typename V,
typename O>
213 avgPortFitness({}) {}
225 template <
typename V,
typename O>
228 :
Solution<V, O>(nVars, nObjs, nCons),
233 avgPortFitness({}) {}
243 template <
typename V,
typename O>
246 features(solution.features),
247 diversity(solution.diversity),
248 biasedFitness(solution.biasedFitness),
249 portFitness(solution.portFitness),
250 avgPortFitness(solution.avgPortFitness) {}
260 template <
typename V,
typename O>
263 features(solution->features),
264 diversity(solution->diversity),
265 biasedFitness(solution->biasedFitness),
266 portFitness(solution->portFitness),
267 avgPortFitness(solution->avgPortFitness) {}
276 template <
typename V,
typename O>
289 template <
typename V,
typename O>
295 this->nVars = copy.
nVars;
296 this->nObjs = copy.
nObjs;
297 this->nCons = copy.
nCons;
321 template <
typename V,
typename O>
323 if (other.
fitness != this->fitness) {
326 if (other.
diversity != this->diversity) {
335 if ((this->nVars != other.
nVars) || (this->nObjs != other.
nObjs) ||
336 (this->nCons != other.
nCons)) {
339 for (
int i = 0; i < other.
nVars; i++) {
340 if (other.
variables[i] != this->variables[i]) {
344 for (
int i = 0; i < other.
nObjs; i++) {
345 if (other.
objectives[i] != this->objectives[i]) {
349 for (
int i = 0; i < other.
nCons; i++) {
350 if (other.
constraints[i] != this->constraints[i]) {
354 for (
unsigned int i = 0; i < other.
features.size(); i++) {
355 if (other.
features[i] != this->features[i]) {
Solution for a Instance Generation Problem used in the EIG. This is a solution for AbstractDomain.
Definition: AbstractInstance.h:30
virtual vector< float > getFeatures() const
Get the features descriptor of this instance.
Definition: AbstractInstance.h:69
float diversity
Individual diversity respect to the rest of the population.
Definition: AbstractInstance.h:181
AbstractInstance(const int &nVars, const int &nObjs=1, const int &nCons=0)
Construct a new AbstractInstance<V, O>::AbstractInstance object from the data given in the arguments.
Definition: AbstractInstance.h:226
float biasedFitness
Individual's fitness regarding to the performance of the target algorithm.
Definition: AbstractInstance.h:186
vector< float > getAvgPortFitness() const
Get the Avg Config Fitness vector.
Definition: AbstractInstance.h:145
AbstractInstance & operator=(const AbstractInstance ©)
Copies a solution using the assignment operator.
Definition: AbstractInstance.h:290
AbstractInstance()
Construct a new AbstractInstance<V, O>::AbstractInstance object.
Definition: AbstractInstance.h:207
friend std::ostream & operator<<(std::ostream &os, AbstractInstance< V, O > const &solution)
Dumps into the ostream the instance representation.
Definition: AbstractInstance.h:165
void setBiasedFitness(float bFitness)
Set the Biased Fitness value. The BiasedFitness is the fitness value compute exclusively from the dif...
Definition: AbstractInstance.h:105
vector< float > features
Vector of features of the instance. This is problem dependent and must defined in order and computed ...
Definition: AbstractInstance.h:177
AbstractInstance(const AbstractInstance *solution)
Construct a new AbstractInstance<V, O>::AbstractInstance object from the data in the given solution.
Definition: AbstractInstance.h:261
void setAvgConfigFitness(const vector< float > &fitness)
Set the average fitness of each algorithm in the porftolio over this instance.
Definition: AbstractInstance.h:127
json to_json() const override
Creates a JSON format representation of the solution. It must be override by the subclasses.
Definition: AbstractInstance.h:55
vector< vector< float > > portFitness
Best fitness founds for all the algorithms in the portfolio that has solved the instance.
Definition: AbstractInstance.h:191
void setFeatures(const vector< float > &v)
Set the features descriptor of this instance.
Definition: AbstractInstance.h:277
void setConfigFitness(const vector< vector< float >> &fitness)
Set the fitness of each algorithm in the porftolio over this instance.
Definition: AbstractInstance.h:116
bool operator==(const AbstractInstance &other) const
Compares whether two solutions are equal.
Definition: AbstractInstance.h:322
float getBiasedFitness() const
Get the Biased Fitness value. The BiasedFitness is the fitness value compute exclusively from the dif...
Definition: AbstractInstance.h:96
vector< vector< float > > getPortFitness() const
Get the Config Fitness matrix.
Definition: AbstractInstance.h:137
virtual void to_instance(std::ostream &os) const
Not implemented here. The purpose of this method is to generate a string representation of the instan...
Definition: AbstractInstance.h:154
float getDiversity() const
Get the Diversity of the solution.
Definition: AbstractInstance.h:76
vector< float > avgPortFitness
Average best fitness founds for all the algorithms in the portfolio that has solved the instance in t...
Definition: AbstractInstance.h:197
void setDiversity(float diversity)
Set the Diversity of the solution. The diversity of the instance is computed using the Novelty Search...
Definition: AbstractInstance.h:84
AbstractInstance(const AbstractInstance &solution)
Construct a new AbstractInstance<V, O>::AbstractInstance object from the data in the given solution.
Definition: AbstractInstance.h:244
Class to represent a solution to the optimization problems in the tool.
Definition: Solution.h:25
int nVars
Definition: Solution.h:194
vector< V > variables
Definition: Solution.h:201
int nCons
Definition: Solution.h:196
int nObjs
Definition: Solution.h:195
virtual json to_json() const
Creates and returns a JSON representation of the solution.
Definition: Solution.h:591
float fitness
Definition: Solution.h:197
vector< O > objectives
Definition: Solution.h:200
vector< O > constraints
Definition: Solution.h:202
float constraintCoeff
Definition: Solution.h:198