Skip to main content

CompiledNet

Struct CompiledNet 

Source
pub struct CompiledNet { /* private fields */ }
Expand description

Integer-indexed, precomputed representation of a PetriNet for bitmap-based execution.

Uses u64 bitmasks (64 bits per word) for O(W) enablement checks where W = ceil(place_count / 64).

Implementations§

Source§

impl CompiledNet

Source

pub fn compile(net: &PetriNet) -> Self

Compiles a PetriNet into an optimized bitmap representation.

Source

pub fn net(&self) -> &PetriNet

Returns the underlying PetriNet.

Source

pub fn place(&self, pid: usize) -> &PlaceRef

Returns the place at the given ID.

Source

pub fn transition(&self, tid: usize) -> &Transition

Returns the transition at the given compiled ID.

Source

pub fn place_id(&self, name: &str) -> Option<usize>

Returns the place ID for a given place name.

Source

pub fn place_id_or_panic(&self, name: &str) -> usize

Returns the place ID, panicking if not found.

Source

pub fn affected_transitions(&self, pid: usize) -> &[usize]

Returns affected transition IDs for a place.

Source

pub fn consumption_place_ids(&self, tid: usize) -> &[usize]

Returns consumption place IDs for a transition.

Source

pub fn cardinality_check(&self, tid: usize) -> Option<&CardinalityCheck>

Returns the cardinality check for a transition, if any.

Source

pub fn has_guards(&self, tid: usize) -> bool

Returns whether a transition has guard predicates.

Source

pub fn needs_mask(&self, tid: usize) -> &[u64]

Returns the needs mask slice for a transition.

Source

pub fn inhibitor_mask(&self, tid: usize) -> &[u64]

Returns the inhibitor mask slice for a transition.

Source

pub fn can_enable_bitmap(&self, tid: usize, marking_snapshot: &[u64]) -> bool

Two-phase bitmap enablement check for a transition:

  1. Presence check: verifies all required places have tokens
  2. Inhibitor check: verifies no inhibitor places have tokens

This is a necessary but not sufficient condition — cardinality and guard checks are performed separately by the executor for transitions that pass this fast path.

Trait Implementations§

Source§

impl Clone for CompiledNet

Source§

fn clone(&self) -> CompiledNet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CompiledNet

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.