Derivative-free optimization algorithms in Python and JavaScript with no dependencies
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.
Cut and paste to avoid waste.
Read https://raw.githubusercontent.com/microprediction/humpday/main/SKILL.md
and create a project skill from it.
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')
'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'
The following tools provide empirical evaluation and visualization of algorithm performance:
Comparative evaluation of optimizers on user-defined problems with statistical analysis.
Run Contest →Real-time visualization of optimization trajectories on three-dimensional objective surfaces.
View Visualization →Detailed documentation and interactive demos for each algorithm:
Model-based algorithms using quadratic approximations:
Workhorse non-derivative-free methods, ported to pure Python:
Population-based stochastic methods:
Acceptance-rule and memory-based search:
Lightweight baselines and direct-search workhorses: