$darkmode
DENOPTIM
denoptim.combinatorial.CombinatorialExplorerByLayer Class Reference

Generates all combinators of fragments by means of asynchronous threads. More...

Collaboration diagram for denoptim.combinatorial.CombinatorialExplorerByLayer:
[legend]

Public Member Functions

 CombinatorialExplorerByLayer (CEBLParameters settings)
 Constructor. More...
 
void stopRun ()
 Stops all subtasks and shutdown executor. More...
 
void run () throws DENOPTIMException
 Run the combinatorial exploration. More...
 

Package Attributes

final Map< GraphBuildingTask, Future< Object > > submittedAndFutures
 Submitted subtasks and their futures. More...
 
final List< GraphBuildingTasksubmitted
 Sorted list of subtasks. More...
 
final ThreadPoolExecutor tpe
 Asynchronous tasks manager. More...
 

Private Member Functions

boolean subtaskHasException ()
 Looks for exceptions in the subtasks and, if any, store its reference locally to allow reporting it back from the main thread. More...
 
boolean allTasksCompleted ()
 Check for completion of all subtasks. More...
 
void makeCheckPoint () throws DENOPTIMException
 Identify the task preceding the earliest non-completed task and use it to create a checkpoint file. More...
 
int countSubTasks ()
 
int exploreCombinationsAtGivenLevel (int level) throws DENOPTIMException
 Generate graphs by exploring all combination of fragments at a given level of a growing graph. More...
 
DGraph startNewGraphFromScaffold (int scafIdx) throws DENOPTIMException
 
void cleanup ()
 clean all reference to submitted tasks More...
 

Private Attributes

int verbosity = 0
 Verbosity level. More...
 
boolean restartFromChkPt = false
 Flag indicating to restart from checkpoint file. More...
 
int serFromChkRestart = 0
 Number of serialized graphs recovered from previous run database upon restart from checkpoint file. More...
 
int totSubmittedTasks = 0
 Number of tasks submitted directly of by subtasks. More...
 
Throwable thrownByTask
 If any, here we stores the exception returned by a subtask. More...
 
boolean firstAfterRestart = false
 Flag identifying the first iteration after restart from checkpoint. More...
 
CEBLParameters settings = null
 All settings controlling the tasks executed by this class. More...
 
FragmentSpaceParameters fsSettings = null
 Settings and definition of the fragment space. More...
 

Detailed Description

Generates all combinators of fragments by means of asynchronous threads.

Combinations are produced by layer of fragments on root graphs, which can be single fragments (i.e., scaffolds) or complex graphs.

Author
Marco Foscato

Definition at line 61 of file CombinatorialExplorerByLayer.java.

Constructor & Destructor Documentation

◆ CombinatorialExplorerByLayer()

Member Function Documentation

◆ allTasksCompleted()

boolean denoptim.combinatorial.CombinatorialExplorerByLayer.allTasksCompleted ( )
private

Check for completion of all subtasks.

Returns
true if all subtasks are completed

Definition at line 247 of file CombinatorialExplorerByLayer.java.

References denoptim.combinatorial.CombinatorialExplorerByLayer.submitted.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.run().

Here is the caller graph for this function:

◆ cleanup()

◆ countSubTasks()

int denoptim.combinatorial.CombinatorialExplorerByLayer.countSubTasks ( )
private
Returns
the number of subtasks submitted, which includes both the tasks submitted by the executor (i.e., child tasks) and any other tasks possibly submitted by such child tasks.

Definition at line 332 of file CombinatorialExplorerByLayer.java.

References denoptim.combinatorial.CombinatorialExplorerByLayer.submitted, and denoptim.combinatorial.CombinatorialExplorerByLayer.totSubmittedTasks.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.run().

Here is the caller graph for this function:

◆ exploreCombinationsAtGivenLevel()

int denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel ( int  level) throws DENOPTIMException
private

Generate graphs by exploring all combination of fragments at a given level of a growing graph.

Note that in this context the 'level' is related to the initial root graph, which is considered to be level -1 no matter its size.

Parameters
levelthe current relative level
Returns
the number of submitted tasks
Exceptions
DENOPTIMException

Definition at line 584 of file CombinatorialExplorerByLayer.java.

References denoptim.combinatorial.CombinatorialExplorerByLayer.cleanup(), denoptim.constants.DENOPTIMConstants.EOL, denoptim.combinatorial.CombinatorialExplorerByLayer.firstAfterRestart, denoptim.combinatorial.CombinatorialExplorerByLayer.fsSettings, denoptim.fragspace.FragsCombinationIterator.getCandidatesMap(), denoptim.programs.combinatorial.CEBLParameters.getCheckPoint(), denoptim.programs.combinatorial.CEBLParameters.getCheckPointStep(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.programs.RunTimeParameters.getLogger(), denoptim.combinatorial.CEBLUtils.getNameOfStorageDir(), denoptim.combinatorial.CheckPoint.getNextIds(), denoptim.fragspace.FragsCombinationIterator.getNextIds(), denoptim.fragspace.FragsCombinationIterator.getNumGeneratedCombs(), denoptim.fragspace.FragsCombinationIterator.getNumRootAPs(), denoptim.programs.combinatorial.CEBLParameters.getRootGraphs(), denoptim.fragspace.FragsCombinationIterator.getSizesOfCandidateSets(), denoptim.fragspace.FragsCombinationIterator.getTotNumbCombs(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.programs.RunTimeParameters.getVerbosity(), denoptim.programs.RunTimeParameters.getWorkDirectory(), denoptim.fragspace.FragsCombinationIterator.hasNext(), denoptim.combinatorial.CombinatorialExplorerByLayer.makeCheckPoint(), denoptim.fragspace.FragsCombinationIterator.next(), denoptim.programs.combinatorial.CEBLParameters.prepareFilesForTests(), denoptim.io.DenoptimIO.readDENOPTIMGraphsFromJSONFile(), denoptim.combinatorial.CombinatorialExplorerByLayer.restartFromChkPt, denoptim.combinatorial.CheckPoint.serFileAlreadyUsed(), denoptim.constants.DENOPTIMConstants.SERGFILENAMEEXT, denoptim.combinatorial.GraphBuildingTask.setNextIds(), denoptim.fragspace.FragsCombinationIterator.setStartingPoint(), denoptim.combinatorial.CombinatorialExplorerByLayer.settings, denoptim.combinatorial.CombinatorialExplorerByLayer.startNewGraphFromScaffold(), denoptim.combinatorial.CombinatorialExplorerByLayer.stopRun(), denoptim.combinatorial.CEBLUtils.storeAllGraphsOfLevel(), denoptim.combinatorial.CombinatorialExplorerByLayer.submitted, denoptim.combinatorial.CombinatorialExplorerByLayer.submittedAndFutures, denoptim.combinatorial.CombinatorialExplorerByLayer.subtaskHasException(), denoptim.combinatorial.CombinatorialExplorerByLayer.thrownByTask, denoptim.combinatorial.CombinatorialExplorerByLayer.tpe, denoptim.programs.combinatorial.CEBLParameters.useGivenRoots, and denoptim.combinatorial.CombinatorialExplorerByLayer.verbosity.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.run().

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

◆ makeCheckPoint()

void denoptim.combinatorial.CombinatorialExplorerByLayer.makeCheckPoint ( ) throws DENOPTIMException
private

Identify the task preceding the earliest non-completed task and use it to create a checkpoint file.

Definition at line 269 of file CombinatorialExplorerByLayer.java.

References denoptim.programs.combinatorial.CEBLParameters.getCheckPoint(), denoptim.combinatorial.GraphBuildingTask.getGraphId(), denoptim.combinatorial.GraphBuildingTask.getLevel(), denoptim.combinatorial.GraphBuildingTask.getNextIds(), denoptim.combinatorial.GraphBuildingTask.getRootId(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.utils.GraphUtils.getUniqueMoleculeIndex(), denoptim.utils.GraphUtils.getUniqueVertexIndex(), denoptim.task.Task.isCompleted(), denoptim.combinatorial.CEBLUtils.serializeCheckPoint(), denoptim.combinatorial.CheckPoint.setLevel(), denoptim.combinatorial.CheckPoint.setNextIds(), denoptim.combinatorial.CheckPoint.setRootId(), denoptim.combinatorial.CheckPoint.setSafelyCompletedGraphId(), denoptim.combinatorial.CombinatorialExplorerByLayer.settings, denoptim.combinatorial.CheckPoint.setUnqGraphId(), denoptim.combinatorial.CheckPoint.setUnqMolId(), denoptim.combinatorial.CheckPoint.setUnqVrtId(), denoptim.combinatorial.CombinatorialExplorerByLayer.submitted, denoptim.combinatorial.CombinatorialExplorerByLayer.submittedAndFutures, and denoptim.combinatorial.CombinatorialExplorerByLayer.totSubmittedTasks.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel().

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

◆ run()

void denoptim.combinatorial.CombinatorialExplorerByLayer.run ( ) throws DENOPTIMException

Run the combinatorial exploration.

Definition at line 349 of file CombinatorialExplorerByLayer.java.

References denoptim.combinatorial.CombinatorialExplorerByLayer.allTasksCompleted(), denoptim.combinatorial.CombinatorialExplorerByLayer.cleanup(), denoptim.combinatorial.CombinatorialExplorerByLayer.countSubTasks(), denoptim.constants.DENOPTIMConstants.EOL, denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel(), denoptim.combinatorial.CombinatorialExplorerByLayer.firstAfterRestart, denoptim.programs.combinatorial.CEBLParameters.getCheckPoint(), denoptim.combinatorial.CheckPoint.getLatestSafelyCompletedGraphId(), denoptim.combinatorial.CheckPoint.getLevel(), denoptim.programs.RunTimeParameters.getLogger(), denoptim.programs.combinatorial.CEBLParameters.getMaxLevel(), denoptim.programs.combinatorial.CEBLParameters.getMaxWait(), denoptim.combinatorial.CEBLUtils.getNameOfStorageDir(), denoptim.combinatorial.CheckPoint.getUnqGraphId(), denoptim.combinatorial.CheckPoint.getUnqMolId(), denoptim.combinatorial.CheckPoint.getUnqVrtId(), denoptim.programs.combinatorial.CEBLParameters.getWaitStep(), denoptim.utils.GraphUtils.resetUniqueGraphCounter(), denoptim.utils.GraphUtils.resetUniqueMoleculeCounter(), denoptim.utils.GraphUtils.resetUniqueVertexCounter(), denoptim.combinatorial.CombinatorialExplorerByLayer.restartFromChkPt, denoptim.combinatorial.CombinatorialExplorerByLayer.serFromChkRestart, denoptim.constants.DENOPTIMConstants.SERGFILENAMEEXT, denoptim.constants.DENOPTIMConstants.SERGFILENAMEROOT, denoptim.combinatorial.CombinatorialExplorerByLayer.settings, denoptim.combinatorial.CombinatorialExplorerByLayer.stopRun(), denoptim.combinatorial.CombinatorialExplorerByLayer.subtaskHasException(), denoptim.combinatorial.CombinatorialExplorerByLayer.thrownByTask, denoptim.combinatorial.CombinatorialExplorerByLayer.tpe, and denoptim.combinatorial.CombinatorialExplorerByLayer.verbosity.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.CombinatorialExplorerByLayer(), and denoptim.programs.combinatorial.FragSpaceExplorer.runProgram().

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

◆ startNewGraphFromScaffold()

DGraph denoptim.combinatorial.CombinatorialExplorerByLayer.startNewGraphFromScaffold ( int  scafIdx) throws DENOPTIMException
private
Parameters
scafIdxthe molID (i.e., the index of the molecule in the library of scaffolds)
Returns
a graph containing only the scaffold of which the molID is given

Definition at line 863 of file CombinatorialExplorerByLayer.java.

References denoptim.graph.DGraph.addVertex(), denoptim.combinatorial.CombinatorialExplorerByLayer.fsSettings, denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.utils.GraphUtils.getUniqueVertexIndex(), denoptim.graph.Vertex.newVertexFromLibrary(), denoptim.graph.Vertex.BBType.SCAFFOLD, denoptim.graph.DGraph.setGraphId(), and denoptim.graph.DGraph.setLocalMsg().

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel().

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

◆ stopRun()

void denoptim.combinatorial.CombinatorialExplorerByLayer.stopRun ( )

Stops all subtasks and shutdown executor.

Definition at line 210 of file CombinatorialExplorerByLayer.java.

References denoptim.combinatorial.CombinatorialExplorerByLayer.cleanup(), and denoptim.combinatorial.CombinatorialExplorerByLayer.tpe.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel(), denoptim.programs.combinatorial.FragSpaceExplorer.handleThrowable(), and denoptim.combinatorial.CombinatorialExplorerByLayer.run().

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

◆ subtaskHasException()

boolean denoptim.combinatorial.CombinatorialExplorerByLayer.subtaskHasException ( )
private

Looks for exceptions in the subtasks and, if any, store its reference locally to allow reporting it back from the main thread.

Returns
true if any of the subtasks has thrown an exception

Definition at line 224 of file CombinatorialExplorerByLayer.java.

References denoptim.combinatorial.CombinatorialExplorerByLayer.submitted, and denoptim.combinatorial.CombinatorialExplorerByLayer.thrownByTask.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel(), and denoptim.combinatorial.CombinatorialExplorerByLayer.run().

Here is the caller graph for this function:

Member Data Documentation

◆ firstAfterRestart

boolean denoptim.combinatorial.CombinatorialExplorerByLayer.firstAfterRestart = false
private

Flag identifying the first iteration after restart from checkpoint.

Definition at line 108 of file CombinatorialExplorerByLayer.java.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.exploreCombinationsAtGivenLevel(), and denoptim.combinatorial.CombinatorialExplorerByLayer.run().

◆ fsSettings

◆ restartFromChkPt

boolean denoptim.combinatorial.CombinatorialExplorerByLayer.restartFromChkPt = false
private

◆ serFromChkRestart

int denoptim.combinatorial.CombinatorialExplorerByLayer.serFromChkRestart = 0
private

Number of serialized graphs recovered from previous run database upon restart from checkpoint file.

Definition at line 93 of file CombinatorialExplorerByLayer.java.

Referenced by denoptim.combinatorial.CombinatorialExplorerByLayer.run().

◆ settings

◆ submitted

◆ submittedAndFutures

◆ thrownByTask

Throwable denoptim.combinatorial.CombinatorialExplorerByLayer.thrownByTask
private

◆ totSubmittedTasks

int denoptim.combinatorial.CombinatorialExplorerByLayer.totSubmittedTasks = 0
private

◆ tpe

◆ verbosity


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