Docs

The envelope

A tool that claims to win everywhere can’t be trusted. The runtime tells you, up front, when to keep your current method.

check_envelope()

Describe your regime and get back USE, MARGINAL, or DECLINE — so you don’t spend a pilot proving a tie.

copyfrom swc import Regime

opt.check_envelope(Regime(
    baseline="optimizer",      # SPSA / parameter-shift / COBYLA / Adam | tuned_control | none
    per_round_evals=1,         # measurements per update (1 = gradient methods can't run)
    total_budget=1600,         # total shots / evaluations available
    n_params=N, drifting=True, related_stream=False,
    coupled_plant=False, have_calibration=True))

Where it wins

  • Gradient / black-box optimizer baseline at a tight budget.
  • One measurement per round under drift — the strongest regime; gradient estimators can’t run.
  • Anytime, real-time loops where you need a usable configuration every round under a scarce measurement budget.

Where it declines (and says so)

  • Static problems at ample budget — your optimizer reaches the optimum; edge goes to zero.
  • A hand-tuned robust PID on a near-linear plant — it only ties.
  • Coupled plants with no calibration — it needs the model too.

The decline is a feature: it means you deploy the runtime exactly where it pays and nowhere it doesn’t.