Surrogate model
The surrogate model which is used for the optimisation can be created manually with
SurrogateModelOptim.surrogate_model
โ Function.surrogate_model(plan::AbstractArray{T,2}, samples::AbstractArray{T,2}; options=Options()) where T
Returns a surrogate model function based on an optimized Radial Basis Function interpolant. Depending on the options, the kernel, kernel width and scaling of input data is optimized.
...
Arguments
plan::AbstractArray{T,2}
: sample locations where each column corresponds to the location of one point.size(plan) = (num_dimensions,num_samples)
.samples::AbstractArray{T,2}
: function value at each sample location. each column contains one value from the corresponding plan location.size(samples) = (1,num_samples)
.options=Options()
: all options available to customize the surrogate optimization.
...
This enables the freedom to chose how it is optimised and used. When called, the function value from each surrogate in the ensemble is returned.
Example
julia> rosenbrock_2D(x) = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
julia> search_range=[(-5.0,5.0),(-5.0,5.0)]
# Start from 5 Latin Hypercube Samples
julia> num_samples=5
julia> sampling_plan_opt_gens=10_000
julia> plan = scaled_LHC_sampling_plan(search_range,num_samples,sampling_plan_opt_gens;trace=false)
# Evaluate the function
julia> samples = mapslices(rosenbrock_2D,plan,dims=1)
# Create the optimized surrogate model (optres contains the optimisation results for the surrogate)
opt=SurrogateModelOptim.Options()
julia> sm_interpolant, optres = surrogate_model(plan, samples;options=opt)
Model infill
New design locations can be found with
SurrogateModelOptim.model_infill
โ Function.model_infill(search_range::Vector{Tuple{Float64,Float64}},plan::AbstractArray{T,2},
samples::AbstractArray{T,2},sm_interpolant; options::Options=Options()) where T
Infill function that takes calculates the location of new samples based on the supplied options. The returned options are updated updated to facilitate cycling through the infill objective functions.
...
Arguments
search_range::Vector{Tuple{Float64,Float64}
: a vector of tuples containing the lower and upper limits for each dimension.length(search_range)
is equal to number of dimensions.plan::AbstractArray{T,2}
: sample locations where each column corresponds to the location of one point.size(plan) = (num_dimensions,num_samples)
.samples::AbstractArray{T,2}
: function value at each sample location. each column contains one value from the corresponding plan location.size(samples) = (1,num_samples)
.options=Options()
: all options available to customize the surrogate infill.
...
Example
julia> infill_plan, infill_type, infill_prediction, options = model_infill(search_range,plan,samples,sm_interpolant; options=Options())
Note
The options are updated to cycle through the infill_type
.