$darkmode
DENOPTIM
denoptim.task.FitnessTask Class Referenceabstract

Task that assesses the fitness of a given graph. More...

Inheritance diagram for denoptim.task.FitnessTask:
[legend]
Collaboration diagram for denoptim.task.FitnessTask:
[legend]

Public Member Functions

 FitnessTask (FitnessParameters settings, Candidate c)
 
- Public Member Functions inherited from denoptim.task.Task
 Task (final int id)
 
int getId ()
 
void setVerbosity (int verbosity)
 Set the verbosity: i.e., amount of log printed by this class. More...
 
void setWorkSpace (File workDir)
 Sets the pathname of the work space, i.e., the location where the task is supposed to use move to or to threat as the result of "pwd" at runtime. More...
 
boolean isCompleted ()
 
boolean foundException ()
 
Throwable getException ()
 
String getErrorMessage ()
 
void stopTask ()
 Stop the task if not already completed. More...
 
String toString ()
 Returns a string identifying this task by its ID and reporting whether an exception has been thrown and if the tasks is completed. More...
 
void setNotify (boolean notify)
 

Protected Member Functions

void runFitnessProvider () throws DENOPTIMException
 This method runs the actual evaluation of the fitness, whether that is run internally (i.e., within this instance of the JAVA VM), or delegated to an external child process. More...
 

Protected Attributes

DGraph dGraph
 The graph representation of the entity to evaluate. More...
 
IAtomContainer fitProvMol = null
 The chemical representation of the entity to evaluate. More...
 
Candidate result
 The data structure holding the results of this task. More...
 
String fitProvInputFile
 The file where we store the input to the fitness provider. More...
 
String fitProvOutFile
 The file where we store the final output from the fitness provider. More...
 
String fitProvPNGFile
 The file where we store the graphical representation of the candidate (i.e., a picture). More...
 
String fitProvUIDFile = null
 The file where we store the list of unique identifiers or previously evaluated candidates. More...
 
boolean fitnessIsRequired = false
 Flag specifying if a valid fitness value is required to consider the task successfully completed. More...
 
FitnessParameters fitnessSettings
 Settings for the calculation of the fitness. More...
 
- Protected Attributes inherited from denoptim.task.Task
boolean notifyGlobalTaskManager = false
 Flag controlling whether this task is expected to notify the static task manager. More...
 
boolean completed = false
 Flag about completion. More...
 
boolean hasException = false
 Flag about exception. More...
 
String errMsg = ""
 Error message produced by any subtask. More...
 
Throwable thrownExc
 Exception thrown. More...
 
int id
 A user-assigned id for this task. More...
 
ProcessHandler processHandler
 Executor for external bash script. More...
 
File workDir
 The file system location where we want to be placed when doing the work. More...
 
int verbosity = 0
 Verbosity level. More...
 
final String SEP = System.getProperty("file.separator")
 System-dependent file separator. More...
 
final String NL = System.getProperty("line.separator")
 System-dependent line separator (newline) More...
 

Private Member Functions

boolean runExternalFitness () throws DENOPTIMException
 
boolean runInternalFitness () throws DENOPTIMException
 

Additional Inherited Members

- Public Attributes inherited from denoptim.task.Task
Object lock = new Object()
 Lock for addressing synchronization issues. More...
 

Detailed Description

Task that assesses the fitness of a given graph.

Definition at line 49 of file FitnessTask.java.

Constructor & Destructor Documentation

◆ FitnessTask()

denoptim.task.FitnessTask.FitnessTask ( FitnessParameters  settings,
Candidate  c 
)

Definition at line 109 of file FitnessTask.java.

References denoptim.graph.Candidate.getGraph(), and denoptim.utils.TaskUtils.getUniqueTaskIndex().

Here is the call graph for this function:

Member Function Documentation

◆ runExternalFitness()

boolean denoptim.task.FitnessTask.runExternalFitness ( ) throws DENOPTIMException
private
Returns
true if it is all good, false in case of any reason for premature returning of the results (error generated in from the external tool, rejection on the candidate).
Exceptions
DENOPTIMException
Exception

Definition at line 197 of file FitnessTask.java.

References denoptim.constants.DENOPTIMConstants.ATMPROPVERTEXID, denoptim.graph.DGraph.cleanup(), denoptim.task.FitnessTask.dGraph, denoptim.task.Task.errMsg, denoptim.task.FitnessTask.fitnessIsRequired, denoptim.task.FitnessTask.fitnessSettings, denoptim.constants.DENOPTIMConstants.FITNESSTAG, denoptim.task.FitnessTask.fitProvInputFile, denoptim.task.FitnessTask.fitProvMol, denoptim.task.FitnessTask.fitProvOutFile, denoptim.task.FitnessTask.fitProvUIDFile, denoptim.task.ProcessHandler.getErrorOutput(), denoptim.task.ProcessHandler.getExitCode(), denoptim.fitness.FitnessParameters.getExternalFitnessProvider(), denoptim.fitness.FitnessParameters.getExternalFitnessProviderInterpreter(), denoptim.programs.RunTimeParameters.getLogger(), denoptim.graph.Candidate.getName(), denoptim.task.Task.hasException, denoptim.task.Task.lock, denoptim.constants.DENOPTIMConstants.MOLERRORTAG, denoptim.task.Task.NL, denoptim.task.Task.processHandler, denoptim.io.DenoptimIO.readAllAtomContainers(), denoptim.task.FitnessTask.result, denoptim.task.ProcessHandler.runProcess(), denoptim.graph.Candidate.setChemicalRepresentation(), denoptim.graph.Candidate.setError(), denoptim.graph.Candidate.setFitness(), denoptim.graph.Candidate.setUID(), denoptim.task.Task.thrownExc, denoptim.constants.DENOPTIMConstants.UNIQUEIDTAG, denoptim.constants.DENOPTIMConstants.UNREADABLEFILEPOSTFIX, and denoptim.task.Task.workDir.

Referenced by denoptim.task.FitnessTask.runFitnessProvider().

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

◆ runFitnessProvider()

void denoptim.task.FitnessTask.runFitnessProvider ( ) throws DENOPTIMException
protected

This method runs the actual evaluation of the fitness, whether that is run internally (i.e., within this instance of the JAVA VM), or delegated to an external child process.

Returns
the object with data obtained from the fitness provider.
Exceptions
DENOPTIMException

Definition at line 126 of file FitnessTask.java.

References denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer(), denoptim.task.FitnessTask.dGraph, denoptim.task.FitnessTask.fitnessSettings, denoptim.task.FitnessTask.fitProvInputFile, denoptim.task.FitnessTask.fitProvMol, denoptim.task.FitnessTask.fitProvOutFile, denoptim.task.FitnessTask.fitProvPNGFile, denoptim.programs.RunTimeParameters.getLogger(), denoptim.programs.RunTimeParameters.getRandomizer(), denoptim.fitness.FitnessParameters.makePictures, denoptim.utils.MoleculeUtils.moleculeToPNG(), denoptim.constants.DENOPTIMConstants.PROVENANCE, denoptim.task.FitnessTask.result, denoptim.task.FitnessTask.runExternalFitness(), denoptim.task.FitnessTask.runInternalFitness(), denoptim.graph.Candidate.setChemicalRepresentation(), denoptim.graph.Candidate.setImageFile(), denoptim.graph.Candidate.setSDFFile(), denoptim.fitness.FitnessParameters.useExternalFitness, denoptim.fitness.FitnessParameters.writeCandidatesOnDisk, denoptim.io.DenoptimIO.writeCandidateToFile(), and denoptim.io.DenoptimIO.writeSDFFile().

Referenced by denoptim.ga.OffspringEvaluationTask.call(), denoptim.programs.fitnessevaluator.FitnessEvaluationTask.call(), and denoptim.combinatorial.GraphBuildingTask.sendToFitnessProvider().

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

◆ runInternalFitness()

boolean denoptim.task.FitnessTask.runInternalFitness ( ) throws DENOPTIMException
private
Returns
true if it is all good, false in case of any reason for premature returning of the results.
Exceptions
DENOPTIMException
Exception

Definition at line 400 of file FitnessTask.java.

References denoptim.task.Task.errMsg, denoptim.task.FitnessTask.fitnessSettings, denoptim.constants.DENOPTIMConstants.FITNESSTAG, denoptim.task.FitnessTask.fitProvMol, denoptim.fitness.FitnessParameters.getDescriptors(), denoptim.fitness.FitnessProvider.getFitness(), denoptim.fitness.FitnessParameters.getFitnessExpression(), denoptim.programs.RunTimeParameters.getLogger(), denoptim.graph.Candidate.getName(), denoptim.constants.DENOPTIMConstants.MOLERRORTAG, denoptim.task.Task.NL, denoptim.task.FitnessTask.result, denoptim.graph.Candidate.setError(), and denoptim.graph.Candidate.setFitness().

Referenced by denoptim.task.FitnessTask.runFitnessProvider().

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

Member Data Documentation

◆ dGraph

◆ fitnessIsRequired

boolean denoptim.task.FitnessTask.fitnessIsRequired = false
protected

Flag specifying if a valid fitness value is required to consider the task successfully completed.

Definition at line 100 of file FitnessTask.java.

Referenced by denoptim.task.FitnessTask.runExternalFitness().

◆ fitnessSettings

◆ fitProvInputFile

String denoptim.task.FitnessTask.fitProvInputFile
protected
Initial value:
= "noName"
+ DENOPTIMConstants.FITFILENAMEEXTIN

The file where we store the input to the fitness provider.

Definition at line 74 of file FitnessTask.java.

Referenced by denoptim.ga.OffspringEvaluationTask.OffspringEvaluationTask(), denoptim.task.FitnessTask.runExternalFitness(), denoptim.task.FitnessTask.runFitnessProvider(), and denoptim.combinatorial.GraphBuildingTask.sendToFitnessProvider().

◆ fitProvMol

IAtomContainer denoptim.task.FitnessTask.fitProvMol = null
protected

The chemical representation of the entity to evaluate.

We do not check for consistency between this member and the graph representation. This data structure holds also lots of attributes that are not used in all subclasses extending the FitnessTask. Moreover, it will be updated once a presumably refined molecular representation is produced by a fitness provider.

Definition at line 64 of file FitnessTask.java.

Referenced by denoptim.ga.OffspringEvaluationTask.call(), denoptim.programs.fitnessevaluator.FitnessEvaluationTask.call(), denoptim.programs.fitnessevaluator.FitnessEvaluationTask.FitnessEvaluationTask(), denoptim.task.FitnessTask.runExternalFitness(), denoptim.task.FitnessTask.runFitnessProvider(), denoptim.task.FitnessTask.runInternalFitness(), and denoptim.combinatorial.GraphBuildingTask.sendToFitnessProvider().

◆ fitProvOutFile

String denoptim.task.FitnessTask.fitProvOutFile
protected

◆ fitProvPNGFile

String denoptim.task.FitnessTask.fitProvPNGFile
protected
Initial value:
= "noName"
+ DENOPTIMConstants.CANDIDATE2DEXTENSION

The file where we store the graphical representation of the candidate (i.e., a picture).

Definition at line 87 of file FitnessTask.java.

Referenced by denoptim.ga.OffspringEvaluationTask.OffspringEvaluationTask(), denoptim.task.FitnessTask.runFitnessProvider(), and denoptim.combinatorial.GraphBuildingTask.sendToFitnessProvider().

◆ fitProvUIDFile

String denoptim.task.FitnessTask.fitProvUIDFile = null
protected

The file where we store the list of unique identifiers or previously evaluated candidates.

Definition at line 94 of file FitnessTask.java.

Referenced by denoptim.ga.OffspringEvaluationTask.OffspringEvaluationTask(), denoptim.task.FitnessTask.runExternalFitness(), and denoptim.combinatorial.GraphBuildingTask.sendToFitnessProvider().

◆ result


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