Package schrodinger :: Package application :: Package matsci :: Package genetic_optimization :: Module genetic_optimization :: Class GeneticOptimization
[hide private]
[frames] | no frames]

Class GeneticOptimization

object --+
         |
        GeneticOptimization

Manage the genetic optimization.

Instance Methods [hide private]
 
__init__(self, initial_population, properties, eval_kwargs={}, crossovers=None, mutators=None, fragment_libs='all', script_evaluator=None, generations=25, population=10, crossover_rate=90.0, mutation_rate=2.0, selection='roulette_wheel', tournament_size=2, terminators=['unproductive', 'all_properties'], num_unproductive=10, scaling='sigma_truncation', elitism=1, random_seed=None, no_minimize=False, num_ret_structures=1, molecule_history=False, molecule_history_file='history.mae', tpp_ga=1, logger=None)
Create an instance.
 
setOperatorNames(self)
Set the operator names.
 
checkInputParams(self)
Check the input parameters.
float
initRandomSeed(self, random_seed)
Process the seed to the random number generator.
 
printProperties(self)
Log the set of sought properties and their details.
 
printParams(self)
Log the parameters.
StructureGenome
initializeGenome(self)
Initialize a genome.
 
initializeGA(self, genome)
Initialize the genetic optimization.
 
manageBestIndividuals(self)
Manage the best individuals from the final population.
 
printFailures(self)
Log failures.
 
runIt(self)
Run the components of the genetic optimization.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  FIELD_WIDTH = 15
  NUM_TIME_DIGITS = 6
  MSGWIDTH = 80
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, initial_population, properties, eval_kwargs={}, crossovers=None, mutators=None, fragment_libs='all', script_evaluator=None, generations=25, population=10, crossover_rate=90.0, mutation_rate=2.0, selection='roulette_wheel', tournament_size=2, terminators=['unproductive', 'all_properties'], num_unproductive=10, scaling='sigma_truncation', elitism=1, random_seed=None, no_minimize=False, num_ret_structures=1, molecule_history=False, molecule_history_file='history.mae', tpp_ga=1, logger=None)
(Constructor)

 

Create an instance.

Parameters:
  • initial_population (list) - the initial population of schrodinger.structure.Structure
  • properties (list of Property) - the properties to be optimized
  • eval_kwargs (dict) - a dictionary of key value pairs that will be passed onto scriptlauncher.addScriptArgs(), both keys and values must be single strings, values can contain whitespace
  • crossovers (list) - contains two-element tuples each of which holds a crossover operator to be used in the optimization, i.e. Crossover() method, along with a weight
  • mutators (list) - contains two-element tuples each of which holds a mutation operator to be used in the optimization, i.e. Mutation() method, along with a weight
  • fragment_libs (list) - strings specifying fragment libraries to be used, can be either module constants from FRAGMENT_LIBS.keys() (or ALL if all of those are desired) or the names of Maestro files (including the file extensions) containing fragments collected by the user
  • script_evaluator (method) - the Evaluator method to be called to score individuals during the optimization, takes a StructureGenome and returns a launcher.Launcher
  • generations (int) - the number of generations for which to run the optimization
  • population (int) - the population size to use in the optimization, can be less-than-or-equal-to the length of initial_population
  • crossover_rate (float) - the rate of crossover as a percentage
  • mutation_rate (float) - the rate of mutation as a percentage
  • selection (str) - the selection protocol used to select individuals to the gene pool for the upcoming generation
  • tournament_size (int) - the size of tournament to use if using tournament based selection, unused if a tournament based selection is not being used
  • terminators (list) - list of strings that specify the termination protocols to be used to terminate the optimization, typically more than one is specified only if the unproductive protocol is being used
  • num_unproductive (int) - if the unproductive protocol is being used to terminate the optimization then this integer specifies how many unproductive cycles are allowed before terminating, unused if a different termination protocol is used
  • scaling (str) - specifies the scaling protocol to use, scaling scales the raw scores of the individuals to produce fitness scores to ease selection in cases where raw scores are nearly equal
  • elitism (int) - specify the number of elite individuals guaranteed to be added to the gene pool for the upcoming generation, zero disables elitism
  • random_seed (None or float) - the random seed, if None then system time will be used
  • no_minimize (bool) - specify that the offspring structures generated by the crossover and mutation operators not be geometry optimized prior to selection
  • num_ret_structures (int) - typically and by default the single best structure will be returned, increase this value from one to return this number of best structures from a sorted list
  • molecule_history (bool) - this options specifies to create a Maestro file containing all molecules from all generations
  • molecule_history_file (str) - name to use for the molecule history file
  • tpp_ga (int) - a threads-per-processor value, used to parallelize the scoring of the individuals during the optimization, this option simply forks out tpp_ga simultaneous processes that reside on the same node, if your evaluation function supports parallelization and you wish to utilize a second level of parallelization of each individual evaluation then pass those arguments in eval_kwargs
  • logger (logging.Logger) - output logger
Overrides: object.__init__

initRandomSeed(self, random_seed)

 

Process the seed to the random number generator.

Parameters:
  • random_seed (float) - the seed for the random number generator
Returns: float
final random seed

initializeGenome(self)

 

Initialize a genome.

Returns: StructureGenome
a genome

initializeGA(self, genome)

 

Initialize the genetic optimization.

Parameters:
  • genome (StructureGenome) - a genome