$darkmode
DENOPTIM
denoptim.fitness.FitnessProvider Class Reference

DENOPTIM's (internal) fitness provider calculates the value of Variables that are used in an expression for calculating a single numerical results, i.e., the fitness. More...

Collaboration diagram for denoptim.fitness.FitnessProvider:
[legend]

Public Member Functions

 FitnessProvider (List< DescriptorForFitness > descriptors, String expression, Logger logger)
 Constructs an instance that will calculate the fitness according to the given parameters. More...
 
double getFitness (IAtomContainer iac) throws Exception
 Calculated the fitness according to the current configuration. More...
 

Protected Attributes

DescriptorEngine engine
 The engine that collects and calculates descriptors. More...
 

Private Member Functions

double processValue (String descName, DescriptorForFitness descriptor, IDescriptor implementation, IImplementationSpecification descSpec, DescriptorValue value, String varName, IAtomContainer iac) throws Exception
 Takes the value and checks that it is all good, then processes the value to extract the result defined by the DescriptorForFitness, puts a human-readable version in the molecular representation, and the numerical value for fitness calculation in the appropriate map. More...
 

Private Attributes

List< DescriptorForFitnessdescriptors
 The collection of descriptors to consider. More...
 
String expression
 The equation used to calculate the fitness value. More...
 
Logger logger = null
 Program-specific logger. More...
 

Detailed Description

DENOPTIM's (internal) fitness provider calculates the value of Variables that are used in an expression for calculating a single numerical results, i.e., the fitness.

Each the value of each Variable derived from the calculation of DescriptorForFitness for a specific chemical object.

Author
Marco Foscato

Definition at line 70 of file FitnessProvider.java.

Constructor & Destructor Documentation

◆ FitnessProvider()

denoptim.fitness.FitnessProvider.FitnessProvider ( List< DescriptorForFitness descriptors,
String  expression,
Logger  logger 
)

Constructs an instance that will calculate the fitness according to the given parameters.

Note that the descriptors implementation instances are not the same (not same hash) than those that will be used to compute the descriptor values. This to make the descriptor calculations thread-safe. Any parameter that is set to the descriptors argument is copied into the new instances of the descriptor implementations.

Parameters
descriptorsthe list of descriptors to calculate in order to calculate the fitness value
expressionthe string defining in expression-language format the mathematical formulation used to calculate the fitness from the descriptor values.

Definition at line 109 of file FitnessProvider.java.

References denoptim.fitness.DescriptorForFitness.cloneAllButImpl(), denoptim.fitness.FitnessProvider.descriptors, denoptim.fitness.FitnessProvider.engine, denoptim.fitness.FitnessProvider.expression, denoptim.fitness.DescriptorForFitness.getClassName(), and denoptim.fitness.FitnessProvider.logger.

Here is the call graph for this function:

Member Function Documentation

◆ getFitness()

double denoptim.fitness.FitnessProvider.getFitness ( IAtomContainer  iac) throws Exception

Calculated the fitness according to the current configuration.

The values of the descriptors, as well as the fitness value, are added to the properties of the atom container.

Parameters
iacthe chemical object to evaluate.
Returns
the final value of the fitness.
Exceptions
Exceptionif an error occurs during calculation of the descriptor or any initial configuration was missing/wrong.

Definition at line 164 of file FitnessProvider.java.

References denoptim.fitness.FitnessProvider.descriptors, denoptim.constants.DENOPTIMConstants.DUMMYATMSYMBOL, denoptim.fitness.FitnessProvider.engine, denoptim.fitness.FitnessProvider.expression, denoptim.constants.DENOPTIMConstants.FITNESSTAG, denoptim.utils.ManySMARTSQuery.getAllMatches(), denoptim.utils.ManySMARTSQuery.getMessage(), denoptim.utils.ManySMARTSQuery.getProblem(), denoptim.fitness.DescriptorForFitness.getVariables(), denoptim.utils.ManySMARTSQuery.hasProblems(), denoptim.fitness.FitnessProvider.logger, denoptim.utils.MathUtils.mean(), denoptim.fitness.FitnessProvider.processValue(), denoptim.utils.DummyAtomHandler.removeDummy(), denoptim.utils.DummyAtomHandler.removeDummyInHapto(), and denoptim.fitness.DescriptorForFitness.shortName.

Referenced by denoptim.task.FitnessTask.runInternalFitness(), denoptim.fitness.FitnessProviderTest.testGetConstantFitness(), denoptim.fitness.FitnessProviderTest.testGetFitness(), denoptim.fitness.FitnessProviderTest.testGetFitnessWithCustomDescriptors(), and denoptim.fitness.FitnessProviderTest.testGetFitnessWithParametrizedDescriptors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processValue()

double denoptim.fitness.FitnessProvider.processValue ( String  descName,
DescriptorForFitness  descriptor,
IDescriptor  implementation,
IImplementationSpecification  descSpec,
DescriptorValue  value,
String  varName,
IAtomContainer  iac 
) throws Exception
private

Takes the value and checks that it is all good, then processes the value to extract the result defined by the DescriptorForFitness, puts a human-readable version in the molecular representation, and the numerical value for fitness calculation in the appropriate map.

Exceptions
Exception

Definition at line 491 of file FitnessProvider.java.

Referenced by denoptim.fitness.FitnessProvider.getFitness().

Here is the caller graph for this function:

Member Data Documentation

◆ descriptors

List<DescriptorForFitness> denoptim.fitness.FitnessProvider.descriptors
private

The collection of descriptors to consider.

Definition at line 80 of file FitnessProvider.java.

Referenced by denoptim.fitness.FitnessProvider.FitnessProvider(), and denoptim.fitness.FitnessProvider.getFitness().

◆ engine

DescriptorEngine denoptim.fitness.FitnessProvider.engine
protected

◆ expression

String denoptim.fitness.FitnessProvider.expression
private

The equation used to calculate the fitness value.

Definition at line 85 of file FitnessProvider.java.

Referenced by denoptim.fitness.FitnessProvider.FitnessProvider(), and denoptim.fitness.FitnessProvider.getFitness().

◆ logger

Logger denoptim.fitness.FitnessProvider.logger = null
private

Program-specific logger.

Definition at line 90 of file FitnessProvider.java.

Referenced by denoptim.fitness.FitnessProvider.FitnessProvider(), and denoptim.fitness.FitnessProvider.getFitness().


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