GeneticAlgorithm
The GA class solves unconstrained Non-Linear Programming (NLP) problems using a genetic algorithm approach. Given a function 'f' and a set of random variables based on the dimensionality of the search space, and the domain of the search space, the GA will evolve a pool of candidate solutions using evolutionary concepts such as crossover and mutation. The random variables are used to create random candidate solutions for the solution pool. The algorithm iterates until it converges or has reached a maximum number of generations.
minimize f(x)
Value parameters
- f
-
the vector-to-scalar objective function
- rands
-
random variables used to create the initial 'gene' pool. There is one r.v. per dimension, and should reflect the domain of the search space.
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Calculate the crossover of two solutions.
Calculate the crossover of two solutions.
Value parameters
- x1
-
the first solution for the crossover
- x2
-
the second solution for the crossover
Attributes
Find
Find
Attributes
Create the initial pool of candidate solutions.
Create the initial pool of candidate solutions.
Value parameters
- seeds
-
a (possibly null) array of initial candidates provided by the user.
Attributes
Perform an exact, e.g., GoldenSectionLS or inexact, e.g., WolfeLS line search. Search in direction dir, returning the distance z to move in that direction.
Perform an exact, e.g., GoldenSectionLS or inexact, e.g., WolfeLS line search. Search in direction dir, returning the distance z to move in that direction.
Value parameters
- dir
-
the direction to move in
- step
-
the initial step size
- x
-
the current point
Attributes
Perform a mutation on a solution.
Perform a mutation on a solution.
Value parameters
- x
-
the solution on which to perform the mutation
Attributes
Calculate the next generation of solutions. The top four solutions are kept and the rest of the pool size is filled out by evolving new solutions with crossover and mutation.
Calculate the next generation of solutions. The top four solutions are kept and the rest of the pool size is filled out by evolving new solutions with crossover and mutation.
Attributes
Utility method to print the current solution pool.
Utility method to print the current solution pool.
Value parameters
- n
-
the number of solutions from the pool to include in the print the default is set to 5
Attributes
Solve the Non-Linear Programming (NLP) problem by starting at x0 and iteratively moving down in the search space to a minimal point. Return the optimal point/vector x and its objective function value.
Solve the Non-Linear Programming (NLP) problem by starting at x0 and iteratively moving down in the search space to a minimal point. Return the optimal point/vector x and its objective function value.
Value parameters
- step
-
the initial step size (may default to STEP)
- toler
-
the tolerance (may default to TOL)
- x0
-
the starting point
Attributes
Solve the optimization problem.
Solve the optimization problem.
Value parameters
- seeds
-
an array of initial candidates provided by the user.
Attributes
Sort the pool by the objective function value of the candidate solutions.
Sort the pool by the objective function value of the candidate solutions.
Attributes
Inherited methods
The objective function f plus a weighted penalty based on the constraint function g. Override for constrained optimization and ignore for unconstrained optimization.
The objective function f plus a weighted penalty based on the constraint function g. Override for constrained optimization and ignore for unconstrained optimization.
Value parameters
- x
-
the coordinate values of the current point
Attributes
- Inherited from:
- Minimizer
Return the loss function for each epoch.
Attributes
- Inherited from:
- MonitorEpochs
Solve the following Non-Linear Programming (NLP) problem: min { f(x) | g(x) <= 0 }. To use explicit functions for gradient, replace gradient (fg, x._1 + s) with gradientD (df, x._1 + s). This method uses multiple random restarts.
Solve the following Non-Linear Programming (NLP) problem: min { f(x) | g(x) <= 0 }. To use explicit functions for gradient, replace gradient (fg, x._1 + s) with gradientD (df, x._1 + s). This method uses multiple random restarts.
Value parameters
- n
-
the dimensionality of the search space
- step_
-
the initial step size
- toler
-
the tolerance
Attributes
- Inherited from:
- Minimizer
Inherited fields
Attributes
- Inherited from:
- MonitorEpochs