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

Knapsack Problem without repairing operator. More...

#include <KPNR.h>

Inheritance diagram for KPNR:
KP Problem< BoolFloatSolution >

Public Member Functions

 KPNR (const int &numberOfVars)
 
 KPNR (const string &pathToInstance)
 
 KPNR (const int &numberOfVars, const int &capacity, const vector< int > &weights, const vector< int > &profits)
 
 KPNR (const int &numberOfVars, const int &lowerWeight, const int &upperWeight, const int &lowerProfit, const int &upperProfit)
 
void evaluate (BoolFloatSolution &solution) const override
 
- Public Member Functions inherited from KP
 KP (const int &numberOfVars)
 
 KP (const string &pathToInstance)
 
 KP (const int &numberOfVars, const int &capacity, const vector< int > &weights, const vector< int > &profits)
 
 KP (const int &numberOfVars, const int &lowerWeight, const int &upperWeight, const int &lowerProfit, const int &upperProfit)
 
 KP (const KP *)
 
float getUpperLimit (int i) const override
 Returns the upper bound to the problem at dimension i. This method must be implemented in the subclasses. More...
 
int getOptimizationDirection (const int i) const override
 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...
 
float getLowerLimit (int i) const override
 Returns the lower bound to the problem at dimension i. This method must be implemented in the subclasses. More...
 
string getName () const override
 Returns the name of the problem. This method must be implemented in the subclasses. More...
 
bool evaluateConstraints (BoolFloatSolution &ptr) const override
 
BoolFloatSolution createSolution () const override
 
BoolFloatSolution createSolution (ParallelPRNG &engine) const override
 
int getLowWeight () const
 
void setLowWeight (int lowWeight)
 
int getUpWeight () const
 
void setUpWeight (int upWeight)
 
int getLowProfit () const
 
void setLowProfit (int lowProfit)
 
int getUpProfit () const
 
void setUpProfit (int upProfit)
 
const vector< int > & getProfits () const
 
void setProfits (const vector< int > &profits)
 
const vector< int > & getWeights () const
 
void setWeights (const vector< int > &weights)
 
int getCapacity () const
 
void setCapacity (int capacity)
 
void readData (const string &path) override
 
json to_json () const override
 
vector< iEff > getItemsSortedByEff () const
 
- Public Member Functions inherited from Problem< BoolFloatSolution >
 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 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...
 

Additional Inherited Members

- Static Public Attributes inherited from KP
static const string INSTANCE = "Instance"
 
static const string PROFITS = "Profits"
 
static const string WEIGHTS = "Weights"
 
static const string CAPACITY = "Capacity"
 
- Protected Member Functions inherited from KP
void computeEfficiency ()
 
void repair (BoolFloatSolution &solution) const
 
- Protected Attributes inherited from KP
int lowWeight
 
int upWeight
 
int lowProfit
 
int upProfit
 
vector< int > profits
 
vector< int > weights
 
int capacity
 
std::string pathToInstance
 
vector< iEff > itemsEff
 
- Protected Attributes inherited from Problem< BoolFloatSolution >
int numberOfVars
 
int numberOfObjs
 
int numberOfCons
 

Detailed Description

Knapsack Problem without repairing operator.

Member Function Documentation

◆ evaluate()

void KPNR::evaluate ( BoolFloatSolution solution) const
overridevirtual

Evalua una solucion al problema de la mochila

Parameters
solution

Reimplemented from KP.


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