executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
optimizersSelect, configure, run, and troubleshoot Qiskit Machine Learning optimizers for classical objectives and variational training, including SciPy wrappers, SPSA/QNSPSA, gradient and steppable workflows, bounds, callbacks, serialization, and optional NLopt.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when a downstream task must minimize a scalar objective over
parameter vectors with qiskit_machine_learning.optimizers. It covers the
optimizer contract and optimizer-specific behavior. It does not design a
VQC/VQR or other trainable model, and it does not implement quantum gradients;
route model embedding to algorithms and gradient construction to
qnn-gradients.
fun(x) -> scalar, a one-dimensional initial point x0, and, when
available, jac(x) -> gradient. Decide whether the objective is smooth,
noisy, constrained/bounded, or requires a global search.minimize(fun, x0, jac=jac, bounds=bounds) for an ordinary run.get_support_level() before trusting jac or bounds; ignored is
not the same as supported. The support matrix and constructor facts are in
api-reference.md.OptimizerResult and verify that the final point is feasible and
that the reported objective was evaluated under the same noise/seed policy.
If anything fails, use troubleshooting.md.from qiskit_machine_learning.optimizers import (
ADAM, AQGD, CG, COBYLA, GSLS, GradientDescent, L_BFGS_B,
NELDER_MEAD, NFT, P_BFGS, POWELL, QNSPSA, SLSQP, SPSA, TNC,
UMDA, SciPyOptimizer,
)
The optional NLopt-backed exports are CRS, DIRECT_L, DIRECT_L_RAND,
ESCH, ISRES, and SBPLX. Instantiate them only after checking the
optional dependency. Do not silently substitute an unsupported optimizer:
choose a documented CPU fallback when NLopt is unavailable.
fun, x0, optional jac, and optional
bounds, and returns an OptimizerResult; most optimizers require an
initial point even when their support level says it is merely supported.(lower, upper) pairs aligned with x0. Do not pass
bounds to an optimizer whose level is ignored and then assume they were
enforced. Use L_BFGS_B, SLSQP, TNC, POWELL, GSLS, or finite-bound
NLopt when bound enforcement is required.SPSA and QNSPSA are stochastic. Set
qiskit_machine_learning.utils.algorithm_globals.random_seed before the run
when reproducibility matters; a NumPy seed alone is not a substitute.learning_rate and perturbation is supplied,
construction of the run raises ValueError. Supplying neither invokes
calibration and consumes extra objective evaluations.algorithms, not this skill.settings is a configuration snapshot, not generally a live optimizer
state. Callables, fidelity functions, termination checkers, and custom linear
solvers are not JSON values. ADAM has a separate CSV snapshot mechanism.Before handing off an optimizer choice, check: import path; constructor
signature; support levels; objective and gradient shapes; finite bounds when
required; seed and evaluation budget; callback arity; result.x feasibility;
and result.fun, nfev, and nit interpretation. Run the bundled smoke
script from any working directory with python .../optimizer_smoke.py --help
or a small installed-package invocation using
scripts/optimizer_smoke.py.
Read the linked references progressively rather than loading the entire catalog into every optimization task.