# Run Optimum™ optimisation and verify the saved candidate

Search for a better critical-margin centre, inspect the stopping outcome and separately verify the numeric circuit that was actually saved.

## Compatibility

JoSIM®-Pro 2.9.0 release target; frozen current-source Windows evidence

Published guidance with release-applicability limits. Confirm package applicability before following this guide.

**KB-OPTIMUM-001 · verified workaround**: Use a fresh complete writable ASCII-path teaching copy for the checked Windows typed study. This avoids the reproduced Unicode-path boundary without changing locale or renaming production sources.

[Download Complete Optimum™ resistor studies and native receipt client (ZIP)](/_functions/kbExample?name=optimum-resistor-studies.zip)

Includes: resistor.cir, resistor.sp, verify.toml, margin.toml, yield.toml, rolloff.toml, optimize.toml, optimum_receipt.py, README.txt.

## Start from a verified nominal circuit and a defined objective

Use the complete resistor-study ZIP in a new writable ASCII directory and a matching current 2.9 runtime. The following is the scripted CLI route. Current maintained GUI support is Run > Optimum™ studies, with reviewed candidate adoption; its native Windows interaction/screenshot checks remain separate from this recipe.

COG optimisation samples around the current parameter centre, uses passing/reflected samples to form a candidate, and evaluates its critical margin. It is not a general least-squares fit to an arbitrary target waveform. Nominal verification is required before the search.

The supplied resistor starts at 45 ohms with a critical margin near 11.04%. Its analytically best symmetric relative margin under the 40–60-ohm acceptance interval is 20% at 50 ohms. That reference lets us distinguish improvement from a claim of global optimality.

## Run a bounded search and inspect the saved candidate

1. Keep the supplied optimize.toml settings for this first run: COG, 200 samples per iteration, at most five iterations, seed 1234 and target = 0.18.
2. Run the commands below from the extracted directory. Check the current termination message and saved numeric RVAL before running the generated circuit normally.
3. For a separate SP re-verification, make a working copy of verify.toml and set only verify.circuit to optimized.cir. For a fresh margin calculation, copy margin.toml, set its circuit to optimized.cir and choose a new report filename. Run those configurations with the same acceptance rule.
4. If using the typed API or GUI adoption route, require a committed artifact with verified = true and matching saved-file identity; inspection, a planned artifact or file existence alone does not approve adoption.

```text
optimum-cli -r 1234 verify.toml
if ($LASTEXITCODE -ne 0) { throw "Nominal verification failed" }
optimum-cli -r 1234 optimize.toml
if ($LASTEXITCODE -ne 0) { throw "Optimization failed" }
Get-Content .\optimized.cir
josim-pro-cli -o optimized_trace.csv optimized.cir
if ($LASTEXITCODE -ne 0) { throw "Saved circuit rerun failed" }
```

## Read improvement, stopping reason and saved precision separately

The native receipt distinguishes study completion, stopping outcome, initial/best margins, best_verified and the committed candidate identity. Re-verify the saved numeric circuit because formatting and dependent-parameter locking can differ from an unrounded in-memory candidate. The exporter works from logical input; do not assume that only one byte-preserving .PARAM edit occurred.

A completed run need not improve the nominal circuit. With max_iterations = 0, the checked current path completes with outcome max_iterations, zero iterations and a verified nominal candidate. Its margin remains about 11.04%. Earlier installed review binaries could leave no or stale output instead; compare actual payload identities when behaviour differs.

The current route refuses an existing destination by default. Choose a new output path or fresh working directory. Do not infer a new result from an old file, and do not enable overwrite without deciding that the existing artifact may be replaced.

| Observed field | Checked result or interpretation |
| --- | --- |
| Initial critical margin | 11.03515625% in the native receipt; 11.04% in the detailed text report. |
| Stopping outcome | target after four iterations. target = 0.18 means 18%, not 0.18%. |
| Best internal centre | Approximately 49.1146356638 ohms. |
| Saved RVAL | 49.114636 with sig_digits = 8. |
| Fresh saved-file margin | 18.55% lower side and 22.07% upper side; critical margin 18.55%. |
| Meaning | The configured 18% target was met. The analytically best 20% centre was not established by this result. |

## Know what the controls constrain

margin.min_search and margin.max_search limit verification probe ratios around a candidate; they are not hard physical bounds on the optimiser. sig_digits formats the saved circuit and does not put the search on a discrete parameter grid. The current native inspection rejects an unsupported optimize.bounds field rather than silently imposing it.

The receipt reports effective method, seed origin, sample counts, target percentage, patience, convergence and other COG controls. Review those settings before comparing results from different configurations. A runtime/CLI seed override takes precedence over the configured optimisation seed in the checked route.

The current configuration retains the best verified candidate when progress stalls or the iteration budget ends. Distinguish target, patience, convergence, iteration cap and no improvement. A stop is a completion outcome, not proof that every possible centre or physical constraint has been explored.

## Complete resistor.cir

```text
* Public one-resistor Optimum teaching circuit; RVAL is actually consumed
.PARAM RVAL=45
I1 0 N PWL(0 0 10p 0 20p 1m 100p 1m)
R1 N 0 RVAL
.TRAN 1p 100p
.PRINT V(N)
.END

```

## Complete resistor.sp

```text
time N
0 0
1e-11 0
2e-11 0.05
5e-11 0.05
1e-10 0.05

```

## Complete verify.toml

```text
mode = "verify"

[verify]
method = "spec_file"
circuit = "resistor.cir"
file = "resistor.sp"
amplitude_threshold = 0.20

```

## Complete optimize.toml

```text
mode = "optimize"

[verify]
method = "spec_file"
circuit = "resistor.cir"
file = "resistor.sp"
amplitude_threshold = 0.20

[parameters]
search_string = "^RVAL$"

[margin]
accuracy = 0.001
binary_search_steps = 12
min_search = 0.5
max_search = 1.5
output = "optimization_margin.txt"

[optimize]
method = "cog"
spread = 0.40
samples = 200
samples_max = 200
max_iterations = 5
patience = 3
target = 0.18
seed = 1234
sig_digits = 8
output = "optimized.cir"

```

## Sources and verification details

Recorded inputs/builds only. Complete walkthrough and final-package acceptance remain separate.

- VAL-030: JoSIM/Optimum 2.9.0 frozen maintained source, native Windows x64 Clang/OpenMP build, 3 November 2026. Fresh hash-frozen Windows 2.9 source build: complete SP resistor Margin/Yield/roll-off/COG Optimize, analytic bounds and statistics, saved-candidate re-verification, native typed JSON receipts, per-sample seeded identity at one/two threads and guarded failures Sixty-two checks qualify this linear SP fixture and the recorded Windows source candidate. The current Unicode configuration-path issue remains KB-OPTIMUM-001, with ASCII-path recovery checked. GUI run/cancel/adoption screenshots, EVENT/CSV/Josephson/process-distribution validation, other platforms, broad concurrency/callback/cancellation contracts and final distributed packages remain open. Earlier installed review binaries behaved differently and are retained separately.


- josim-pro:docs/manual_source/sections/optimum.tex: Current reviewed Optimum reference; applicable mode/configuration and bounded SP fixture claims
- validation:optimum-current-windows-20261103: VAL-030; fresh native CLI/API execution and recovery

- Sixty-two checks qualify this linear SP fixture and the recorded Windows source candidate. The current Unicode configuration-path issue remains KB-OPTIMUM-001, with ASCII-path recovery checked. GUI run/cancel/adoption screenshots, EVENT/CSV/Josephson/process-distribution validation, other platforms, broad concurrency/callback/cancellation contracts and final distributed packages remain open. Earlier installed review binaries behaved differently and are retained separately.
- The source reference was reviewed and re-pinned individually after its maintained content changed. Older installed-review observations remain separate; no final package or GUI walkthrough is accepted.

## Related guides

- [Start Optimum™ with a verified nominal circuit](/knowledge-base/optimum-first-verification)
- [Configure and interpret an Optimum™ margin study](/knowledge-base/optimum-margin-workflow)
- [Configure and interpret an Optimum™ yield study](/knowledge-base/optimum-yield-workflow)
- [Inspect and run Optimum™ with structured JSON receipts](/knowledge-base/optimum-agent-receipts)
- [SP, CSV and EVENT verification give different margins](/knowledge-base/optimum-margin-criteria)
- [Write and run a complete JoSIM circuit netlist](/knowledge-base/josim-netlist-basics)
