Crate kefli

Crate kefli 

Source
Expand description

§Kefli - CBAA/CBBA Library for Rust

Kefli is a Rust implementation of the Consensus-Based Auction Algorithm (CBAA) and Consensus-Based Bundle Algorithm (CBBA) for distributed task allocation.

§Modules

  • cbaa - Single-assignment consensus-based auction algorithm
  • cbba - Multi-assignment consensus-based bundle algorithm
  • types - Core types and traits
  • error - Error types and handling
  • config - Configuration structures
  • network - Network communication abstractions

§Quick Start

use kefli::*;

// Define your types
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct Task(u32);

#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
struct Agent(u32);

// Implement cost function
struct SimpleCostFunction;

impl CostFunction<Task, Agent> for SimpleCostFunction {
    fn calculate_cost(&self, _agent: Agent, task: &Task, _context: &AssignmentContext<Task, Agent>) -> f64 {
        100.0 - task.0 as f64
    }
}

// Create and use CBAA
let mut cbaa = CBAA::new(Agent(1), SimpleCostFunction, vec![Task(1), Task(2)], None);
let result = cbaa.auction_phase();

Re-exports§

pub use cbaa::CBAA;
pub use cbba::CBBA;
pub use config::*;
pub use error::*;
pub use network::*;
pub use types::*;

Modules§

cbaa
Consensus-Based Auction Algorithm (CBAA) implementation
cbba
Consensus-Based Bundle Algorithm (CBBA) implementation
config
Configuration structures for auction algorithms
error
Error types for auction operations
network
Network communication abstractions
types
Core types and traits for the auction algorithms