Finding all local minima of a continuous function over a bounded domain is fundamentally hard. Standard optimization algorithms (gradient descent, BFGS, etc.) find one local minimum from a given starting point — but how do you know there isn't a better one elsewhere?
Globtim solves this by replacing your function with a polynomial approximation. Setting the gradient of the polynomial to zero gives a polynomial system with finitely many solutions (bounded by Bezout's theorem), which can be computed numerically via homotopy continuation or exactly via symbolic methods. Each solution seeds a local refinement on the original function, searching for local minima across the entire domain — not just the nearest one.
f(x) --> Polynomial p(x) --> Solve grad(p) = 0 --> Refine with BFGS --> Candidate minima
(Chebyshev/Legendre) (HomotopyContinuation.jl)
using Pkg
Pkg.add("Globtim")For the latest development version:
Pkg.add(url="https://github.com/gescholt/Globtim.jl")using Globtim, DynamicPolynomials
# Define a test function (or use your own)
f = Deuflhard # Built-in test function
# Define domain: center and sampling range
TR = TestInput(f, dim=2, center=[0.0, 0.0], sample_range=1.2)
# Create polynomial approximation (degree 8)
pol = Constructor(TR, 8, precision=AdaptivePrecision)
println("L2-norm approximation error: $(pol.nrm)")
# Find all critical points
@polyvar x[1:2]
solutions = solve_polynomial_system(x, pol)
df = process_crit_pts(solutions, f, TR)
# Identify local minima
df_enhanced, df_min = analyze_critical_points(f, df, TR, enable_hessian=true)
println("Found $(nrow(df_min)) local minima")Experiments can be driven entirely by TOML configuration files, which specify the function, domain, polynomial degree, solver, and refinement settings:
julia --project=. globtim/scripts/run_experiment.jl experiments/configs/ackley_3d.tomlExample config for a static benchmark:
[experiment]
name = "ackley_3d"
[domain]
bounds = [[-5.0, 5.0], [-5.0, 5.0], [-5.0, 5.0]]
[polynomial]
GN = 12
degree_range = [4, 2, 10]
basis = "chebyshev"
[refinement]
enabled = true
method = "NelderMead"Two orthogonal polynomial bases are supported:
:chebyshev(default): Chebyshev polynomials — standard choice, well-tested:legendre: Legendre polynomials — uniform distribution of nodes along each coordinate axis
pol = Constructor(TR, 8, basis=:chebyshev, precision=AdaptivePrecision) # Default
pol = Constructor(TR, 8, basis=:legendre, precision=AdaptivePrecision) # AlternativeGlobtim supports multiple precision types for balancing accuracy and performance:
| Precision | Relative cost | Arithmetic | Best For |
|---|---|---|---|
Float64Precision |
1.0× | ~15 digits | General use (default) |
AdaptivePrecision |
1.2× | Float64 + BigFloat coefficients | Coefficient analysis, sparsification |
RationalPrecision |
5-10× | Exact arithmetic | Exact evaluations + symbolic solver (msolve) |
BigFloatPrecision |
3-8× | ~77 digits (256 bits) | Research |
pol = Constructor(TR, 8, precision=AdaptivePrecision)Two solvers are available for computing critical points:
- HomotopyContinuation.jl (default) — numerical algebraic geometry
- msolve — symbolic method based on Groebner basis computations
Globtim is part of a three-package ecosystem:
| Package | Purpose | Install |
|---|---|---|
| Globtim | Polynomial approximation and critical point finding | Pkg.add("Globtim") |
| GlobtimPostProcessing | Refinement, validation, parameter recovery | Pkg.add(url="https://github.com/gescholt/globtimpostprocessing") |
| GlobtimPlots | Visualization (CairoMakie/GLMakie) | Pkg.add(url="https://github.com/gescholt/globtimplots") |
Globtim (experiments) --> GlobtimPostProcessing (analysis) --> GlobtimPlots (visualization)
Globtim.jl/
├── src/ # Core package source
│ ├── Globtim.jl # Main module
│ ├── ApproxConstruct.jl # Polynomial construction
│ ├── hom_solve.jl # Homotopy continuation solver
│ └── ...
├── ext/ # Package extensions
│ └── GlobtimCUDAExt.jl # GPU acceleration (experimental)
├── test/ # Test suite
├── docs/ # Documenter.jl documentation
├── scripts/ # Experiment runner scripts
└── .github/workflows/ # CI (tests, docs, TagBot, CompatHelper)
GPL-3.0

