Internals
Listing all non-exported types and functions here for now, but split off categories onto separate pages in the future!
GlobalOptimization.AbstractAdaptationStrategy
— TypeAbstractAdaptationStrategy
Subtypes of this type should be used in conjunction with subtypes of AbstractMutationParameters
and AbstractCrossoverParameters
to control how the parameters are adapted in their respective adapt!
methods.
GlobalOptimization.AbstractAlgorithmSpecificOptions
— TypeAbstractAlgorithmSpecificOptions
Abstract type for algorithm specific options
All subtypes must define the following fields:
general
: The general options for an optimizer.
GlobalOptimization.AbstractBinomialCrossoverParameters
— TypeAbstractBinomialCrossoverParameters
An abstract type representing the parameters for a binomial crossover strategy in Differential Evolution (DE). The crossover!
method is provided for subtypes of this abstract type, however, the get_parameter
, initialize!
, and adapt!
methods are must still be defined.
GlobalOptimization.AbstractCandidate
— TypeAbstractCandidate
Abstract type for a candidate
GlobalOptimization.AbstractCrossoverParameters
— TypeAbstractCrossoverParameters
An abstract type representing the parameters for a crossover strategy in Differential Evolution (DE).
Subtypes of this abstract type should define the following methods:
get_parameter(params::AbstractCrossoverParameters, i)
: Returns the crossover parameter for thei
-th candidate.initialize!(params::AbstractCrossoverParameters, num_dims, population_size)
: Initializes the crossover parameters.adapt!(params::AbstractCrossoverParameters, improved, global_best_improved)
: Adapts the crossover parameters based on the improvement status of the candidates.crossover!(population::DEPopulation, crossover_params, search_space)
: Performs the crossover operation on the population using the specified crossover parameters.
GlobalOptimization.AbstractCrossoverTransformation
— TypeAbstractCrossoverTransformation
An abstract type representing a transformation applied to a candidate prior to applying the crossover operator.
Subtypes of this abstract type should define the following methods:
initialize!(transformation::AbstractCrossoverTransformation, population_size)
: Initializes the transformation with the populationupdate_transformation!(transformation::AbstractCrossoverTransformation, population)
: Updates the transformation based on the current populationto_transformed(transformation::AbstractCrossoverTransformation, c, m)
: Transforms the candidatec
and mutantm
to an alternative representation, returning the transformed candidate, transformed mutant, and a boolean indicating whether the transformation was applied.from_transformed!(transformation::AbstractCrossoverTransformation, mt, m)
: Transforms the mutantmt
back to the original representationm
.
GlobalOptimization.AbstractEvaluator
— TypeAbstractEvaluator
Abstract type for an evaluator. An evaluator is responsible for evaluating the fitness of a population or candidate.
GlobalOptimization.AbstractFunctionEvaluationMethod
— TypeAbstractFunctionEvaluationMethod
A function evaluation method is a strategy for evaluating the fitness/objective, as well as possibly other algorithm specific things.
GlobalOptimization.AbstractMBHDistribution
— TypeAbstractMBHDistribution{T}
Abstract type for MBH distributions.
All subtypes of AbstractMBHDistribution
must implement the following methods:
initialize!(dist::AbstractMBHDistribution, ss::ContinuousRectangularSearchSpace)
: Initializes the distribution with the search space.draw_step!(step::AbstractVector{T}, dist::AbstractMBHDistribution{T})
: Draws a step from the distribution and stores it instep
.get_show_trace_elements(dist::AbstractMBHDistribution{T}, trace_mode::Union{Val{:detailed}, Val{:all}})
: Returns the trace elements for the distribution to be shown in the terminal terminal terminal terminal terminal terminal terminal terminal terminal.get_save_trace_elements(dist::AbstractMBHDistribution{T}, trace_mode::Union{Val{:detailed}, Val{:all}})
: Returns the trace elements for the distribution to be saved to a file.
Note: The AbstractMBHDistribution
interface is tightly coupled with the AbstractHopperSet
interface and could use some refactoring to decouple the two. If an additional adaptive distribution is added, a new abstract type, such as AbstractAdaptiveMBHDistribution
, should be added, and MBHAdaptiveDistribution
should be re-named to something more specific.
GlobalOptimization.AbstractMutationOperator
— TypeAbstractMutationOperator
The abstract type for all DE mutation strategies. This type is used to define the mutation strategies available in the DE algorithm.
Subtypes of this type should implement the following method:
get_parameters(strategy::AbstractMutationOperator, dist)
: Returns the mutation parameters for the given strategy and distribution. The parameters should be returned as aSVector{4, Float64}
containing the F₁, F₂, F₃, and F₄ weights for the unified mutation strategy.
GlobalOptimization.AbstractMutationParameters
— TypeAbstractMutationParameters
The abstract type for all DE mutation parameters. This type is used to define the mutation parameters available in the DE algorithm.
Subtypes of this type should implement the following methods:
get_parameters(params::AbstractMutationParameters, i)
: Returns the mutation parameters for the given mutation parameters object and indexi
. The parameters should be returned as a tuple of fourFloat64
values representing the F₁, F₂, F₃, and F₄ weights for the unified mutation strategy.initialize!(params::AbstractMutationParameters, population_size)
: Initializes the mutation parameters for the given population size.adapt!(params::AbstractMutationParameters, improved, global_best_improved)
: Adapts the mutation parameters based on whether the population has improved and whether the global best candidate has improved.mutate!(population::DEPopulation, F::AbstractMutationParameters)
: Mutates the population using the mutation parameters.
GlobalOptimization.AbstractNonlinearEquationProblem
— TypeAbstractNonlinearEquationProblem
Abstract type for problems involving a set of nonlinear equations to solve.
GlobalOptimization.AbstractOptimizationProblem
— TypeAbstractOptimizationProblem
Abstract type for optimization problems.
GlobalOptimization.AbstractOptimizer
— TypeAbstractOptimizer
Abstract type of all optimization algorithms.
All subtypes must have the following fields:
options<:AbstractAlgorithmSpecificOptions
: The options for the optimizer. See theAbstractAlgorithmSpecificOptions
interface documentation for details.cache<:AbstractOptimizerCache
: The cache for the optimizer. See theAbstractOptimizerCache
interface documentation for details.
All subtypes must define the following methods:
initialize!(opt<:AbstractOptimizer)
: Initialize the optimizer.step!(opt<:AbstractOptimizer)
: Perform a single step/iteration with the optimizer.get_best_fitness(opt<:AbstractOptimizer)
: Get the best fitness of the optimizer.get_best_candidate(opt<:AbstractOptimizer)
: Get the best candidate of the optimizer.get_show_trace_elements(opt<:AbstractOptimizer, trace_mode::Union{Val{:detailed}, Val{:all}})
: Returns a Tuple ofTraceElement
s and, if necessary,Vector{TraceElement}
s, of data to be printed to the terminal. Note that separate methods should be defined forVal{:detailed}
andVal{:all}
if applicable.get_save_trace_elements(opt<:AbstractOptimizer, trace_mode::Union{Val{:detailed}, Val{:all}})
: Returns a Tuple ofTraceElement
s and, if necessary,Vector{TraceElement}
s, of data to be saved to the trace file. Note that separate methods should be defined forVal{:detailed}
andVal{:all}
if applicable.
GlobalOptimization.AbstractOptimizerCache
— TypeAbstractOptimizerCache
Abstract type of all optimization algorithm caches.
All subtypes must have the following fields:
iteration
: The current iteration number of the optimizer.start_time
: The start time of the optimization.stall_start_time
: THe start time of the stall.stall_iteration
: The iteration number of the stall.stall_value
: The objective function value at start of stall.
These fields must be initialized in the initialize!(opt)
method of the optimizer.
GlobalOptimization.AbstractOptions
— TypeAbstractOptions
Abstract type for multiple options
GlobalOptimization.AbstractPopulation
— TypeAbstractPopulation
Abstract type for a population of candidates.
GlobalOptimization.AbstractPopulationBasedOptimizer
— TypeAbstractPopulationBasedOptimizer
Abstract type of all population based optimization algorithms.
All subtypes must have the following fields:
options<:AbstractAlgorithmSpecificOptions
: The options for the optimizer. See theAbstractAlgorithmSpecificOptions
interface documentation for details.cache<:AbstractPopulationBasedOptimizerCache
: The cache for the optimizer. See theAbstractPopulationBasedOptimizerCache
interface documentation for details.
All subtypes must define the following methods:
initialize!(<:AbstractPopulationBasedOptimizer)
: Initialize the optimizer.step!(<:AbstractPopulationBasedOptimizer)
: Perform a single step/iteration with the optimizer.get_population(opt<:AbstractPopulationBasedOptimizer)
: Get the population of the optimizer. This should return a subtype ofAbstractPopulation
.get_show_trace_elements(opt<:AbstractOptimizer, trace_mode::Union{Val{:detailed}, Val{:all}})
: Returns a Tuple ofTraceElement
s and, if necessary,Vector{TraceElement}
s, of data to be printed to the terminal. Note that separate methods should be defined forVal{:detailed}
andVal{:all}
if applicable.get_save_trace_elements(opt<:AbstractOptimizer, trace_mode::Union{Val{:detailed}, Val{:all}})
: Returns a Tuple ofTraceElement
s and, if necessary,Vector{TraceElement}
s, of data to be saved to the trace file. Note that separate methods should be defined forVal{:detailed}
andVal{:all}
if applicable.
Note that the get_best_fitness
and get_best_candidate
methods required by the AbstractOptimizer
interface are provided for subtypes of AbstractPopulationBasedOptimizer
.
GlobalOptimization.AbstractPopulationBasedOptimizerCache
— TypeAbstractPopulationBasedOptimizerCache
Abstract type of all population based optimization algorithm caches.
All subtypes must have the following fields:
- All fields of
AbstractOptimizerCache
. global_best_candidate
: The global best candidate of the population.global_best_fitness
: The global best fitness of the population.
These fields must be initialized in the initialize!(opt)
method of the optimizer. Additionally, the global_best_candidate
and global_best_fitness
fields must be updated in each iteration when appropriate (i.e., when the global best candidate improves) in iterate!(opt)
.
GlobalOptimization.AbstractProblem
— TypeAbstractProblem
Abstract type for all solvable problems.
GlobalOptimization.AbstractRandomNeighborhoodVelocityUpdateScheme
— TypeAbstractRandomNeighborhoodVelocityUpdateScheme
Abstract type for a velocity update scheme that randomly selects the particles in the neighborhood of a given particle.
Subtypes of this abstract type have an implementation of the update_velocity!
method provided, but must still define the initialize!
and adapt!
methods.
GlobalOptimization.AbstractSelector
— TypeAbstractSelector
Subtypes of this type should be used to select candidates from the population and must implement the following methods:
initialize!(s::AbstractSelector, population_size::Int)
: Initializes the selector with the population size.select(s::AbstractSelector, target::Int, pop_size::Int)
: Selects candidates based on the target index and population size.
GlobalOptimization.AbstractVelocityUpdateScheme
— TypeAbstractVelocityUpdateScheme
Abstract type for velocity update schemes in Particle Swarm Optimization (PSO).
All subtypes much define the following methods:
initialize!(vu::AbstractVelocityUpdateScheme, swarm_size::Int)
: Initialize the velocity update scheme for a given swarm size.update_velocity!(swarm::Swarm, vu::AbstractVelocityUpdateScheme)
: Update the velocity of each candidate in the swarm using the specified velocity update scheme.adapt!(vu::AbstractVelocityUpdateScheme, improved::Bool, stall_iteration::Int)
: Adapt the velocity update scheme based on the improvement status of the swarm and the stall iteration counter.get_show_trace_elements(vu::AbstractVelocityUpdateScheme, trace_mode::Union{Val{:detailed},Val{:all}})
: Get the elements to show in the trace for the velocity update scheme.get_save_trace_elements(vu::AbstractVelocityUpdateScheme, trace_mode::Union{Val{:detailed},Val{:all}})
: Get the elements to save in the trace for the velocity update scheme.
GlobalOptimization.AsyncEvaluator
— TypeAsyncEvaluator
Abstract type for an evaluator that evaluates the fitness of a single candidate asyncronously.
GlobalOptimization.BatchEvaluator
— TypeBatchEvaluator
Abstract type for an evaluator that evaluates the fitness of an entire population.
GlobalOptimization.BatchJobEvaluator
— TypeBatchJobEvaluator
An evaluator that evaluates a batch of jobs
GlobalOptimization.DEBasePopulation
— TypeDEBasePopulation{T <: AbstractFloat} <: AbstractPopulation{T}
The base representation of some population for the DE algorithms.
GlobalOptimization.DEOptions
— TypeDEOptions
Options for the Differential Evolution (DE) algorithms.
Fields:
general<:GeneralOptions
: The general options.pop_init_method<:AbstractPopulationInitialization
: The population initialization method.mutation_params<:AbstractMutationParameters
: The mutation strategy parameters.crossover_params<:AbstractCrossoverParameters
: The crossover strategy parameters.initial_space<:Union{Nothing,ContinuousRectangularSearchSpace}
: The initial space to initialize the population.
GlobalOptimization.DEPopulation
— TypeDEPopulation{T <: AbstractFloat} <: AbstractPopulation{T}
The full population representation for the DE algorithms, including both the candidates and the mutants.
GlobalOptimization.DEPopulation
— MethodDEPopulation(num_candidates::Integer, num_dims::Integer)
Constructs a DEPopulation
with num_candidates
candidates in num_dims
dimensions.
GlobalOptimization.FeasibilityHandlingEvaluator
— TypeFeasibilityHandlingEvaluator
An evaluator that handled a functions returned infeasibility penalty
GlobalOptimization.FixedDimensionSearchSpace
— TypeFixedDimensionSearchSpace
The base abstract type for a search space with a fixed finite number of dimensions. Applicable to the vast majority of optimization problems.
GlobalOptimization.GeneralOptions
— TypeGeneralOptions
General options for all optimizers
GlobalOptimization.GlobalOptimizationTrace
— TypeGlobalOptimizationTrace{SHT, SAT, TM}
A structure to hold the global optimization trace settings.
Fields:
show_trace::SHT
: A flag indicating whether to show the trace in the console.save_trace::SAT
: A flag indicating whether to save the trace to a file.save_file::String
: The file path where the trace will be saved.trace_level::TraceLevel{TM}
: The trace level settings, which can beTraceMinimal
,TraceDetailed
, orTraceAll
.
GlobalOptimization.MBHOptions
— TypeMBHOptions <: AbstractAlgorithmSpecificOptions
Options for the Monotonic Basin Hopping (MBH) algorithm.
GlobalOptimization.MBHStepMemory
— TypeMBHStepMemory{T}
Memory about MBH accepted steps.
GlobalOptimization.MinimalOptimizerCache
— TypeMinimalOptimizerCache{T}
A minimal implementation of the AbstractOptimizerCache
type.
GlobalOptimization.MinimalPopulationBasedOptimizerCache
— TypeMinimalPopulationBasedOptimizerCache{T}
A minimal implementation of the AbstractPopulationBasedOptimizerCache
type.
Algorithms employing this cache must initialize all fields in initialize!(opt)
and must update the iteration
field each iteration in iterate!(opt)
. Additionally, the global_best_candidate
and global_best_fitness
fields must be updated in each iteration when appropriate (i.e., when the global best candidate improves) in iterate!(opt)
.
GlobalOptimization.NoAdaptation
— TypeNoAdaptation
Parameters are not adapted at all.
GlobalOptimization.NoTransformation
— TypeNoTransformation
A transformation that does not apply any transformation to the candidate or mutant.
GlobalOptimization.PSOOptions
— TypePSOOptions <: AbstractAlgorithmSpecificOptions
Options for the PSO algorithm.
GlobalOptimization.PolyesterBatchEvaluator
— TypePolyesterBatchEvaluator
An evaluator that evaluates the fitness of a population in parallel using multi-threading using Polyester.jl.
GlobalOptimization.PolyesterBatchJobEvaluator
— TypePolyesterBatchJobEvaluator
An evaluator that evaluates a batch of jobs in parallel using Polyester.jl.
GlobalOptimization.RandomAdaptation
— TypeRandomAdaptation
Parameters are randomly adapted.
GlobalOptimization.RectangularSearchSpace
— TypeRectangularSearchSpace
A FixedDimensionSearchSpace
with N
dimensional rectangle as the set of feasible points.
GlobalOptimization.Results
— TypeResults{T}
A simple struct for returning results.
Fields
fbest::T
: The best function value found.xbest::Vector{T}
: The best candidate found.iters::Int
: The number of iterations performed.time::Float64
: The time taken to perform the optimization in seconds.exitFlag::Int
: The exit flag of the optimization.
GlobalOptimization.Results
— MethodResults(fbest::T, xbest::AbstractVector{T}, iters, time, exitFlag)
Constructs a new Results
struct.
Arguments
fbest::T
: The best function value found.xbest::AbstractVector{T}
: The best candidate found.iters::Int
: The number of iterations performed.time::AbstractFloat
: The time taken to perform the optimization in seconds.exitFlag::Int
: The exit flag of the optimization.
Returns
Results{T}
GlobalOptimization.SearchSpace
— TypeSearchSpace
The base abstract type for a Problem
search space.
GlobalOptimization.SerialBatchEvaluator
— TypeSerialBatchEvaluator
An evaluator that evaluates the fitness of a population in serial.
GlobalOptimization.SerialBatchJobEvaluator
— TypeSerialBatchJobEvaluator
An evaluator that evaluates a batch of jobs in serial.
GlobalOptimization.SingleEvaluator
— TypeSingleEvaluator
Abstract type for an evaluator that evaluates the fitness of a single candidate
GlobalOptimization.Swarm
— TypeSwarm{T <: AbstractFloat} <: AbstractPopulation
A population of particles for the PSO algorithm.
GlobalOptimization.ThreadedBatchEvaluator
— TypeThreadedBatchEvaluator
An evaluator that evaluates the fitness of a population in parallel using multi-threading.
GlobalOptimization.ThreadedBatchJobEvaluator
— TypeThreadedBatchJobEvaluator
An evaluator that evaluates a batch of jobs in parallel using Threads.jl and ChunkSplitters.jl.
GlobalOptimization.TraceElement
— TypeTraceElement{T}
A structure to hold a single trace element, which includes a label, flag, length, precision, and value.
An AbstractOptimizer
should return a tuple of TraceElement
objects when the get_show_trace_elements
or get_save_trace_elements
functions are called.
Fields:
label::String
: The label for the trace element.flag::Char
: A character indicating the format of the value (e.g., 'd' for integer, 'f' for float).length::Int
: The length of the formatted string representation of the value.precision::Int
: The precision for floating-point values.value::T
: The value of the trace element, which can be of any typeT
.
GlobalOptimization.TraceLevel
— TypeTraceLevel{TM}
A structure to with information about the tracing of the global optimization process.
GlobalOptimization.UniformInitialization
— TypeUniformInitialization
Initializes a population from a uniform distribution in the search space.
Base.eachindex
— Methodeachindex(pop::AbstractPopulation)
Returns an iterator for the indices of the population.
Base.length
— Methodlength(pop::AbstractPopulation)
Returns the number of candidates in the population.
Base.size
— Methodsize(pop::AbstractPopulation)
Returns the size of the population.
GlobalOptimization.DEPopulation_F64
— MethodDEPopulation_F64(num_candidates::Integer, num_dims::Integer)
Constructs a Float64 DEPopulation
with num_candidate
candidates in num_dims
dimensions.
GlobalOptimization.adapt!
— Methodadapt!(vu::AbstractVelocityUpdateScheme, improved::Bool, stall_iteration::Int)
Adapt the velocity update scheme based on the improvement status of the swarm and the stall iteration counter.
GlobalOptimization.candidate
— Methodcandidate(c::AbstractCandidate)
Returns the candidate c
.
GlobalOptimization.candidates
— Methodcandidates(pop::AbstractPopulation, [i::Integer])
Returns the candidates from a population. If i
is specified, returns the i
-th candidate.
GlobalOptimization.check_fitness!
— Methodcheck_fitness!(c::AbstractCandidate, ::Val)
Checks the fitness if the option has been enabled.
GlobalOptimization.check_fitness!
— Methodcheck_fitness!(c::AbstractHopperSet, options::Union{GeneralOptions,Val{true},Val{false}})
Checks the fitness of the candidate c
to ensure that it is valid iff the option has been enabled.
GlobalOptimization.check_fitness!
— Methodcheck_fitness!(pop::AbstractPopulation, options::Union{GeneralOptions,Val{true},Val{false}})
Checks the fitness of each candidate in the population pop
to ensure that it is valid iff options <: Union{GeneralOptions{D,Val{true}}, Val{true}}, otherwise, does nothing.
GlobalOptimization.check_stopping_criteria
— Methodcheck_stopping_criteria(opt::AbstractOptimizer)
Check if opt
satisfies any stopping criteria. Returns the appropriate Status
enum.
GlobalOptimization.construct_batch_evaluator
— Methodconstruct_batch_evaluator(
method::AbstractFunctionEvaluationMethod,
prob::OptimizationProblem,
)
Constructs a batch evaluator for the given method
and prob
.
GlobalOptimization.construct_batch_job_evaluator
— Methodconstruct_batch_job_evaluator(method::AbstractFunctionEvaluationMethod)
Constructs a batch job evaluator for the given method
.
GlobalOptimization.construct_results
— Methodconstruct_results(opt::AbstractOptimizer, status::Status)
Construct the results from the optimizer opt
with the appropriate Status
to indicate the stopping criteria.
GlobalOptimization.crossover!
— Methodcrossover!(population::DEPopulation{T}, crossover_params, search_space)
Performs the crossover operation on the population population
using the DE crossover strategy.
This function also ensures that, after crossover, the mutants are within the search space.
GlobalOptimization.dim_delta
— Methoddim_delta(ss::ContinuousRectangularSearchSpace{T}, [i::Integer])
Returns the difference between the maximum and minimum values for the i
-th dimension of ss
. If i
is not specified, returns a vector of all differences.
Arguments
ss::ContinuousRectangularSearchSpace{T}
`i::Integer
: the dimension to return the difference between the maximum and minimum values for.
Returns
T
orVector{T}
the difference between the maximum and minimum values for thei
-th dimension ofss
or a vector of all differences ifi
not provided.
GlobalOptimization.dim_max
— Methoddim_max(ss::ContinuousRectangularSearchSpace{T}, [i::Integer])
Returns the maximum value for the i
-th dimension of ss
. If i
is not specified, returns a vector of all maximum values.
Arguments
ss::ContinuousRectangularSearchSpace{T}
i::Integer
: the dimension to return the maximum value for.
Returns
T
orVector{T}
: the minimum value for thei
-th dimension ofss
or a vector of all minimum values ifi
not provided.
GlobalOptimization.dim_min
— Methoddim_min(ss::ContinuousRectangularSearchSpace{T}, [i::Integer])
Returns the minimum value for the i
-th dimension of ss
. If i
is not specified, returns a vector of all minimum values.
Arguments
ss::RontinuousRectangularSearchSpace{T}
i::Integer
: the dimension to return the minimum value for.
Returns
T
orVector{T}
: the minimum value for thei
-th dimension ofss
or a vector of all minimum values ifi
not provided.
GlobalOptimization.dim_range
— Methoddim_range(ss::ContinuousRectangularSearchSpace{T}, [i::Integer])
Returns the range of values for the i
-th dimension of ss
. If i
is not specified, returns a vector of all ranges.
Arguments
ss::ContinuousRectangularSearchSpace{T}
i::Integer
: the dimension to return the range of values for.
Returns
Tuple{T, T}
orVector{Tuple{T, T}}
: the range of values for thei
-th dimension ofss
or a vector of all ranges ifi
not provided.
GlobalOptimization.draw_step!
— Methoddraw_step!(step::AbstractVector{T}, dist::AbstractMBHDistribution{T})
Draws a step from the distribution dist
and stores it in step
.
GlobalOptimization.draw_update!
— Methoddraw_update!(hopper::Hopper{T}, distribution::AbstractMBHDistribution{T})
Draws a perterbation from distribution and updates candidate for the hopper hopper
.
GlobalOptimization.enforce_bounds!
— Methodenforce_bounds!(swarm::Swarm{T}, evaluator::BatchEvaluator)
Enforces the bounds of the search space on each candidate in the swarm swarm
. If a candidate
GlobalOptimization.evaluate!
— Methodevaluate!(job::Function, job_ids::AbstractVector{Int}, evaluator::BatchJobEvaluator)
Evaluates job
for each element of job_args
using the given evaluator
.
GlobalOptimization.evaluate!
— Methodevaluate!(pop::AbstractPopulation, evaluator::BatchEvaluator)
Evaluates the fitness of a population using the given evaluator
.
GlobalOptimization.evaluate_fitness!
— Methodevaluate_fitness!(swarm::Swarm{T}, evaluator::BatchEvaluator)
Evaluates the fitness of each candidate in the swarm swarm
using the evaluator
. Updates the swarms best candidates if any are found.
GlobalOptimization.evaluate_with_penalty
— Methodevaluate_with_penalty(evaluator::FeasibilityHandlingEvaluator, candidate::AbstractArray)
GlobalOptimization.feasible
— Methodfeasible(x, ss::ContinuousRectangularSearchSpace)
Returns true
if the point x
is feasible in the search space ss
, otherwise returns false
.
Arguments
x::AbstractVector{T}
: the point to check for feasibility.ss::ContinuousRectangularSearchSpace{T}
: the search space to check for feasibility in.
Returns
Bool
:true
ifx
is inss
, otherwisefalse
.
Throws
DimensionMismatch
: ifx
does not have the same number of dimensions asss
.
GlobalOptimization.fitness
— Methodfitness(c::AbstractCandidate)
Returns the fitness of the candidate c
.
GlobalOptimization.fitness
— Methodfitness(pop::AbstractPopulation, [i::Integer])
Returns the fitness of the candidates from a population. If i
is specified, returns the i
-th fitness.
GlobalOptimization.get_batch_evaluator
— Methodget_batch_evaluator(hopper_type::AbstractHopperType)
Returns the batch job evaluator for a given hopper type.
GlobalOptimization.get_best_candidate
— Methodget_best_candidate(opt::AbstractOptimizer)
Get the best candidate found by opt
.
GlobalOptimization.get_best_candidate_in_subset
— Methodget_best_candidate_in_subset(population::DEPopulation, idxs)
Get the best candidate in the selected subset of population (as specified by the indices in idxs
).
GlobalOptimization.get_best_fitness
— Methodget_best_fitness(opt::AbstractOptimizer)
Get the fitness of the best candidate found by opt
.
GlobalOptimization.get_elapsed_time
— Methodget_elapsed_time(opt::AbstractOptimizer)
Get the elapsed time of the optimizer opt
in seconds.
GlobalOptimization.get_function_tolerance
— Methodget_function_tolerance(opts::AbstractAlgorithmSpecificOptions)
Returns the function tolerance option from an algorithm options type.
GlobalOptimization.get_function_value_check
— Methodget_function_value_check(opts::AbstractAlgorithmSpecificOptions)
Returns the function value check option from an algorithm options type.
GlobalOptimization.get_general
— Methodget_general(opts::AbstractAlgorithmSpecificOptions)
Returns the general options from an algorithm options type.
GlobalOptimization.get_hopper_set
— Methodget_hopper_set(prob::AbstractProblem, hopper_type::AbstractHopperType)
Returns the hopper set for a given problem and hopper type.
GlobalOptimization.get_iteration
— Methodget_iteration(opt::AbstractOptimizer)
Get the current iteration number of the optimizer opt
.
GlobalOptimization.get_max_iterations
— Methodget_max_iterations(opts::AbstractAlgorithmSpecificOptions)
Returns the max iterations option from an algorithm options type.
GlobalOptimization.get_max_stall_iterations
— Methodget_max_stall_iterations(opts::AbstractAlgorithmSpecificOptions)
Returns the max stall iterations option from an algorithm options type.
GlobalOptimization.get_max_stall_time
— Methodget_max_stall_time(opts::AbstractAlgorithmSpecificOptions)
Returns the max stall time option from an algorithm options type.
GlobalOptimization.get_max_time
— Methodget_max_time(opts::AbstractAlgorithmSpecificOptions)
Returns the max time option from an algorithm options type.
GlobalOptimization.get_min_cost
— Methodget_min_cost(opts::AbstractAlgorithmSpecificOptions)
Returns the min cost option from an algorithm options type.
GlobalOptimization.get_population
— Methodget_population(opt::AbstractPopulationBasedOptimizer)
Returns the population of the optimizer opt
. This should return a subtype of AbstractPopulation
.
GlobalOptimization.get_scalar_function
— Methodget_scalar_function(prob::AbstractProblem)
Returns cost function plus the infeasibility penalty squared as a scalar value.
This is used for PSO (GA, Differential Evolution, etc. if we ever get around to adding those)
GlobalOptimization.get_scalar_function_with_penalty
— Methodget_scalar_function_with_penalty(prob::AbstractProblem)
GlobalOptimization.get_trace
— Methodget_trace(opts::AbstractOptions)
Returns the display option from an options type.
GlobalOptimization.handle_local_search
— Methodhandle_local_search(local_search::AbstractLocalSearch, hopper_type::AbstractHopperType)
Returns the local search algorithm for a given hopper type.
GlobalOptimization.handle_stall!
— Methodhandle_stall!(opt::AbstractOptimizer)
Handles updating the stall related fields of the AbstractOptimizerCache
for opt
.
GlobalOptimization.has_gradient
— Methodhas_gradient(evaluator::AbstractEvaluator)
Returns true
if the evaluator has a gradient, otherwise, false
.
GlobalOptimization.hop!
— Methodhop!(hopper::Union{Hopper, AbstractHopperSet}, ss, eval, dist, ls)
Performs a single hop for the hopper hopper
in the search space ss
using the evaluator eval
, the distribution dist
, and the local search ls
.
GlobalOptimization.initialize!
— Methodinitialize!(dist::AbstractMBHDistribution, num_dims)
Initializes the distribution dist
with the number of dimensions num_dims
.
GlobalOptimization.initialize!
— Methodinitialize!(cache::AbstractOptimizerCache, best_fitness)
A helper function to initialize the cache of an optimizer. This function should be called in the initialize!(opt)
method of the optimizer.
GlobalOptimization.initialize!
— Methodinitialize!(opt::AbstractOptimizer)
Initialize the optimizer opt
. All memory allocations that are not possible to do in the constructor should be done here when possible.
GlobalOptimization.initialize!
— Methodinitialize!(cache::AbstractPopulationBasedOptimizerCache)
A helper function to initialize the cache of a population based optimizer. This function should be called in the initialize!(opt)
method of the optimizer, after initializing the global_best_candidate
and global_best_fitness
fields of the cache.
GlobalOptimization.initialize!
— Methodinitialize!(vu::AbstractVelocityUpdateScheme, swarm_size::Int)
Initialize the velocity update scheme for a given swarm size.
GlobalOptimization.initialize!
— Methodinitialize!(
hopper::Hopper{T},
search_space::ContinuousRectangularSearchSpace{T},
evaluator::FeasibilityHandlingEvaluator{T},
)
Initializes the hopper position in the search space.
GlobalOptimization.initialize!
— Methodinitialize!(
swarm::Swarm{T},
pop_init_method::AbstractPopulationInitialization,
search_space::ContinuousRectangularSearchSpace{T}
)
Initializes the swarm
population with pop_init_method
in the search_space
.
GlobalOptimization.initialize_fitness!
— Methodinitialize_fitness!(swarm::Swarm{T}, evaluator::BatchEvaluator)
Initializes the fitness of each candidate in the swarm swarm
using the evaluator
.
GlobalOptimization.intersection
— Methodintersection(
ss1::ContinuousRectangularSearchSpace{T1},
ss2::ContinuousRectangularSearchSpace{T2}
)
Returns the intersection of the two search spaces ss1
and ss2
as a new search space.
Arguments
ss1::ContinuousRectangularSearchSpace{T1}
ss2::ContinuousRectangularSearchSpace{T2}
Returns
- `ContinuousRectangularSearchSpace{promote_type(T1, T2)}
Throws
DimensionMismatch
: ifss1
andss2
do not have the same number of dimensions.
GlobalOptimization.mutate!
— Methodmutate!(population::DEPopulation{T}, F)
Mutates the population population
using the DE mutation strategy.
This is an implementation of the unified mutation strategy proposed by Ji Qiang and Chad Mitchell in "A Unified Differential Evolution Algorithm for Global Optimization".
GlobalOptimization.num_dims
— Methodnum_dims(ss::ContinuousRectangularSearchSpace)
Returns the number of dimensions in the search space ss
.
Arguments
ss::ContinuousRectangularSearchSpace
Returns
Integer
GlobalOptimization.num_dims
— Methodnum_dims(prob::AbstractProblem)
Returns the number of dimensions of the decision vector of the optimization problem prob
.
GlobalOptimization.push!
— Methodpush!(step_memory::MBHStepMemoory{T}, step::Vector{T}, pre_step_fitness::T, post_step_fitness::T)
Pushes a step into the step memory.
GlobalOptimization.push_accepted_step!
— Methodpush_accepted_step!(
dist::MBHAdaptiveDistribution{T},
step::AbstractVector{T},
pre_step_fitness::T,
post_step_fitness::T,
) where {T}
GlobalOptimization.reset!
— Methodreset!(hopper::Hopper)
Resets the candidate to state prior to the last draw_update!
call.
Note: This just subtracts the last step from the candidate.
GlobalOptimization.scalar_function
— Methodscalar_function(prob::OptimizationProblem, x::AbstractArray)
Evaluates the objective function f
of the optimization problem prob
at x
and returns the cost function plus the infeasibility.
GlobalOptimization.scalar_function
— Methodscalar_function(prob::AbstractNonlinearEquationProblem, x::AbstractArray)
Evaluates the set of nonlinear equations f
and returns the nonlinear least squares cost plus half the infeasibility squared.
GlobalOptimization.scalar_function_with_penalty
— Methodscalar_function_with_penalty(prob::OptimizationProblem, x::AbstractArray)
Evaluates the objective function f
of the optimization problem prob
at x
and returns the cost function and the infeasibility penalty term as tuple. i.e., for an OptimizationProblem, this is simply the original function.
GlobalOptimization.scalar_function_with_penalty
— Methodscalar_function_with_penalty(prob::AbstractNonlinearEquationProblem, x::AbstractArray)
Evaluates the set of nonlinear equations f
and returns the nonlinear least squares cost and the infeasibility penalty term as a tuple.
GlobalOptimization.search_space
— Methodsearch_space(prob::AbstractProblem)
Returns the search space of the optimization problem prob
.
GlobalOptimization.selection!
— Methodselection!(population::DEPopulation{T}, evaluator::BatchEvaluator)
Replace candidates with mutants if they have a better fitness.
GlobalOptimization.set_fitness!
— Methodset_fitness!(c::AbstractCandidate, fitness)
GlobalOptimization.set_fitness!
— Methodset_fitness(pop::AbstractPopulation, fitness, [i::Integer])
Sets the fitness of the candidates from a population. If i
is specified, sets the i
-th fitness.
GlobalOptimization.step!
— Methodstep!(opt::AbstractOptimizer)
Perform a single step/iteration with the optimizer opt
. This function should be non-allocating if possible.
GlobalOptimization.step!
— Methodstep!(swarm::Swarm)
Steps the swarm swarm
forward one iteration.
GlobalOptimization.step_MAD_median
— Methodstep_MAD_median(step_memory::MBHStepMemory{T}, var_idx::Integer)
Returns the mean absolute deviation (MAD) around the median of the step memory. If var_idx
is specified, then the MAD median of the step memory for the variable at index var_idx
is returned.
GlobalOptimization.step_std
— Methodstep_std(step_memory::MBHStepMemory{T}, var_idx::Integer)
Returns the standard deviation of the step memory. If var_idx
is specified, then the standard deviation of the step memory for the variable at index var_idx
is returned.
GlobalOptimization.update_fitness!
— Methodupdate_fitness!(hopper::AbstractHopperSet{T}, distribution::AbstractMBHDistribution{T})
Updates the hopper fitness information after previously evaluating the fitness of the hopper.
GlobalOptimization.update_global_best!
— Methodupdate_global_best!(opt::AbstractPopulationBasedOptimizer)
Updates the global best candidate and fitness in the cache of the population based optimizer opt
when a better candidate is found. Returns true
if the global best candidate was updated, false
otherwise.
GlobalOptimization.update_velocity!
— Methodupdate_velocity!(swarm::Swarm, vu::AbstractVelocityUpdateScheme)
Update the velocity of each candidate in the swarm using the specified velocity update scheme.