Getting Started

This guide walks you through the basic usage of Globtim.jl for finding all local minima of continuous functions.

Basic Workflow

See: Examples/hpc_minimal_2d_example.jl

The typical Globtim workflow consists of five steps:

StepFunctionPurpose
1test_input(f, dim=2, ...)Define problem domain
2Constructor(TR, degree)Build polynomial approximation
3solve_polynomial_system(x, pol)Find critical points
4process_crit_pts(solutions, f, TR)Filter to valid solutions
5analyze_critical_points(f, df, TR)Refine and classify

1. Define the Problem

TR = test_input(f, dim=2, center=[0.0, 0.0], sample_range=1.2)

2. Find Critical Points

pol = Constructor(TR, 8)
@polyvar x[1:2]
solutions = solve_polynomial_system(x, pol)
df = process_crit_pts(solutions, f, TR)

3. Refine and Classify

df_enhanced, df_min = analyze_critical_points(f, df, TR, enable_hessian=true)

Domain Specification

Uniform scaling (square/cube domain):

TR = test_input(f, dim=2, center=[0.0, 0.0], sample_range=1.0)  # [-1,1]²

Non-uniform scaling (rectangular domain):

TR = test_input(f, dim=2, center=[0.0, 0.0], sample_range=[2.0, 1.0])  # [-2,2]×[-1,1]

See: Examples/domain_sweep_demo.jl


Polynomial Degree Selection

Higher degrees improve approximation but increase computation:

pol = Constructor(TR, degree)  # degree = 4, 6, 8, 10, ...

Check approximation quality: pol.nrm returns L²-norm error.


Precision Parameters

See: Examples/sparsification_demo.jl

PrecisionPerformanceAccuracyBest For
Float64PrecisionFastGoodGeneral use
AdaptivePrecisionGoodExcellentRecommended default
RationalPrecisionSlowExactSymbolic computation
BigFloatPrecisionSlowestMaximumResearch

Usage:

pol = Constructor(TR, 8, precision=AdaptivePrecision)

AdaptivePrecision with Sparsification

pol = Constructor(TR, 10, precision=AdaptivePrecision)
@polyvar x[1:2]
mono_poly = to_exact_monomial_basis(pol, variables=x)
analysis = analyze_coefficient_distribution(mono_poly)
truncated_poly, stats = truncate_polynomial_adaptive(mono_poly, analysis.suggested_thresholds[1])

High-Dimensional Problems

See: Examples/high_dimensional_demo.jl

For dimension ≥ 4:

  • Use AdaptivePrecision for good accuracy/performance balance
  • Use coefficient truncation to manage polynomial complexity
  • Monitor memory usage with higher degrees

HPC Cluster Usage

pol = Constructor(TR, 8, precision=AdaptivePrecision, verbose=0)
  • Float64Precision: Fastest, lowest memory
  • AdaptivePrecision: Good balance for production
  • Avoid RationalPrecision for large-scale computations

Built-in Test Functions

FunctionDimensionDescription
Deuflhard2DChallenging with multiple minima
RastringinnDClassic multimodal benchmark
HolderTable2D4 symmetric global minima
tref_3d3DHighly oscillatory
Beale, Rosenbrock, Branin2DStandard benchmarks

Usage:

f = Deuflhard
TR = test_input(f, dim=2, center=[0.0, 0.0], sample_range=1.2)

Next Steps