Calibration
- cubie.batchsolving.calibration.run_calibration(parent: Any, initial_values: Any, parameters: Any, drivers: Any | None = None, duration: float = 1.0, settling_time: float = 0.0, t0: float = 0.0, grid_type: str = 'verbatim', apply: bool = True, verbose: bool = True, auto_size: bool = True, waves: int = 5, target_ms: float = 20.0, max_parallel: int = 4, fix_constant_parameters: bool = True) CalibrationResult[source]
Race solver configurations for a solver and pick the fastest.
- Parameters:
parent – The configured
Solverwhose system, tolerances, and output configuration every candidate shares.initial_values – Initial state values for each integration run, as accepted by
Solver.solve().parameters – Parameter values for each run, as accepted by
Solver.solve().drivers –
DriverSamplesreplacing the solver’s configured samples.duration – Total integration time candidates are ranked on.
settling_time – Warm-up period before recording outputs.
t0 – Initial integration time.
grid_type – Strategy for constructing the integration grid from inputs. Only used when dict inputs trigger grid construction.
apply – Apply the winner’s configuration to
parentwhenTrue.verbose – Print per-candidate progress lines.
auto_size – Race a batch sized for
target_mssolves atduration;Falseraces the given batch.waves – Waves of the most concurrent candidate the batch starts at.
target_ms – Kernel milliseconds per timed solve the batch is sized for.
max_parallel – Maximum compilations to run in parallel.
fix_constant_parameters – Compile in every dict entry and every row of a full-height parameter array that holds one value, as
Solver.solve()does.
- Returns:
Winner, ranking, and every candidate measurement. A candidate that fails to build or integrate is reported as dropped with its error message.
- Return type:
CalibrationResult
- Raises:
ValueError – No driver samples for a driven system;
wavesunder 1;target_msunder 10 or not finite.
- class cubie.batchsolving.calibration.CalibrationResult(candidates: List[CandidateResult], winner: CandidateResult | None, ranking: List[CandidateResult], features: Dict[str, Any], applied_settings: Dict[str, Any])[source]
Bases:
objectComplete calibration report.
- Parameters:
candidates (List[cubie.batchsolving.calibration.CandidateResult]) – Every candidate measurement from every stage, in run order.
winner (cubie.batchsolving.calibration.CandidateResult | None) – Fastest candidate of the top success tier, or
Nonewhen no candidate was timed.ranking (List[cubie.batchsolving.calibration.CandidateResult]) – Every timed configuration: the top success tier by time, then the rest by time.
features (Dict[str, Any]) – System description (sizes, precision, tolerances, …) accompanying the measurements.
applied_settings (Dict[str, Any]) – Settings applied to the calling solver, empty when nothing was applied.
- candidates: List[CandidateResult]
- ranking: List[CandidateResult]
- to_records() List[Dict[str, Any]][source]
Return flat per-candidate dictionaries for tabular export.
- winner: CandidateResult | None
- class cubie.batchsolving.calibration.CandidateResult(spec: CandidateSpec, stage: str, times_ms: Tuple[float, ...] = (), failures: int = 0, runs: int = 0, dropped: bool = False, reason: str = '')[source]
Bases:
objectMeasured outcome for one candidate.
- Parameters:
spec (cubie.batchsolving.calibration.CandidateSpec) – The candidate configuration measured.
stage (str) – Name of the race stage the measurement belongs to.
times_ms (Tuple[float, ...]) – Kernel milliseconds of every timed solve.
failures (int) – Runs with a nonzero status code.
runs (int) – Trajectory count each solve integrated.
dropped (bool) – Whether the candidate could not be timed.
reason (str) – Why the candidate was dropped, empty otherwise.
- property best_ms: float
Lowest measured solve time,
infwhen never timed.
- dropped: bool
- property failure_fraction: float
Failed runs as a fraction of the trajectory count.
- failures: int
- reason: str
- runs: int
- spec: CandidateSpec
- stage: str
- property success_rate: float
Share of the batch that integrated without a status flag.
- property timed: bool
Whether the candidate has a time.
- class cubie.batchsolving.calibration.CandidateSpec(label: str, family: str, algorithm: str, settings: Tuple[Tuple[str, Any], ...] = ())[source]
Bases:
objectOne candidate configuration in the calibration race.
- Parameters:
- algorithm: str
- family: str
- property key: Tuple[str, Tuple[Tuple[str, Any], ...]]
Identity of the configuration, independent of its label.
- label: str