distributed_control/lib.rs
1//! A library for performing and analyzing distributed control
2//!
3//! The primary uses involve creating a Multi-agent System (MAS),
4//! inspecting and analyzing the MAS, and then simulating the MAS
5//! through time.
6//!
7//! The mas module defines the basic MAS structs, types, and traits
8//! with other modules supporting this primary module. However, the
9//! most commonly used functionality is re-exported to the top level
10//! for ease-of-use.
11//!
12//! Examples:
13//! ```
14//! use distributed_control as dc;
15//! use dc::integrator::Integrator;
16//! use ndarray::{array, Array1};
17//!
18//! let lin_dyn = dc::LtiDynamics::new(array![[0.]], array![[1.]]);
19//! let mas = dc::HomMas::new(&lin_dyn, 3);
20//! let initial_states = array![-1., 0., 1.];
21//! let laplacian = array![[1., -1., 0.], [-1., 2., -1.], [0., -1., 1.]];
22//! let u = |_t: f64, x: &Array1<f64>| -laplacian.dot(x);
23//!
24//! let states = dc::EulerIntegration::simulate(
25//! &(0..100).map(|i| i as f64 * 0.1).collect(),
26//! &initial_states,
27//! &mas,
28//! &u,
29//! );
30//! println!("{states}");
31//! println!("{}", states.column(states.ncols() - 1));
32//! ```
33
34pub mod mas;
35pub mod graphs;
36pub mod dynamics;
37pub mod integrator;
38pub mod control_laws;
39pub mod control_theory;
40pub mod lorp;
41pub use mas::*;
42pub use dynamics::LtiDynamics;
43pub use integrator::EulerIntegration;