Skip to content

gescholt/Globtim.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Globtim.jl — Global Optimization via Polynomial Approximation

Documentation (stable) Documentation (dev)

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)

Challenging 1D function — multi-frequency oscillations at varying polynomial degrees:

1D Comparison

Styblinski-Tang 2D — classic test function with polynomial approximation:

Styblinski-Tang

Installation

using Pkg
Pkg.add("Globtim")

For the latest development version:

Pkg.add(url="https://github.com/gescholt/Globtim.jl")

Quick Start

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")

Running Experiments with TOML Configs

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.toml

Example 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"

Polynomial Basis Options

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)   # Alternative

Precision Control

Globtim 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)

Solvers

Two solvers are available for computing critical points:

  1. HomotopyContinuation.jl (default) — numerical algebraic geometry
  2. msolve — symbolic method based on Groebner basis computations

Ecosystem

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)

Repository Organization

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)

License

GPL-3.0

About

Global optimization via polynomial approximations

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors