Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
VQE Portfolio Optimization
VQE Portfolio Optimization

User Guide

  • Usage
  • Theory
  • Algorithms
    • Quantum algorithms
      • Binary VQE
      • Filtering VQE (F-VQE)
      • QAOA with X mixing
      • QAOA with XY exchange mixing
      • CVaR training for Binary VQE and QAOA
      • Variational quantum allocator
    • Classical algorithms
      • Exhaustive binary search
      • Top-return selection
      • Minimum-variance binary selection
      • Markowitz support enumeration
      • Equal-weight allocation
      • Convex Markowitz QP (OSQP)
      • Binary MILP (HiGHS)
      • Binary quadratic optimization (SCIP)
      • QP relaxation, rounding, and refinement
      • Multistart swap local search
      • Simulated annealing
      • Parallel tempering / replica exchange
      • Tabu search
      • Memetic genetic algorithm
      • Iterated local search (ILS)
      • GRASP
      • Variable neighborhood search (VNS)
      • Projected gradient descent (PGD)
      • Frank–Wolfe with away steps
      • Random exact-K sampling
  • Architecture and development
  • Results
  • Quantum advantage research
Back to top

Multistart swap local search¶

Track: exact-K binary selection. Method ID: swap.

Starts from top returns, diagonal objective costs, and seeded random subsets. Repeatedly applies the best improving exchange of one selected and one unselected asset.

Dependencies: NumPy; no extra dependencies.

Key parameters: seed, restarts (at least two), max_swaps, and an optional candidate_callback.

Guarantees and limits: Every exchange preserves K. An uncapped descent reaches a one-swap local optimum within numerical tolerance; the swap cap can stop earlier. Neither implies a global optimum.

Example¶

Use the shared inputs.

from vqe_portfolio.baselines import local_search_binary_baseline

result = local_search_binary_baseline(mu, Sigma, lam=4.0, k=2, seed=0, restarts=2)
Next
Simulated annealing
Previous
QP relaxation, rounding, and refinement
Copyright © 2026, Sid Richards
Made with Sphinx and @pradyunsg's Furo
On this page
  • Multistart swap local search
    • Example