pub struct Captain {
pub id: String,
pub roster: Vec<AgentInfo>,
pub decision_engine: DecisionEngine,
pub delegator: Delegator,
pub situation_room: SituationRoom,
pub succession: SuccessionPlan,
}Expand description
Leads a group of agents with ternary decision making.
The captain maintains a roster, makes decisions, delegates tasks, and maintains a succession plan.
Fields§
§id: String§roster: Vec<AgentInfo>§decision_engine: DecisionEngine§delegator: Delegator§situation_room: SituationRoom§succession: SuccessionPlanImplementations§
Source§impl Captain
impl Captain
pub fn new(id: &str, quorum: usize) -> Self
Sourcepub fn command(&self) -> Option<Ternary>
pub fn command(&self) -> Option<Ternary>
Collect votes from all available agents and make a decision.
Sourcepub fn decide_from_votes(&self, votes: &[Ternary]) -> Option<Ternary>
pub fn decide_from_votes(&self, votes: &[Ternary]) -> Option<Ternary>
Make a decision from explicit votes.
Sourcepub fn delegate(&mut self, task_id: &str, task_type: &str) -> Option<String>
pub fn delegate(&mut self, task_id: &str, task_type: &str) -> Option<String>
Delegate a task to the best-fit agent.
Sourcepub fn receive_report(&mut self, agent_id: &str, value: Ternary)
pub fn receive_report(&mut self, agent_id: &str, value: Ternary)
Update the situation room with a report.
Sourcepub fn fleet_health(&self) -> f64
pub fn fleet_health(&self) -> f64
Fleet health based on current roster.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Captain
impl RefUnwindSafe for Captain
impl Send for Captain
impl Sync for Captain
impl Unpin for Captain
impl UnsafeUnpin for Captain
impl UnwindSafe for Captain
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