quantrs2_device/quantum_network/
optimization.rs

1//! Network optimization algorithms and configurations
2
3use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5use std::time::Duration;
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct BandwidthAllocationConfig {
9    pub total_bandwidth: f64,
10    pub priority_based_allocation: bool,
11    pub dynamic_allocation: bool,
12    pub oversubscription_ratio: f64,
13}
14
15impl Default for BandwidthAllocationConfig {
16    fn default() -> Self {
17        Self {
18            total_bandwidth: 1_000_000.0, // 1 Mbps
19            priority_based_allocation: true,
20            dynamic_allocation: true,
21            oversubscription_ratio: 1.5,
22        }
23    }
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct LatencyOptimizationConfig {
28    pub target_latency: Duration,
29    pub route_optimization: bool,
30    pub caching_enabled: bool,
31}
32
33impl Default for LatencyOptimizationConfig {
34    fn default() -> Self {
35        Self {
36            target_latency: Duration::from_millis(10),
37            route_optimization: true,
38            caching_enabled: true,
39        }
40    }
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
44pub struct MultiObjectiveNetworkConfig {
45    pub objective_weights: HashMap<String, f64>,
46}
47
48impl Default for MultiObjectiveNetworkConfig {
49    fn default() -> Self {
50        let mut objective_weights = HashMap::new();
51        objective_weights.insert("latency".to_string(), 0.3);
52        objective_weights.insert("throughput".to_string(), 0.3);
53        objective_weights.insert("fidelity".to_string(), 0.4);
54
55        Self { objective_weights }
56    }
57}