Skip to main content

Engine

Struct Engine 

Source
pub struct Engine<O, P, G, D>{ /* private fields */ }
Expand description

Aria Engine — the Spec state machine with pluggable backends.

Implementations§

Source§

impl<O, P, GB, D> Engine<O, P, GB, D>

Source

pub fn new( config: AriaConfig, optical: O, predictor: P, graph_backend: GB, diffuser: D, ) -> Self

Create a new engine with backends and config.

Source

pub fn init(&self, psi0: Vec<Complex64>, g0: Graph, a0: Condition) -> State

Init: create the initial state per FORMAL_SPEC §5.

ψ = ψ₀, z = I(ψ₀), G = G₀, t = 0, prevRes = d(I(ψ₀), P(I(ψ₀), a(0)))

Source

pub fn apply( &self, state: State, action: Action, a: Condition, ) -> Result<State, AriaError>

Apply a single named action to the state.

Returns the new state on success, or an invariant violation. This is the Spec’s Next relation turned into a deterministic function.

Source

pub fn step_phi(&self, state: State, a: Condition) -> Result<State, AriaError>

Step one full Φ-cycle: OpticalStep → Predict → Match → Diffuse (𝐂4).

This is the preferred schedule. Each sub-step checks invariants. Returns the state after the full cycle, or the first invariant violation.

Source

pub fn run( &self, state: State, scheduler: &mut Scheduler, steps: u64, a: Condition, ) -> Result<(State, Trace), AriaError>

Run the engine for a number of steps with a scheduler.

Returns the final state and a trace of all steps.

Source

pub fn check(&self, state: &State, a: Condition) -> InvariantReport

Check all invariants on the current state without applying an action.

Source

pub fn config(&self) -> &AriaConfig

Access config.

Trait Implementations§

Source§

impl<O, P, G, D> Debug for Engine<O, P, G, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<O, P, G, D> Freeze for Engine<O, P, G, D>
where O: Freeze, P: Freeze, G: Freeze, D: Freeze,

§

impl<O, P, G, D> RefUnwindSafe for Engine<O, P, G, D>

§

impl<O, P, G, D> Send for Engine<O, P, G, D>

§

impl<O, P, G, D> Sync for Engine<O, P, G, D>

§

impl<O, P, G, D> Unpin for Engine<O, P, G, D>
where O: Unpin, P: Unpin, G: Unpin, D: Unpin,

§

impl<O, P, G, D> UnsafeUnpin for Engine<O, P, G, D>

§

impl<O, P, G, D> UnwindSafe for Engine<O, P, G, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.