|
dignea
1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
|
Class to represent a solution to the optimization problems in the tool. More...
#include <Solution.h>
Public Member Functions | |
| Solution () | |
| Creates a Solution with all parameters set to zero. More... | |
| Solution (const int &nVars, const int &nObjs) | |
| Creates a new solution with the given dimension (nVars) and nObjs number of objectives. More... | |
| Solution (const int &nVars, const int &nObjs, const int &nCons) | |
| Creates a new solution with the given dimension (nVars), nObjs number of objectives and nCons number of constraints. More... | |
| Solution (const Solution< V, O > &) | |
| Creates a new solution with the information from copy. More... | |
| Solution (const Solution< V, O > *) | |
| Creates a new solution with the information from the pointer to other solution. More... | |
| Solution & | operator= (const Solution ©) |
| Copies a solution using the assignment operator. More... | |
| bool | operator== (const Solution &other) const |
| Compares whether two solutions are equal. More... | |
| virtual const vector< O > & | getObjectives () const |
| Returns the objective values of the solution. More... | |
| virtual void | setObjectives (const vector< O > &objs) |
| Updates the objective values of the solution. More... | |
| virtual const vector< V > & | getVariables () const |
| Get the variables of the solution. More... | |
| virtual void | setVariables (const vector< V > &vars) |
| Updates the variable values (dimension) of the solution. More... | |
| virtual const vector< O > & | getConstraints () const |
| Get the constraint values of the solution. More... | |
| virtual void | setConstraints (const vector< O > &constr) |
| Updates the constraints of the solution. More... | |
| virtual int | getNumberOfVars () const |
| Get the number of variables (dimension) of the solution. More... | |
| virtual void | setNumberOfVars (const int &numberOfVars) |
| Set the number of variables (dimension) of the solution. More... | |
| virtual int | getNumberOfObjs () const |
| Get the number of objectives of the solution. More... | |
| virtual void | setNumberOfbjs (const int &numberOfObjs) |
| Set the number of objectives of the solution. More... | |
| virtual int | getNumberOfCons () const |
| Get the number of constraint in the solution. More... | |
| virtual void | setNumberOfCons (const int &nConstraints) |
| Set the number of constraints of the solution. More... | |
| virtual void | setRank (int id) |
| Set the identifier of the solution in the population. Only used in the Non-Dominated Sorting operator. More... | |
| virtual int | getRank () const |
| Get the identifier of the solution in the population. Only used in the Non-Dominated Sorting operator. More... | |
| virtual void | setCrowDistance (float d) |
| Set the Crow Distance object. More... | |
| virtual float | getCrowDistance () const |
| Get the Crow Distance object. More... | |
| virtual void | setVarAt (const int &, const V &v) |
| Updates the ith variable of the solution with the value v. More... | |
| virtual void | setObjAt (const int &, const O &obj) |
| Updates the ith objective with the value obj. More... | |
| virtual void | setConstAt (const int &, const O &cons) |
| Updates the ith constraint value with the value. More... | |
| virtual V | getVarAt (const int &index) const |
| Returns the ith variable if its in the valid range. More... | |
| virtual O | getObjAt (const int &index) const |
| Returns the ith objective value if exists. More... | |
| virtual O | getConstAt (const int &index) const |
| Returns the ith constraint value if exists. More... | |
| virtual float | getFitness () const |
| Get the fitness of the solution. More... | |
| virtual void | setFitness (const float &f) |
| Set the fitness of the solution. More... | |
| float | getConstraintCoeff () const |
| Get the constraint coefficient of the solutions. This value means different for every problem. In most cases is the weighted sum of constraint violation values. More... | |
| void | setConstraintCoeff (float constraintCoeff) |
| Set the constraint coefficient value. More... | |
| virtual json | to_json () const |
| Creates and returns a JSON representation of the solution. More... | |
Protected Attributes | |
| int | nVars |
| int | nObjs |
| int | nCons |
| float | fitness |
| float | constraintCoeff |
| vector< O > | objectives |
| vector< V > | variables |
| vector< O > | constraints |
Class to represent a solution to the optimization problems in the tool.
| V | Type of the variables of the solution (float, bool, int, etc) |
| O | Type of the objectives of the solution (float, bool, int, etc) |
Creates a Solution with all parameters set to zero.
| V | |
| O |
| Solution< V, O >::Solution | ( | const int & | nVars, |
| const int & | nObjs | ||
| ) |
Creates a new solution with the given dimension (nVars) and nObjs number of objectives.
| V | |
| O |
| nVars | |
| nObjs |
| Solution< V, O >::Solution | ( | const int & | nVars, |
| const int & | nObjs, | ||
| const int & | nCons | ||
| ) |
Creates a new solution with the given dimension (nVars), nObjs number of objectives and nCons number of constraints.
| V | |
| O |
| nVars | |
| nObjs | |
| nCons |
Creates a new solution with the information from copy.
| V | |
| O |
| copy |
Creates a new solution with the information from the pointer to other solution.
| V | |
| O |
| copy |
|
virtual |
Returns the ith constraint value if exists.
| V | |
| O |
| index |
|
inline |
Get the constraint coefficient of the solutions. This value means different for every problem. In most cases is the weighted sum of constraint violation values.
|
inlinevirtual |
Get the constraint values of the solution.
|
inlinevirtual |
Get the Crow Distance object.
|
inlinevirtual |
Get the fitness of the solution.
|
inlinevirtual |
Get the number of constraint in the solution.
|
inlinevirtual |
Get the number of objectives of the solution.
|
inlinevirtual |
Get the number of variables (dimension) of the solution.
|
virtual |
Returns the ith objective value if exists.
| V | |
| O |
| index |
|
inlinevirtual |
Returns the objective values of the solution.
|
inlinevirtual |
Get the identifier of the solution in the population. Only used in the Non-Dominated Sorting operator.
|
virtual |
Returns the ith variable if its in the valid range.
| V | |
| O |
| index |
|
inlinevirtual |
Get the variables of the solution.
| Solution< V, O > & Solution< V, O >::operator= | ( | const Solution< V, O > & | copy | ) |
Copies a solution using the assignment operator.
| V | |
| O |
| copy |
| bool Solution< V, O >::operator== | ( | const Solution< V, O > & | other | ) | const |
Compares whether two solutions are equal.
| V | |
| O |
| other |
|
virtual |
Updates the ith constraint value with the value.
| V | |
| O |
| index | |
| value |
|
inline |
Set the constraint coefficient value.
| constraintCoeff |
|
virtual |
Updates the constraints of the solution.
| V | |
| O |
| constr |
|
inlinevirtual |
Set the Crow Distance object.
| d |
|
inlinevirtual |
Set the fitness of the solution.
| f |
|
inlinevirtual |
Set the number of objectives of the solution.
| numberOfObjs |
|
inlinevirtual |
Set the number of constraints of the solution.
| nConstraints |
|
inlinevirtual |
Set the number of variables (dimension) of the solution.
| numberOfVars |
|
virtual |
Updates the ith objective with the value obj.
| V | |
| O |
| index | |
| obj |
|
virtual |
Updates the objective values of the solution.
| V | |
| O |
| objs |
|
inlinevirtual |
Set the identifier of the solution in the population. Only used in the Non-Dominated Sorting operator.
| id |
|
virtual |
Updates the ith variable of the solution with the value v.
| V | |
| O |
| index | |
| v |
|
virtual |
Updates the variable values (dimension) of the solution.
| V | |
| O |
| vars |
Creates and returns a JSON representation of the solution.
| V | |
| O |
Reimplemented in TSPInstance, KPInstance, BPPInstance, AbstractInstance< V, O >, AbstractInstance< float, float >, AbstractInstance< int, int >, and AbstractInstance< int, float >.
|
protected |
Coefficient of constraint violation.
|
protected |
Constraint values of the solution
|
protected |
Fitness value of the solution. Always float.
|
protected |
Number of constraints of the solution.
|
protected |
Number of objectives of the solution.
|
protected |
Number of variables of the solution (dimension).
|
protected |
Objective values of the solution
|
protected |
Variable values of the solution (genotype)