dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
BPPDomain Class Reference

Instance Generator for Bin-Packing Problem. More...

#include <BPPDomain.h>

Inheritance diagram for BPPDomain:
AbstractDomain< BPP, BPPInstance > Problem< S >

Public Member Functions

 BPPDomain (const int &numberOfVars, const int &numberOfObjs=1, const int &capacity=100)
 
 BPPDomain (const string &pathToInstance)=delete
 
 BPPDomain (const int &numberOfVars, const int &numberOfObjs, const int &capacity, const int &minW, const int &maxW)
 
shared_ptr< BPPgenOptProblem (const BPPInstance &instance) const override
 Creates a Optimisation Problem for the Configurations on the EIG In this case, BPP Problem. More...
 
void evaluate (BPPInstance &solution) const override
 
vector< BPPInstancecreateSolutions (const int &maxSolutions) const override
 
void beforeEvaluation (vector< BPPInstance > &) override
 
void afterEvaluation (vector< BPPInstance > &) override
 Method applied after evaluation the population of solutions. More...
 
BPPInstance createSolution () const override
 
BPPInstance createSolution (ParallelPRNG &engine) const override
 
bool evaluateConstraints (BPPInstance &solution) const override
 
int getOptimizationDirection (const int i) const override
 
string getName () const override
 Returns the name of the problem. This method must be implemented in the subclasses. More...
 
float getUpperLimit (const int i) const override
 
float getLowerLimit (const int i) const override
 
int getMaxWeight () const
 
int getMinWeight () const
 
void setMaxWeight (int maxWeight)
 
void setMinWeight (int minWeight)
 
json to_json () const override
 Creates a JSON object with the information of the Problem. More...
 
void readData (const string &path) override
 
- Public Member Functions inherited from AbstractDomain< BPP, BPPInstance >
 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...
 
- Public Member Functions inherited from Problem< S >
 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 (S &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 (S &sol) const =0
 Method to evaluate a solution using the proper problem formulation. 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...
 
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 maxWeight
 
int minWeight
 
int defaultCapacity
 
- Protected Attributes inherited from AbstractDomain< BPP, BPPInstance >
int internalDimension
 
- Protected Attributes inherited from Problem< S >
int numberOfVars
 
int numberOfObjs
 
int numberOfCons
 

Detailed Description

Instance Generator for Bin-Packing Problem.

The number of variables (dimension) is set as the number of variables which it is used to create an object (N items).The maximum capacity of the bins, is calculated as the 80% of the weights from the bins

Member Function Documentation

◆ afterEvaluation()

void BPPDomain::afterEvaluation ( vector< BPPInstance > &  solutions)
overridevirtual

Method applied after evaluation the population of solutions.

Parameters
solutions

Implements AbstractDomain< BPP, BPPInstance >.

◆ beforeEvaluation()

void BPPDomain::beforeEvaluation ( vector< BPPInstance > &  solutions)
overridevirtual

Method which re-calculates the capacity of the instances before evaluate them The capacity is set as the 80% of the sum of the weights of the items

Parameters
vector1

Implements AbstractDomain< BPP, BPPInstance >.

◆ createSolution()

BPPInstance BPPDomain::createSolution ( ) const
overridevirtual

Generates a new solution without args

Returns

Implements Problem< S >.

◆ createSolutions()

vector< BPPInstance > BPPDomain::createSolutions ( const int &  maxSolutions) const
overridevirtual

Creates a population of solutions

Parameters
maxSolutions
Returns

Implements AbstractDomain< BPP, BPPInstance >.

◆ evaluate()

void BPPDomain::evaluate ( BPPInstance solution) const
override

Method which evaluates a solution of the BPP Instance Generation Problem

Parameters
solution

◆ genOptProblem()

shared_ptr< BPP > BPPDomain::genOptProblem ( const BPPInstance instance) const
overridevirtual

Creates a Optimisation Problem for the Configurations on the EIG In this case, BPP Problem.

Returns

Implements AbstractDomain< BPP, BPPInstance >.

◆ getLowerLimit()

float BPPDomain::getLowerLimit ( const int  i) const
overridevirtual

Returns the lower bound for the variable i

Parameters
i
Returns

Implements Problem< S >.

◆ getName()

string BPPDomain::getName ( ) const
inlineoverridevirtual

Returns the name of the problem. This method must be implemented in the subclasses.

Returns
string

Implements Problem< S >.

◆ getOptimizationDirection()

int BPPDomain::getOptimizationDirection ( const int  i) const
overridevirtual

Method which returns the optimisation direction for each objective Minimize

Parameters
i
Returns

Reimplemented from AbstractDomain< BPP, BPPInstance >.

◆ getUpperLimit()

float BPPDomain::getUpperLimit ( const int  i) const
overridevirtual

Returns the upper bound for the variable i

Parameters
i
Returns

Implements Problem< S >.

◆ to_json()

json BPPDomain::to_json ( ) const
overridevirtual

Creates a JSON object with the information of the Problem.

Template Parameters
S
Returns
a json representation of the problem

Reimplemented from Problem< S >.


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