Skip to main content

Dbm

Struct Dbm 

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

Difference Bound Matrix for encoding firing domains in Time Petri Nets.

Float64 matrix representation. Reference clock at index 0, transition clocks at indices 1..n.

bounds[i][j] represents the upper bound on (x_i - x_j).

Implementations§

Source§

impl Dbm

Source

pub fn new(size: usize) -> Self

Creates a new DBM of the given size (n clocks + reference clock 0).

Source

pub fn create( clock_names: Vec<String>, lower_bounds: &[f64], upper_bounds: &[f64], ) -> Self

Creates an initial firing domain for enabled transitions.

Source

pub fn empty_dbm() -> Self

Creates an empty (unsatisfiable) DBM.

Source

pub fn size(&self) -> usize

Returns the matrix size (dim x dim).

Source

pub fn clock_names(&self) -> &[String]

Returns the clock names.

Source

pub fn is_empty(&self) -> bool

Returns true if the DBM represents an empty zone.

Source

pub fn get(&self, i: usize, j: usize) -> f64

Gets the bound D[i][j] (clock_i - clock_j <= D[i][j]).

Source

pub fn set(&mut self, i: usize, j: usize, value: f64)

Sets the bound D[i][j].

Source

pub fn lower_bound(&self, i: usize) -> f64

Returns the lower bound for clock i: -D[0][i+1].

Source

pub fn upper_bound(&self, i: usize) -> f64

Returns the upper bound for clock i: D[i+1][0].

Source

pub fn can_fire(&self, i: usize) -> bool

Returns true if clock i can fire (lower bound <= epsilon after time passage).

Source

pub fn canonicalize(&mut self)

Canonicalizes the DBM using Floyd-Warshall algorithm.

Source

pub fn let_time_pass(&self) -> Dbm

Lets time pass: set all lower bounds to 0 (minimum firing time reached).

Source

pub fn fire_transition( &self, fired_clock: usize, new_clock_names: &[String], new_lower_bounds: &[f64], new_upper_bounds: &[f64], persistent_clocks: &[usize], ) -> Dbm

Computes successor firing domain after firing transition at fired_clock.

Implements the Berthomieu-Diaz successor formula: intersect constraints, canonicalize, substitute/eliminate fired clock, add fresh intervals for newly enabled, then final canonicalization.

Source

pub fn canonical_string(&self) -> String

Generates a canonical string representation for deduplication.

Trait Implementations§

Source§

impl Clone for Dbm

Source§

fn clone(&self) -> Dbm

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 Dbm

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Dbm

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Dbm

Auto Trait Implementations§

§

impl Freeze for Dbm

§

impl RefUnwindSafe for Dbm

§

impl Send for Dbm

§

impl Sync for Dbm

§

impl Unpin for Dbm

§

impl UnsafeUnpin for Dbm

§

impl UnwindSafe for Dbm

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.