dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
AbstractDomain< OptProblem, InstSolution > Class Template Referenceabstract

EIG Instance Generation Problem. Abstract Problem for the EIG. This problem will be used as a superclass for any new instance generation problem. This is the type of problem for the EIG, not for the evaluation phase. It acts as a wrapper for the EIG. More...

#include <AbstractDomain.h>

Inheritance diagram for AbstractDomain< OptProblem, InstSolution >:
Problem< InstSolution >

Public Member Functions

 AbstractDomain ()
 Construct a new AbstractDomain<OptProblem, InstSolution>AbstractDomain object. More...
 
 AbstractDomain (const int &numberOfVars, const int &numberOfObjectives, const int &nCons)
 Construct a new AbstractDomain<OptProblem, InstSolution>AbstractDomain object. More...
 
virtual shared_ptr< OptProblem > genOptProblem (const InstSolution &instance) const =0
 Generates a shared_ptr to an optimisation problem represented in the InstSolution given as a parameter. More...
 
virtual int getOptimizationDirection (const int i) const
 Returns the optimization direction for each objective in the problem. It returns Minimize or Maximize accordingly. This method must be implemented in the subclasses. More...
 
virtual vector< InstSolution > createSolutions (const int &maxSolutions) const =0
 Generates and returns a vector of InstSolutions. Instances of the optimisation problem. More...
 
virtual void beforeEvaluation (vector< InstSolution > &)=0
 Method to apply operations to the instances before evaluate them This is problem dependent.
 
virtual void afterEvaluation (vector< InstSolution > &)=0
 Method to apply operations to the instances after evaluate them This is problem dependent.
 
- Public Member Functions inherited from Problem< InstSolution >
 Problem ()
 Creates a new Problem with all parameters to zero. More...
 
 Problem (const int &numberOfVars, const int &numberOfObjectives, const int &nCons)
 Construct a new Problem with all the given parameters. More...
 
 Problem (const Problem *copy)
 
virtual bool evaluateConstraints (InstSolution &sol) const=0
 Method to evaluate whether a solution is feasible or not. This method must be implemented in the subclasses. More...
 
virtual void evaluate (InstSolution &sol) const=0
 Method to evaluate a solution using the proper problem formulation. This method must be implemented in the subclasses. More...
 
virtual InstSolution createSolution () const=0
 Creates a new solution for the problem. Usually uses problem information and generates a solution randomly. This method must be implemented in the subclasses. More...
 
virtual InstSolution createSolution (ParallelPRNG &engine) const=0
 
virtual float getUpperLimit (const int i) const=0
 Returns the upper bound to the problem at dimension i. This method must be implemented in the subclasses. More...
 
virtual float getLowerLimit (const int i) const=0
 Returns the lower bound to the problem at dimension i. This method must be implemented in the subclasses. More...
 
virtual string getName () const=0
 Returns the name of the problem. This method must be implemented in the subclasses. More...
 
virtual void readData (const std::string &path)=0
 Method to read problem information from the given path. This method must be implemented in the subclasses. More...
 
virtual json to_json () const
 Creates a JSON object with the information of the Problem. More...
 
int getNumberOfVars () const
 Get the number of variables (dimension) of the problem. More...
 
void setNumberOfVars (int nVars)
 Sets the number of variables (dimension) of the problem. More...
 
int getNumberOfObjs () const
 Get the number of objectives of the problem. More...
 
void setNumberOfObjs (int nObjs)
 Sets the number of objectives to the problem. More...
 
int getNumberOfCons () const
 Get the number the constraint of the problem. More...
 
void setNumberOfCons (int nCons)
 Sets the number of constraint of the problem. More...
 

Protected Attributes

int internalDimension
 
- Protected Attributes inherited from Problem< InstSolution >
int numberOfVars
 
int numberOfObjs
 
int numberOfCons
 

Detailed Description

template<typename OptProblem, typename InstSolution>
class AbstractDomain< OptProblem, InstSolution >

EIG Instance Generation Problem. Abstract Problem for the EIG. This problem will be used as a superclass for any new instance generation problem. This is the type of problem for the EIG, not for the evaluation phase. It acts as a wrapper for the EIG.

Template Parameters
OptProblem
InstSolution

Constructor & Destructor Documentation

◆ AbstractDomain() [1/2]

template<typename OptProblem , typename InstSolution >
AbstractDomain< OptProblem, InstSolution >::AbstractDomain

Construct a new AbstractDomain<OptProblem, InstSolution>AbstractDomain object.

Template Parameters
OptSolutionSolution type of the optimisation problem.
InstSolutionSolution type of the EIG problem.

◆ AbstractDomain() [2/2]

template<typename OptProblem , typename InstSolution >
AbstractDomain< OptProblem, InstSolution >::AbstractDomain ( const int &  numberOfVars,
const int &  numberOfObjectives,
const int &  nCons 
)

Construct a new AbstractDomain<OptProblem, InstSolution>AbstractDomain object.

Template Parameters
OptSolutionSolution type of the optimisation problem.
InstSolutionSolution type of the EIG problem.
Parameters
numberOfVarsInteger representing the dimnesion (number of variables) of the solution
numberOfObjectivesInteger representing the number of objectives of the solution
nConsInteger representing the number of constraints of the solution

Member Function Documentation

◆ createSolutions()

template<typename OptProblem , typename InstSolution >
virtual vector<InstSolution> AbstractDomain< OptProblem, InstSolution >::createSolutions ( const int &  maxSolutions) const
pure virtual

Generates and returns a vector of InstSolutions. Instances of the optimisation problem.

Parameters
maxSolutionspopulation size
Returns
vector<InstSolution>

Implemented in TSPDomain, KPDomain, and BPPDomain.

◆ genOptProblem()

template<typename OptProblem , typename InstSolution >
virtual shared_ptr<OptProblem> AbstractDomain< OptProblem, InstSolution >::genOptProblem ( const InstSolution &  instance) const
pure virtual

Generates a shared_ptr to an optimisation problem represented in the InstSolution given as a parameter.

Parameters
instanceReference to a InstSolution type
Returns
shared_ptr<OptProblem>

Implemented in TSPDomain, KPDomain, and BPPDomain.

◆ getOptimizationDirection()

template<typename OptProblem , typename InstSolution >
virtual int AbstractDomain< OptProblem, InstSolution >::getOptimizationDirection ( const int  i) const
inlinevirtual

Returns the optimization direction for each objective in the problem. It returns Minimize or Maximize accordingly. This method must be implemented in the subclasses.

Parameters
iDimension to check
Returns
Minimize or Maximize constants.

Implements Problem< InstSolution >.

Reimplemented in TSPDomain, KPDomain, and BPPDomain.


The documentation for this class was generated from the following file: