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
impl Dbm
Sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Creates a new DBM of the given size (n clocks + reference clock 0).
Sourcepub fn create(
clock_names: Vec<String>,
lower_bounds: &[f64],
upper_bounds: &[f64],
) -> Self
pub fn create( clock_names: Vec<String>, lower_bounds: &[f64], upper_bounds: &[f64], ) -> Self
Creates an initial firing domain for enabled transitions.
Sourcepub fn clock_names(&self) -> &[String]
pub fn clock_names(&self) -> &[String]
Returns the clock names.
Sourcepub fn get(&self, i: usize, j: usize) -> f64
pub fn get(&self, i: usize, j: usize) -> f64
Gets the bound D[i][j] (clock_i - clock_j <= D[i][j]).
Sourcepub fn lower_bound(&self, i: usize) -> f64
pub fn lower_bound(&self, i: usize) -> f64
Returns the lower bound for clock i: -D[0][i+1].
Sourcepub fn upper_bound(&self, i: usize) -> f64
pub fn upper_bound(&self, i: usize) -> f64
Returns the upper bound for clock i: D[i+1][0].
Sourcepub fn can_fire(&self, i: usize) -> bool
pub fn can_fire(&self, i: usize) -> bool
Returns true if clock i can fire (lower bound <= epsilon after time passage).
Sourcepub fn canonicalize(&mut self)
pub fn canonicalize(&mut self)
Canonicalizes the DBM using Floyd-Warshall algorithm.
Sourcepub fn let_time_pass(&self) -> Dbm
pub fn let_time_pass(&self) -> Dbm
Lets time pass: set all lower bounds to 0 (minimum firing time reached).
Sourcepub fn fire_transition(
&self,
fired_clock: usize,
new_clock_names: &[String],
new_lower_bounds: &[f64],
new_upper_bounds: &[f64],
persistent_clocks: &[usize],
) -> Dbm
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.
Sourcepub fn canonical_string(&self) -> String
pub fn canonical_string(&self) -> String
Generates a canonical string representation for deduplication.