mirror of
https://github.com/ellmau/adf-obdd.git
synced 2025-12-20 09:39:38 +01:00
Add missing doc comments to lib
This commit is contained in:
parent
20cd5d3f06
commit
e16ed3a2f6
@ -32,8 +32,11 @@ use self::heuristics::Heuristic;
|
|||||||
///
|
///
|
||||||
/// Please note that due to the nature of the underlying reduced and ordered Bdd the concept of a [`Term`][crate::datatypes::Term] represents one (sub) formula as well as truth-values.
|
/// Please note that due to the nature of the underlying reduced and ordered Bdd the concept of a [`Term`][crate::datatypes::Term] represents one (sub) formula as well as truth-values.
|
||||||
pub struct Adf {
|
pub struct Adf {
|
||||||
|
/// The ordering or the variables in the ADF including a dictionary for the statements
|
||||||
pub ordering: VarContainer,
|
pub ordering: VarContainer,
|
||||||
|
/// The underlying binary decision diagram that respresents the ADF
|
||||||
pub bdd: Bdd,
|
pub bdd: Bdd,
|
||||||
|
/// Acceptance Conditions for the ADF
|
||||||
pub ac: Vec<Term>,
|
pub ac: Vec<Term>,
|
||||||
#[serde(skip, default = "Adf::default_rng")]
|
#[serde(skip, default = "Adf::default_rng")]
|
||||||
rng: RefCell<StdRng>,
|
rng: RefCell<StdRng>,
|
||||||
@ -63,6 +66,7 @@ impl Default for Adf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Adf {
|
impl Adf {
|
||||||
|
/// Instntiates an ADF based on the publically available data
|
||||||
pub fn from_ord_nodes_and_ac(
|
pub fn from_ord_nodes_and_ac(
|
||||||
ordering: VarContainer,
|
ordering: VarContainer,
|
||||||
bdd_nodes: Vec<BddNode>,
|
bdd_nodes: Vec<BddNode>,
|
||||||
|
|||||||
@ -26,6 +26,7 @@ impl Default for VarContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VarContainer {
|
impl VarContainer {
|
||||||
|
/// Create [VarContainer] from its components
|
||||||
pub fn from_parser(
|
pub fn from_parser(
|
||||||
names: Arc<RwLock<Vec<String>>>,
|
names: Arc<RwLock<Vec<String>>>,
|
||||||
mapping: Arc<RwLock<HashMap<String, usize>>>,
|
mapping: Arc<RwLock<HashMap<String, usize>>>,
|
||||||
@ -51,10 +52,12 @@ impl VarContainer {
|
|||||||
.and_then(|name| name.get(var.value()).cloned())
|
.and_then(|name| name.get(var.value()).cloned())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return ordered names from [VarContainer]
|
||||||
pub fn names(&self) -> Arc<RwLock<Vec<String>>> {
|
pub fn names(&self) -> Arc<RwLock<Vec<String>>> {
|
||||||
Arc::clone(&self.names)
|
Arc::clone(&self.names)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return map from names to indices in [VarContainer]
|
||||||
pub fn mappings(&self) -> Arc<RwLock<HashMap<String, usize>>> {
|
pub fn mappings(&self) -> Arc<RwLock<HashMap<String, usize>>> {
|
||||||
Arc::clone(&self.mapping)
|
Arc::clone(&self.mapping)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use std::{cell::RefCell, cmp::min, collections::HashMap, fmt::Display};
|
|||||||
/// Each roBDD is identified by its corresponding [`Term`], which implicitly identifies the root node of a roBDD.
|
/// Each roBDD is identified by its corresponding [`Term`], which implicitly identifies the root node of a roBDD.
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Bdd {
|
pub struct Bdd {
|
||||||
|
/// The nodes of the [Bdd] with their edges
|
||||||
pub nodes: Vec<BddNode>,
|
pub nodes: Vec<BddNode>,
|
||||||
#[cfg(feature = "variablelist")]
|
#[cfg(feature = "variablelist")]
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
@ -100,6 +101,7 @@ impl Bdd {
|
|||||||
RefCell::new(HashMap::new())
|
RefCell::new(HashMap::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Construct [Bdd] from a list of nodes by adding one after the other
|
||||||
pub fn from_nodes(nodes: Vec<BddNode>) -> Self {
|
pub fn from_nodes(nodes: Vec<BddNode>) -> Self {
|
||||||
let mut bdd = Self::new();
|
let mut bdd = Self::new();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user