QuadraticOptimizer.jl
A Julia implementation for quadratic interpolation method (QIM) and quadratic fitting method (QFM).
Quick start
julia> using QuadraticOptimizer
julia> f(x) = sin(x) + x^2/10 # Function to minimize
f (generic function with 1 method)
julia> xs_init = [1.2, 0.1, -2.2] # 3 initial points to construct a parabola
3-element Vector{Float64}: 1.2 0.1 -2.2
julia> xs, fs = optimize_qim(f, xs_init, 10) # Optimize 10 steps
([1.2, 0.1, -2.2, -1.4980661244174434, -1.2293686986818357, -1.3061365335230135, -1.3059492270208548, -1.3064424808417185, -1.3064400170208186, -1.306440099017006, -1.3066465256797584, -1.306452471584103, -1.3064400463690848], [1.0760390859672262, 0.10083341664682816, -0.32449640381959, -0.7729361131769432, -0.7911428696877567, -0.79458228390424, -0.7945821972306206, -0.7945823375579667, -0.7945823375615284, -0.7945823375615235, -0.7945823127123063, -0.7945823374710272, -0.7945823375615275])
using Plots
pl = plot(f; xlims=(-5,5), color=:red3, label="objective")
plot!(pl, xs, fs; color=:blue3, label="iteration")
scatter!(pl, xs_init, f.(xs_init); color=:blue3, label="initial points")