Skip to main content

Crate probl_engine

Crate probl_engine 

Source
Expand description

The Probl engine: values, distributions and the world-set interpreter. The rules it implements are in docs/semantics.md.

Re-exports§

pub use error::ErrorKind;
pub use error::RuntimeError;
pub use failure::Failure;
pub use failure::Failures;
pub use interp::Stats;
pub use interp::Updates;
pub use weight::Weight;

Modules§

analytic
Identity-preserving continuous outcomes during enumeration.
builtins
Built-in functions that don’t need the interpreter.
chain
Solving loops as absorbing Markov chains (docs/semantics.md, section 10).
complex
Finite complex scalars. These are data, never probability weights.
conjugate
Exact updates for conjugate priors (docs/semantics.md, section 14): the probability of an observation when its parameter is unknown, and the parameter’s distribution after it.
continuous
Continuous distributions (docs/semantics.md, section 13): densities, CDFs, quantiles and moments, and drawing from them.
data
Loading a program’s data (docs/data-input.md).
dates
Immutable Gregorian dates, stored as days since 1970-01-01. Public domain: 0001-01-01 through 9999-12-31. No clock is read here.
dist
Finite distributions: dice, choices, counts, and the results of computing with them.
error
Runtime errors.
failure
Worlds that ended at a fault, when the failure mode is partial (docs/semantics.md, section 11).
interp
The world-set interpreter.
ops
Operators, and applying operations to every outcome of a distribution.
report
Collecting report values across worlds, and printing them (docs/semantics.md, sections 9, 10 and 14).
value
Runtime values.
weight
Weights: non-negative numbers with a binary mantissa and a 64-bit exponent, so products of many small probabilities (long chains of observations) can’t underflow to zero.
world
Worlds, and merging the ones that have become identical.

Structs§

Limits
Upper bounds set by whoever runs a program. A program’s @max_worlds and @max_iterations can lower them, never raise them.
Options
How the engine runs. The defaults are what probl run uses, except that the CLI also supplies an execution-date snapshot.
Outcome
Progress
A function told how many runs are done, and how many there are.
Sampled
How a program was sampled (docs/semantics.md, section 14).

Enums§

FailureMode
What a fault in one world does to the others (docs/semantics.md, section 11). The world that fails always stops there.
Fault
A language error that depends on the values a world computes with, not on the program being wrong: dividing by zero, an index past the end. A catch can name one; in partial mode, one that isn’t caught ends only its world (docs/semantics.md, section 11). Errors that aren’t faults always stop the run.

Functions§

run
Run a program. print receives the output of print(…) as it happens. Every problem, including a crash of the engine itself, comes back as an error.
run_on_this_thread
Run a program on the calling thread, as run does on a thread of its own. The calling thread’s stack must be large enough for the program’s calls (Limits::stack_size doesn’t apply), and a panic isn’t caught. With one thread allowed (Limits::max_threads), sampling starts no thread either, so this works where threads aren’t available, such as in WebAssembly.