NichingGeneticAlgorithmSolver

class NichingGeneticAlgorithmSolver @JvmOverloads constructor(problemDefinition: ProblemDefinition, evaluator: EvaluatorIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = RNStreamProvider(), populationSize: Int = defaultPopulationSize, val nicheIdentifier: NicheIdentifier = NicheIdentifier(), val fitnessSharing: FitnessSharing = FitnessSharing(), val grouping: NoiseGroupingProcedure = NoiseGroupingProcedure(), val ranking: LinearRankingSelection = LinearRankingSelection(), val sampling: StochasticUniversalSampling = StochasticUniversalSampling(), val mating: MatingRestrictionIfc = DynamicInbreeding(), val crossover: NgaCrossoverIfc = ArithmeticalCrossover(), val mutation: NgaMutationIfc = UniformMutation(), var conserveNicheCenters: Boolean = false, transitionRules: List<NgaTransitionRuleIfc> = listOf(SingleNicheRule(), ImprovementRule()), maxIterations: Int = ngaDefaultMaxIterations, replicationsPerEvaluation: ReplicationPerEvaluationIfc, name: String? = null) : StochasticSolver(source)

The Niching Genetic Algorithm (NGA), the global exploration phase of Industrial Strength COMPASS (ISC Algorithm 1). It maintains a population of integer-feasible solutions and, each generation:

  1. identifies niches in the population (NicheIdentifier, Algorithm 2);

  2. computes niche-shared fitness (FitnessSharing, §A.4);

  3. groups statistically-indistinguishable members (NoiseGroupingProcedure, Algorithm 3) and assigns group-averaged linear-rank selection probabilities (LinearRankingSelection, §A.5);

  4. draws a parent pool by Stochastic Universal Sampling (StochasticUniversalSampling);

  5. mates each parent under a mating restriction (MatingRestrictionIfc, Algorithm 4), recombines (NgaCrossoverIfc, §A.8), and mutates (NgaMutationIfc, §A.9) to form offspring;

  6. evaluates the offspring and forms the next generation (optionally conserving niche centers, Algorithm 5).

The phase ends when any configured transition rule fires (NgaTransitionRuleIfc, §A.12). The discovered niches — each a center "seed" plus its surrounding members — are the starting points for the COMPASS local phase. With uniform mutation enabled (the default), every feasible point remains reachable with positive probability, preserving the NGA's global-convergence guarantee.

All randomness flows through the solver's single random number stream (rnStream), so a run is reproducible for a fixed stream number.

Parameters

problemDefinition

the problem being solved

evaluator

the evaluator responsible for assessing the quality of solutions

streamNum

the random number stream number; 0 (the default) means the next available stream

streamProvider

the provider of random number streams; defaults to a fresh RNStreamProvider

populationSize

the population size m_G. It must not exceed the number of distinct input-feasible points of the problem: the initial population is filled with unique feasible points, so requesting more than exist cannot terminate.

nicheIdentifier

the niche-identification strategy

fitnessSharing

the fitness-sharing strategy

grouping

the noise-aware grouping strategy

ranking

the linear-ranking selection-probability strategy

sampling

the stochastic-universal-sampling strategy

mating

the mating-restriction strategy

crossover

the recombination strategy

mutation

the mutation strategy (default UniformMutation, which preserves convergence)

conserveNicheCenters

whether to carry niche centers forward unchanged (elitism, Algorithm 5)

transitionRules

the global→local transition rules; the phase ends when any fires

maxIterations

the maximum number of generations

replicationsPerEvaluation

strategy for the number of replications per evaluation

name

an optional name for the solver

Constructors

Link copied to clipboard
constructor(problemDefinition: ProblemDefinition, evaluator: EvaluatorIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = RNStreamProvider(), populationSize: Int = defaultPopulationSize, nicheIdentifier: NicheIdentifier = NicheIdentifier(), fitnessSharing: FitnessSharing = FitnessSharing(), grouping: NoiseGroupingProcedure = NoiseGroupingProcedure(), ranking: LinearRankingSelection = LinearRankingSelection(), sampling: StochasticUniversalSampling = StochasticUniversalSampling(), mating: MatingRestrictionIfc = DynamicInbreeding(), crossover: NgaCrossoverIfc = ArithmeticalCrossover(), mutation: NgaMutationIfc = UniformMutation(), conserveNicheCenters: Boolean = false, transitionRules: List<NgaTransitionRuleIfc> = listOf(SingleNicheRule(), ImprovementRule()), maxIterations: Int = ngaDefaultMaxIterations, replicationsPerEvaluation: ReplicationPerEvaluationIfc, name: String? = null)
constructor(problemDefinition: ProblemDefinition, evaluator: EvaluatorIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = RNStreamProvider(), populationSize: Int = defaultPopulationSize, nicheIdentifier: NicheIdentifier = NicheIdentifier(), fitnessSharing: FitnessSharing = FitnessSharing(), grouping: NoiseGroupingProcedure = NoiseGroupingProcedure(), ranking: LinearRankingSelection = LinearRankingSelection(), sampling: StochasticUniversalSampling = StochasticUniversalSampling(), mating: MatingRestrictionIfc = DynamicInbreeding(), crossover: NgaCrossoverIfc = ArithmeticalCrossover(), mutation: NgaMutationIfc = UniformMutation(), conserveNicheCenters: Boolean = false, transitionRules: List<NgaTransitionRuleIfc> = listOf(SingleNicheRule(), ImprovementRule()), maxIterations: Int = ngaDefaultMaxIterations, replicationsPerEvaluation: Int = defaultReplicationsPerEvaluation, name: String? = null)

Constructs a Niching GA solver using a fixed number of replications per evaluation.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Structured, ordered snapshot of the solver's configuration — the same fields the toString implementations expose, in a form that downstream consumers can iterate (reporting, machine-readable summary artifacts, "compare two runs" tooling).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The current generation index (0 after initialization).

Link copied to clipboard

The niche structure identified for the current population.

Link copied to clipboard
Link copied to clipboard

The number of consecutive generations with no improvement of the incumbent.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The niches discovered by the global phase (COMPASS seeds).

Link copied to clipboard

A read-only, best-first view of the current population.

Link copied to clipboard

The population size m_G. Must be >= defaultMinPopulationSize.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The global→local transition rules. Cannot be changed while the solver is running.

Functions

Link copied to clipboard
protected open override fun extractSolverSpecificState(): Map<String, Double>

A hook for subclasses to inject their specific internal state metrics into the snapshot without having to override the entire makeSolverStateSnapshot method.

Link copied to clipboard
protected open override fun initializeIterations()

Subclasses may implement this function to prepare the solver before running the first iteration. Generally, it is sufficient to just implement the startingPoint() function.

Link copied to clipboard
protected open override fun isStoppingCriteriaSatisfied(): Boolean

Subclasses should implement this function to determine if the solver should continue running iterations. This will likely include some implementation of stopping criteria. This function should implement stopping criteria based on the quality of the solution. The number of iterations, compared to the maximum number of iterations, is automatically checked after each step in the iterative process. Unless overridden, this function returns false by default, which indicates that the solution quality criteria have not been satisfied. This will cause the solver to iterate through all iterations of the solution process up to the maximum number of iterations. Alternatively, the user can specify an instance of the SolutionQualityEvaluatorIfc interface to determine if the solution quality has been reached.

Link copied to clipboard
protected open override fun mainIteration()

This function should contain the logic that iteratively executes until the maximum number of iterations is reached or until the stopping criteria is met. The base implementation calls nextPoint() to determine the next point to evaluate, requests an evaluation of the point, and then updates the current solution if the resulting solution is better than the current solution. Generally, implementing startingPoint() and nextPoint() should be adequate. The property iterationCounter represents the current iteration within the mainIteration() function. That is, the value of iterationCounter is incremented prior to the execution of the mainIteration() function.

Link copied to clipboard
open override fun toString(): String