[ANN] PolyStep.jl: Gradient-free optimization with batched evaluations - v0.3.0

Hi everyone!

I’d like to share PolyStep.jl, a gradient-free optimizer for general black-box objectives in Julia.

It works directly with function evaluations, so you can use it with smooth, nonsmooth, or piecewise-constant objectives without providing gradients. This can be useful when your objective involves a simulation, an argmax, or a combinatorial solver, or when computing gradients is inconvenient.

The package is registered and MIT-licensed, and integrates with Optimization.jl through PolyStepOptimizer.

To install:

using Pkg
Pkg.add(["Optimization", "PolyStep"])

Here’s a simple example minimizing a smooth objective:

using Optimization, PolyStep, Random

f(u, p) = sum(abs2, u)
prob = OptimizationProblem(f, fill(5.5, 10))

sol = solve(
    prob,
    PolyStepOptimizer(epsilon = 0.1, step_radius = 1.0);
    maxiters = 100,
    batched = X -> vec(sum(abs2, X; dims = 1)),
    rng = Xoshiro(0),
)

(sol.objective, sol.retcode)

The optional batched keyword lets you evaluate all candidates in a round with a single call. If you have a vectorized implementation of your objective, you can pass it in here.

The integration also supports bounds, maximization through MaxSense, maxiters, maxtime, and callbacks.

I’d love to hear what people try it on, whether that’s parameter tuning, simulation-based optimization, or objectives with discrete decisions inside them. If you give it a go, I’d love feedback on what works, what’s tricky, and what could be easier to use.

3 Likes