pub struct AgentSheaf {
pub agents: Vec<AgentBelief>,
pub sheaf: CellularSheaf,
}Expand description
Wraps a group of agents as a cellular sheaf.
Each agent becomes a node, edges are built from a connectivity graph, and restriction maps default to identity (can be customized).
Fields§
§agents: Vec<AgentBelief>The agents and their beliefs.
sheaf: CellularSheafThe underlying cellular sheaf.
Implementations§
Source§impl AgentSheaf
impl AgentSheaf
Sourcepub fn complete(agents: Vec<AgentBelief>) -> Result<Self, SheafError>
pub fn complete(agents: Vec<AgentBelief>) -> Result<Self, SheafError>
Build an agent sheaf where all agents share the same stalk dimension, connected as a complete graph with identity restriction maps.
Sourcepub fn path(agents: Vec<AgentBelief>) -> Result<Self, SheafError>
pub fn path(agents: Vec<AgentBelief>) -> Result<Self, SheafError>
Build an agent sheaf with a path connectivity.
Sourcepub fn with_edges(
agents: Vec<AgentBelief>,
edges: &[(usize, usize)],
) -> Result<Self, SheafError>
pub fn with_edges( agents: Vec<AgentBelief>, edges: &[(usize, usize)], ) -> Result<Self, SheafError>
Build an agent sheaf with custom edges and identity restriction maps.
Sourcepub fn flat_beliefs(&self) -> Vec<f64>
pub fn flat_beliefs(&self) -> Vec<f64>
Flatten all agent beliefs into a single vector.
Sourcepub fn laplacian(&self) -> Result<SheafLaplacian, SheafError>
pub fn laplacian(&self) -> Result<SheafLaplacian, SheafError>
Compute the sheaf Laplacian.
Sourcepub fn coherence(
&self,
max_iter: usize,
tol: f64,
) -> Result<CoherenceMeasure, SheafError>
pub fn coherence( &self, max_iter: usize, tol: f64, ) -> Result<CoherenceMeasure, SheafError>
Measure coherence of current beliefs.
Sourcepub fn global_section(&self, tol: f64) -> Result<GlobalSection, SheafError>
pub fn global_section(&self, tol: f64) -> Result<GlobalSection, SheafError>
Check if current beliefs form a global section.
Trait Implementations§
Source§impl Clone for AgentSheaf
impl Clone for AgentSheaf
Source§fn clone(&self) -> AgentSheaf
fn clone(&self) -> AgentSheaf
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentSheaf
impl Debug for AgentSheaf
Source§impl<'de> Deserialize<'de> for AgentSheaf
impl<'de> Deserialize<'de> for AgentSheaf
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AgentSheaf
impl RefUnwindSafe for AgentSheaf
impl Send for AgentSheaf
impl Sync for AgentSheaf
impl Unpin for AgentSheaf
impl UnsafeUnpin for AgentSheaf
impl UnwindSafe for AgentSheaf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more