UnconstrainedSetGeneticAlgorithm#

class pybrops.opt.algo.UnconstrainedSetGeneticAlgorithm.UnconstrainedSetGeneticAlgorithm(ngen=250, mu=100, lamb=100, M=1.5, rng=RandomState(MT19937) at 0x7F8D0DF4C840, **kwargs)[source]#

Bases: UnconstrainedOptimizationAlgorithm

Class implementing an NSGA-II genetic algorithm adapted for subset selection optimization. The search space is discrete and nominal in nature.

Constructor for NSGA-II set optimization algorithm.

Parameters:
  • ngen (int) – Number of generations to evolve population.

  • mu (int) – Number of parental candidates to keep in population.

  • lamb (int) – Number of progeny to generate.

  • M (float) – Length of the chromosome genetic map, in Morgans.

  • rng (numpy.random.Generator, numpy.random.RandomState, None) – Random number generator source.

  • kwargs (dict) – Additional keyword arguments.

Methods

cxSet

Set crossover operator.

mutSet

Set mutation operator.

optimize

Optimize an objective function.

selRandomReplacement

selTournamentReplacement

Attributes

M

Length of the genetic map in Morgans.

lamb

Number of progenies to generate from the main chromosome population.

mu

Number of individuals in the main chromosome population.

ngen

Number of generations.

rng

Random number generator source.

property M: float#

Length of the genetic map in Morgans.

cxSet(ind1, ind2, indpb)[source]#

Set crossover operator.

Parameters:
  • ind1 (numpy.ndarray) – Chromosome of the first parent (modified in place).

  • ind2 (numpy.ndarray) – Chromosome of the second parent (modified in place).

  • indpb (float) – Probability of initiating a crossover at a specific chromosome locus.

Returns:

out – A tuple of length 2 containing progeny resulting from the crossover.

Return type:

tuple

property lamb: int#

Number of progenies to generate from the main chromosome population.

property mu: int#

Number of individuals in the main chromosome population.

mutSet(ind, sspace, indpb)[source]#

Set mutation operator.

Parameters:
  • ind (numpy.ndarray) – Individual chromosome to mutate (modified in place).

  • sspace (numpy.ndarray) – Array representing the set search space.

  • indpb (float) – Probability of mutation at a single locus.

Returns:

ind – A mutated chromosome.

Return type:

array_like

property ngen: int#

Number of generations.

optimize(objfn, k, sspace, objfn_wt, **kwargs)[source]#

Optimize an objective function.

Parameters:
  • objfn (callable) – Objective function which to optimize.

  • k (int) – Number of decision variables in the search space. A vector is formed as sspace^k

  • sspace (numpy.ndarray) – Search space that the OptimizationAlgorithm searches in.

  • objfn_wt (numpy.ndarray) – Weight(s) applied to output(s) from the objfn.

Returns:

out – A tuple of length 3 containing (frontier, sel_config, misc).

Where:

  • frontier is a matrix of the Pareto frontier points.

  • sel_config is an array of corresponding decision variables for the corresponding Pareto frontier points.

  • misc is a dictionary of miscellaneous output.

Return type:

tuple

property rng: Generator | RandomState#

Random number generator source.