pub struct GeneralThresholdAutomaton {
name: String,
parameters: HashSet<Parameter>,
variables: HashSet<Variable>,
locations: HashSet<Location>,
outgoing_rules: HashMap<Location, Vec<Rule>>,
initial_location_constraint: Vec<LocationConstraint>,
initial_variable_constraint: Vec<BooleanVarConstraint>,
resilience_condition: Vec<ParameterConstraint>,
}Expand description
Type representing a general threshold automaton that can include variable comparisons, general non-linear arithmetic guards and as well as reset actions.
Fields§
§name: StringName of the threshold automaton
parameters: HashSet<Parameter>List of parameters appearing in the threshold automaton
variables: HashSet<Variable>List of shared variables appearing in the threshold automaton
locations: HashSet<Location>List of locations appearing in the threshold automaton
outgoing_rules: HashMap<Location, Vec<Rule>>Transition rules of the threshold automaton indexed by source location
initial_location_constraint: Vec<LocationConstraint>Initial constraints on the number of processes in a location
initial_variable_constraint: Vec<BooleanVarConstraint>Initial constraint on the variable values
resilience_condition: Vec<ParameterConstraint>Constraint over the parameters of the threshold automaton
Implementations§
Source§impl GeneralThresholdAutomaton
impl GeneralThresholdAutomaton
Sourcepub fn initial_variable_conditions(
&self,
) -> impl Iterator<Item = &BooleanVarConstraint>
pub fn initial_variable_conditions( &self, ) -> impl Iterator<Item = &BooleanVarConstraint>
Returns an iterator over the initial location constraints of the threshold automaton
Sourcepub fn initial_location_conditions(
&self,
) -> impl Iterator<Item = &LocationConstraint>
pub fn initial_location_conditions( &self, ) -> impl Iterator<Item = &LocationConstraint>
Returns an iterator over the initial location constraints of the threshold automaton
Sourcepub(crate) fn get_rule_map(&self) -> HashMap<Location, Vec<Rule>>
pub(crate) fn get_rule_map(&self) -> HashMap<Location, Vec<Rule>>
Get the internal set of rules of the threshold automaton
Sourcepub fn get_ta_body_in_bymc_format(&self) -> String
pub fn get_ta_body_in_bymc_format(&self) -> String
Returns the body of the threshold automaton, i.e. the definitions of
locations, variables, rules, initial assumptions, etc. in ByMC format
without the outer proc/ skel/ thresholdAutomaton declaration
Trait Implementations§
Source§impl Clone for GeneralThresholdAutomaton
impl Clone for GeneralThresholdAutomaton
Source§fn clone(&self) -> GeneralThresholdAutomaton
fn clone(&self) -> GeneralThresholdAutomaton
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GeneralThresholdAutomaton
impl Debug for GeneralThresholdAutomaton
Source§impl Display for GeneralThresholdAutomaton
impl Display for GeneralThresholdAutomaton
Source§impl IsDeclared<Location> for GeneralThresholdAutomaton
impl IsDeclared<Location> for GeneralThresholdAutomaton
Source§fn is_declared(&self, loc: &Location) -> bool
fn is_declared(&self, loc: &Location) -> bool
Source§impl IsDeclared<Parameter> for GeneralThresholdAutomaton
impl IsDeclared<Parameter> for GeneralThresholdAutomaton
Source§fn is_declared(&self, param: &Parameter) -> bool
fn is_declared(&self, param: &Parameter) -> bool
Source§impl IsDeclared<Variable> for GeneralThresholdAutomaton
impl IsDeclared<Variable> for GeneralThresholdAutomaton
Source§fn is_declared(&self, var: &Variable) -> bool
fn is_declared(&self, var: &Variable) -> bool
Source§impl ModifiableThresholdAutomaton for GeneralThresholdAutomaton
impl ModifiableThresholdAutomaton for GeneralThresholdAutomaton
Source§fn retain_rules<F>(&mut self, predicate: F)
fn retain_rules<F>(&mut self, predicate: F)
Source§fn transform_rules<F>(&mut self, f: F)
fn transform_rules<F>(&mut self, f: F)
Source§fn remove_location_and_replace_with(
&mut self,
location: &Location,
subst: IntegerExpression<Location>,
)
fn remove_location_and_replace_with( &mut self, location: &Location, subst: IntegerExpression<Location>, )
location from the threshold automaton, removes rules
referencing the location and replace every occurrence in initial
conditions with subst Read moreSource§fn remove_variable_and_replace_with(
&mut self,
variable: &Variable,
subst: IntegerExpression<Variable>,
)
fn remove_variable_and_replace_with( &mut self, variable: &Variable, subst: IntegerExpression<Variable>, )
variable from the threshold automaton, replace every
occurrence in initial conditions or guards with subst and remove all
updates to variable from the rules Read moreSource§fn add_resilience_conditions<C: IntoIterator<Item = BooleanExpression<Parameter>>>(
&mut self,
conditions: C,
)
fn add_resilience_conditions<C: IntoIterator<Item = BooleanExpression<Parameter>>>( &mut self, conditions: C, )
Source§fn add_initial_location_constraints<C: IntoIterator<Item = LocationConstraint>>(
&mut self,
constraints: C,
)
fn add_initial_location_constraints<C: IntoIterator<Item = LocationConstraint>>( &mut self, constraints: C, )
Source§fn add_initial_variable_constraints<C: IntoIterator<Item = BooleanVarConstraint>>(
&mut self,
constraints: C,
)
fn add_initial_variable_constraints<C: IntoIterator<Item = BooleanVarConstraint>>( &mut self, constraints: C, )
Source§fn replace_initial_location_constraints<C: IntoIterator<Item = LocationConstraint>>(
&mut self,
constraints: C,
)
fn replace_initial_location_constraints<C: IntoIterator<Item = LocationConstraint>>( &mut self, constraints: C, )
Source§fn replace_initial_variable_constraints<C: IntoIterator<Item = BooleanVarConstraint>>(
&mut self,
constraints: C,
)
fn replace_initial_variable_constraints<C: IntoIterator<Item = BooleanVarConstraint>>( &mut self, constraints: C, )
Source§impl ThresholdAutomaton for GeneralThresholdAutomaton
impl ThresholdAutomaton for GeneralThresholdAutomaton
Source§fn can_be_initial_location(&self, loc: &Location) -> bool
fn can_be_initial_location(&self, loc: &Location) -> bool
Check if the given location has an initial condition that prevents it from initially having any processes in it
§Implementation
Many threshold automata have initial constraints of the form
loc1 == 0, preventing any processes from starting in loc1 initially.
This function checks if the given location has such a constraint.
It will not attempt to evaluate all initial constraints and check (for example by using an SMT solver) if the location can be initially occupied.
Instead, it will only check if the initial constraints contain a
constraint of the form loc1 == <INTEGER EXPRESSION>, where
<INTEGER EXPRESSION> evaluates to 0.
This approach does not sacrifice correctness, as the initial constraints are anyway encoded in the SMT query.
§Example
use taco_threshold_automaton::expressions::*;
use taco_threshold_automaton::expressions::Location;
use taco_threshold_automaton::general_threshold_automaton::{GeneralThresholdAutomaton, builder::GeneralThresholdAutomatonBuilder};
use taco_threshold_automaton::ThresholdAutomaton;
use taco_threshold_automaton::LocationConstraint;
use std::collections::HashMap;
let ta = GeneralThresholdAutomatonBuilder::new("test_ta1")
.with_locations(vec![
Location::new("loc1"),
Location::new("loc2"),
Location::new("loc3"),
]).unwrap()
.initialize()
.with_initial_location_constraints(vec![
LocationConstraint::ComparisonExpression(
Box::new(IntegerExpression::Atom(Location::new("loc1"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Const(0)),
),
LocationConstraint::ComparisonExpression(
Box::new(IntegerExpression::Atom(Location::new("loc2"))),
ComparisonOp::Geq,
Box::new(IntegerExpression::Const(0)),
) & LocationConstraint::ComparisonExpression(
Box::new(IntegerExpression::Atom(Location::new("loc2"))),
ComparisonOp::Leq,
Box::new(IntegerExpression::Const(0)),
),
]).unwrap()
.build();
assert!(!ta.can_be_initial_location(&Location::new("loc1")));
assert!(!ta.can_be_initial_location(&Location::new("loc2")));
assert!(ta.can_be_initial_location(&Location::new("loc3")));