Configuration

Struct Configuration 

Source
pub struct Configuration {
    variable_assignment: HashMap<Variable, u32>,
    location_assignment: HashMap<Location, u32>,
}
Expand description

Global configuration of in a threshold automaton

A configuration specifies how many processes are in each location of the threshold automaton and the valuation of the shared variables

Fields§

§variable_assignment: HashMap<Variable, u32>

Valuation of the shared variables

§location_assignment: HashMap<Location, u32>

Number of processes per location

Implementations§

Source§

impl Configuration

Source

pub fn new<T, S>(variable_assignment: T, location_assignment: S) -> Self

Create a new configuration

This function creates a new configuration with the given variable and location assignments.

The variable and location assignments are represented as HashMaps, where the keys are the variables and locations, and the values are the number of processes in the respective location or the value of the variable.

Source

pub fn get_processes_in_location(&self, loc: &Location) -> u32

Number of processes in location loc

This function returns the number of processes in the given location loc. If the location is not known in the configuration, the function returns 0.

Source

pub fn get_variable_value(&self, var: &Variable) -> u32

Current value of variable

This function returns the value of the variable var in the configuration. If the variable is not known in the configuration, the function returns 0.

Source

pub fn variable_assignment(&self) -> impl Iterator<Item = (&Variable, &u32)>

Iterator over the variable assignment

This function returns an iterator over the variable assignment, where each item is a tuple of the variable and its value.

Source

pub fn location_assignment(&self) -> impl Iterator<Item = (&Location, &u32)>

Iterator over the location assignment

This function returns an iterator over the location assignment, where each item is a tuple of the location and the number of processes in it.

Source

pub fn apply_rule(&self, tr: &Transition) -> Option<Self>

Create the successor configuration after applying a transition

Returns None if the transition cannot be applied to the configuration. This can for example happen if the source location of the applied rule has no processes or not enough processes to apply the rule.

Source

pub fn display_compact(&self) -> String

Returns a compact representation of the configuration skipping locations and variables which are assigned 0

Trait Implementations§

Source§

impl Clone for Configuration

Source§

fn clone(&self) -> Configuration

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 Configuration

Source§

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

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

impl Display for Configuration

Source§

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

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

impl PartialEq for Configuration

Source§

fn eq(&self, other: &Configuration) -> 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 StructuralPartialEq for Configuration

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.