Compatibility configuration records#

New code can pass every setting directly to Solver, solve, or solve_many. Use dictionaries for reusable settings and seeds for batch restart seeds. These optional immutable records remain supported for existing callers; the preferred keyword path does not construct them.

class pybsp_rust.Options[source]#

Optional immutable compatibility record for algorithm parameters.

Parameters:
  • seed (int, default 1) – Unsigned 64-bit solver RNG seed. Controls initial messages and local search. It does not change a formula already generated with another seed.

  • backtrack_ratio (float, default 0.9) – Target ratio of backtracking actions to decimation actions, in [0,1). This is a deterministic scheduling ratio, not a per-step probability. Zero disables scheduled backtracking. Large values increase revisiting.

  • batch_fraction (float, default 0.00125) – Fraction in (0,1] of currently free variables selected per decimation. The batch is max(1, floor(batch_fraction * free_variables)), capped by the number free. Smaller batches require more SP fixed points.

  • epsilon (float, default 0.01) – Absolute tolerance in (0,1) on the largest undamped message update. Convergence does not establish the accuracy of the survey approximation.

  • damping (float, default 0.0) – Old-message weight in [0,1): new = raw + damping * (old - raw). Zero is undamped. Increasing it can stabilize oscillations but slows relaxation. The convergence test still compares raw against old.

  • max_sweeps (int, default 1024) – Positive sweep limit for each SP fixed-point attempt.

  • max_steps (int, default 100000) – Positive limit on recorded BSP actions. A step can contain many sweeps.

  • max_flips (int, default 0) – Nonnegative unsigned 64-bit WalkSAT flip budget across all restarts. Zero selects walksat_restarts * max(10000, 100 * residual_variables), counting free variables in active clauses at WalkSAT entry. Positive values override the automatic budget.

  • walksat_restarts (int, default 4) – Positive maximum number of randomized completions. Each restart has a quota of ceil(resolved_budget / walksat_restarts); the total cap still holds.

  • walksat_noise (float, default 0.5) – Probability in [0,1] of a uniformly random free variable in a sampled unsatisfied clause when every candidate has positive break count. Otherwise choose among minimum-break candidates, breaking ties randomly.

  • timeout_seconds (float or None, default None) – Positive finite cooperative wall-time limit since solver construction, including backend setup and time between calls. None disables it.

Raises:

ValueError – If a probability, tolerance, limit, or integer range is invalid.

Notes

Prefer direct algorithm keywords in new code. Values are validated by the same Rust code used by the CLI. Use dataclasses.replace(options, seed=...) to derive a modified configuration. Integer bounds also depend on the native platform’s index width.

class pybsp_rust.ExecutionOptions[source]#

Optional compatibility record for hardware and profiling settings.

Parameters:
  • backend ({'cpu', 'cpu-parallel', 'metal', 'cuda', 'cuda-f32'}, default 'cpu') – Scalar CPU double precision, multicore CPU double precision, Apple GPU single precision, NVIDIA GPU double precision, or NVIDIA GPU single precision. Metal requires a macOS metal build; CUDA requires a Linux cuda build and a supported device. Availability is checked when a solver is constructed. Single precision may change the search path.

  • threads (int, default 0) – Worker limit in 0..1024. Zero selects available logical CPUs. A single scalar CPU or GPU solver uses one host execution thread; solve_many uses this budget for independent jobs. The parallel CPU backend also uses it for sweeps within a job when appropriate.

  • profile (str or pathlib.Path or None, default None) – JSON profile destination written by Solver.solve(). Enables phase timers and GPU timestamps; GPU instrumentation changes submission costs. Batch solving rejects profiling: profile individual solvers instead.

Raises:

ValueError – If the backend name or worker limit is invalid.

Notes

Prefer direct backend, threads, and profile keywords in new code. The object is immutable. The requested backend can differ from the actual backend after numerical recovery; inspect Solver.execution_report.

See Parameters and stopping rules for the effect of every default, its exact domain, and its interaction with the numerical and computational budgets.