HumpDay

Derivative-free optimization algorithms in Python and JavaScript with no dependencies

HumpDay provides a tiny pure implementation of 23 derivative-free optimization algorithms in Python (and also JavaScript), with no external dependencies. All algorithms operate on the unit hypercube [0,1]ⁿ with automatic domain transformations for bounded and unbounded problems. Twenty-two of them are checked against a reference implementation: an established package such as scipy, PDFO or mealpy where one exists, and a textbook implementation for the simple baselines. The twenty-third, Alloy, is a machine-designed blend of five of the others and has no outside reference; it was validated instead on 29 held-out problems.
When you call minimize() without a method=, HumpDay times one call to your objective and picks the algorithm whose per-iteration overhead is small relative to that cost — so cheap functions get lightweight algorithms and expensive ones get sample-efficient ones. See Recommendations for the dimensional caps and overhead tiers that drive the choice.
Differential Evolution clears the rack in one break. Try it · 13+ more demos →
Run Algorithm Contest Python Source Browse Demonstrations JavaScript Source

Save the Planet

Cut and paste to avoid waste.

Read https://raw.githubusercontent.com/microprediction/humpday/main/SKILL.md
and create a project skill from it.

SKILL.md

Python Usage

Install via pip with minimal dependencies:

pip install humpday

You don't need to pick an algorithm. Call minimize with just the objective and bounds — HumpDay times one call to your objective and consults a benchmarks-driven recommendation grid to pick the algorithm whose dimensional cap, overhead tier, and Borda mean-rank on a 12-objective suite match your problem:

from humpday import minimize

def objective(x):
    return (x[0] - 2)**2 + (x[1] - 3)**2

result = minimize(objective, bounds=[(-5, 5), (-5, 5)])
print(result.x)                  # [2.0, 3.0]
print(result.method)             # which algorithm was picked
print(result.eval_time_measured) # cost of one objective call, in seconds
print(result.tier)               # overhead tier (0 trivial → 4 GP-fit-heavy)

If you do want a specific algorithm, pass method=:

result = minimize(objective, bounds=[(-5, 5), (-5, 5)], method='DifferentialEvolution')
Available Algorithm Methods
'Alloy', 'PRIMA_UOBYQA', 'PRIMA_NEWUOA', 'PRIMA_BOBYQA', 'NelderMead', 'Powell', 'LBFGSB', 'DifferentialEvolution', 'ParticleSwarm', 'CMAEvolutionStrategy', 'EvolutionStrategy', 'GeneticAlgorithm', 'BayesianOpt', 'RandomSearch', 'GridSearch', 'Rechenberg', 'HillClimbing', 'CoordinateDescent', 'PatternSearch', 'SimulatedAnnealing', 'HarmonySearch', 'FireflyAlgorithm', 'AntColonyOpt'

Interactive Demonstrations

The following tools provide empirical evaluation and visualization of algorithm performance:

Algorithm Contest

Comparative evaluation of optimizers on user-defined problems with statistical analysis.

Run Contest →

3D Visualization

Real-time visualization of optimization trajectories on three-dimensional objective surfaces.

View Visualization →

Individual Algorithm Documentation

Detailed documentation and interactive demos for each algorithm:

Algorithm Type Python Implementation JavaScript Implementation Reference Paper Documentation
Alloy Blend alloy.py#L40 alloy.js#L23 Cotton (2026) View →
PRIMA_UOBYQA Trust Region prima_algorithms.py#L482 prima-algorithms.js#L464 Powell (2002) View →
PRIMA_NEWUOA Trust Region prima_algorithms.py#L1003 prima-algorithms.js#L1121 Powell (2006) View →
PRIMA_BOBYQA Trust Region prima_algorithms.py#L1386 prima-algorithms.js#L1471 Powell (2009) View →
NelderMead Direct Search scipy_algorithms.py#L18 scipy-algorithms.js#L24 Nelder & Mead (1965) View →
Powell Direct Search scipy_algorithms.py#L190 scipy-algorithms.js#L203 Powell (1964) View →
LBFGSB Quasi-Newton scipy_algorithms.py#L507 scipy-algorithms.js#L305 Byrd et al. (1995) View →
DifferentialEvolution Evolutionary evolutionary_algorithms.py#L18 evolutionary-algorithms.js#L21 Storn & Price (1997) View →
ParticleSwarm Swarm Intelligence evolutionary_algorithms.py#L142 evolutionary-algorithms.js#L132 Kennedy & Eberhart (1995) View →
SimulatedAnnealing Metaheuristic evolutionary_algorithms.py#L274 evolutionary-algorithms.js#L267 Kirkpatrick et al. (1983) View →
GeneticAlgorithm Evolutionary evolutionary_algorithms.py#L421 evolutionary-algorithms.js#L407 Holland (1992) View →
RandomSearch Sampling evolutionary_algorithms.py#L494 evolutionary-algorithms.js#L488 Bergstra & Bengio (2012) View →
GridSearch Sampling search_algorithms.py#L314 search-algorithms.js#L275 Bergstra & Bengio (2012) No page (baseline)
BayesianOpt Bayesian evolutionary_algorithms.py#L506 evolutionary-algorithms.js#L521 Brochu et al. (2010) View →
CMAEvolutionStrategy Evolutionary evolutionary_algorithms.py#L835 evolutionary-algorithms.js#L875 Hansen (2016) View →
FireflyAlgorithm Bio-inspired evolutionary_algorithms.py#L1152 evolutionary-algorithms.js#L1137 Yang (2008) View →
AntColonyOpt Swarm Intelligence evolutionary_algorithms.py#L1233 evolutionary-algorithms.js#L1218 Dorigo et al. (1996) View →
HarmonySearch Metaheuristic evolutionary_algorithms.py#L1469 evolutionary-algorithms.js#L1329 Geem et al. (2001) View →
EvolutionStrategy Evolutionary evolutionary_algorithms.py#L1345 evolutionary-algorithms.js#L1382 Beyer & Schwefel (2002) View →
Rechenberg (1+1)-Evolution Strategy search_algorithms.py#L14 search-algorithms.js#L25 Rechenberg (1973), Evolutionsstrategie View →
CoordinateDescent Local Search search_algorithms.py#L88 search-algorithms.js#L83 Wright (2015) View →
PatternSearch Direct Search search_algorithms.py#L221 search-algorithms.js#L159 Torczon (1997) View →
HillClimbing Local Search evolutionary_algorithms.py#L1425 search-algorithms.js#L236 Russell & Norvig (1995) View →

Algorithm Categories

Trust Region Methods

Model-based algorithms using quadratic approximations:

Classic Numerical Methods

Workhorse non-derivative-free methods, ported to pure Python:

Evolutionary & Swarm

Population-based stochastic methods:

Metaheuristics

Acceptance-rule and memory-based search:

Local & Pattern Search

Lightweight baselines and direct-search workhorses:

Blends

Methods that combine others: