class GeneticAlgorithm extends AnyRef
The GeneticAlgorithm
class performs local search to find minima of functions
defined on integer vector domains (z^n).
minimize f(x) subject to g(x) <= 0, x in Z^n
- Alphabetic
- By Inheritance
- GeneticAlgorithm
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new GeneticAlgorithm(f: (VectorI) => Double, x0: VectorI, vMax: Int = 100, g: (VectorI) => Double = null, maxStep: Int = 5)
- f
the objective function to be minimize (f maps an integer vector to a double)
- x0
the starting point for the search (seed for GA)
- g
the constraint function to be satisfied, if any
- maxStep
the maximum/starting step size (make larger for larger domains)
Type Members
- type Vec_Func = (VectorI, Double)
Pair consisting of an integer vector and its functional value (a double)
Value Members
- def crossOver(): Unit
For each individual in the population, cross it with some other individual.
- def fg(x: VectorI): Double
The objective function f re-scaled by a weighted penalty, if constrained.
The objective function f re-scaled by a weighted penalty, if constrained.
- x
the coordinate values of the current point
- def fitnessCrossOver(): Unit
For each individual in the population, cross it with some other individual.
For each individual in the population, cross it with some other individual. Let the crossover be dependent of the fitness of the individual.
- def fittest: Vec_Func
Find the fittest individual (smallest value of objective function).
- def genPopulation(): Unit
Generate an initial population of individuals.
- def mutate(): Unit
Randomly select individuals for mutation (change a value at one position).
- def printPopulation(): Unit
Print the current population
- def solve(): Vec_Func
Solve the minimization problem using a genetic algorithm.