Skip to content

Optimizer Parameters

Abdulkadir Özcan edited this page Mar 26, 2026 · 2 revisions

Optimizer Parameters

Every parameter accepted by Minimization.optimize(), Maximization.optimize(), and MultiObjective.optimize() is documented here, with guidance on how to choose values.


Full signature

result = Minimization(space, objective).optimize(
    # Core HS parameters
    memory_size      = 20,
    hmcr             = 0.85,
    par              = 0.35,
    max_iter         = 5000,
    bw_max           = 0.05,
    bw_min           = 0.001,
    # Resume / checkpoint
    resume           = "auto",
    checkpoint_path  = None,
    checkpoint_every = 500,
    # Evaluation cache
    use_cache        = False,
    cache_maxsize    = 4096,
    # CSV logging
    log_init         = False,
    init_log_path    = None,
    log_history      = False,
    history_log_path = None,
    history_every    = 1,
    log_evaluations  = False,
    eval_log_path    = None,
    # Output
    verbose          = False,
    callback         = None,
)

MultiObjective additionally accepts archive_size.


Core Harmony Search parameters

memory_size (int, default 20)

Harmony Memory Size (HMS) — the number of candidate solutions kept in memory.

  • Larger values → more diversity, slower convergence
  • Smaller values → faster but may miss global optimum
  • Typical range: 10–50
  • Guideline: use 20–30 for most problems; increase to 50+ for high-dimensional spaces (> 20 variables)

hmcr (float, default 0.85)

Harmony Memory Considering Rate — probability of drawing a value from memory rather than sampling randomly.

  • Range: (0, 1)
  • Higher HMCR → more exploitation of known good solutions
  • Lower HMCR → more random exploration
  • Typical range: 0.70–0.95
  • Guideline: 0.85 works well for most problems. Lower to 0.70 if the algorithm gets stuck early.

par (float, default 0.35)

Pitch Adjusting Rate — given that a value was drawn from memory, probability of applying a small perturbation (pitch adjustment) rather than using the value as-is.

  • Range: (0, 1)
  • Higher PAR → more local search around memory values
  • Lower PAR → more exact memory recall
  • Typical range: 0.25–0.50
  • Guideline: 0.35 is a robust default. Increase to 0.45 for continuous problems, decrease to 0.20 for heavily discrete/categorical spaces.

max_iter (int, default 5000)

Total number of improvisation steps.

  • Guideline: start with 2000–5000. Monitor the history plot — if fitness is still decreasing at max_iter, increase it.
  • For expensive objectives (FEM, CFD): use use_cache=True and a larger budget.

bw_max (float, default 0.05)

Initial bandwidth for continuous pitch adjustment, as a fraction of domain width.

At iteration 0, Continuous.neighbor() uses a Gaussian step of σ = bw_max × (hi − lo).

  • Default 0.05 means ±5% of domain width at the start
  • Guideline: 0.05–0.20 for most problems. Increase for wide domains where large jumps are needed early.

Only affects Continuous variables. Discrete, Integer, and Categorical variables ignore bandwidth.


bw_min (float, default 0.001)

Final bandwidth — the step size decays exponentially from bw_max to bw_min over max_iter iterations.

  • Default 0.001 means ±0.1% of domain width at the end
  • Set bw_min == bw_max for constant bandwidth (original HS behavior)
  • Guideline: bw_min should be small enough for the desired solution precision. For structural problems requiring mm-precision, 0.001 is usually sufficient.

Decay formula:

bw(t) = bw_max × exp(−ln(bw_max/bw_min) × t / max_iter)

Resume / checkpoint parameters

resume (str, default "auto")

Controls whether to continue from an existing checkpoint or start fresh.

Value Behavior
"auto" Resume if checkpoint exists and is non-empty, else start fresh. Safe default for long runs.
"new" Always start fresh. Existing checkpoint is overwritten. Use when you want a clean run.
"resume" Always resume. Raises FileNotFoundError if checkpoint not found. Use to enforce continuity.

For expensive objectives, always enable use_cache=True.

Clone this wiki locally