quantrs2_anneal/active_learning_decomposition/
config.rs1use std::time::Duration;
4
5#[derive(Debug, Clone)]
7pub struct ActiveLearningConfig {
8 pub enable_online_learning: bool,
10 pub max_decomposition_depth: usize,
12 pub min_subproblem_size: usize,
14 pub max_subproblem_size: usize,
16 pub learning_rate: f64,
18 pub exploration_rate: f64,
20 pub performance_threshold: f64,
22 pub enable_transfer_learning: bool,
24 pub query_budget: usize,
26 pub overlap_tolerance: f64,
28}
29
30impl Default for ActiveLearningConfig {
31 fn default() -> Self {
32 Self {
33 enable_online_learning: true,
34 max_decomposition_depth: 3,
35 min_subproblem_size: 2,
36 max_subproblem_size: 100,
37 learning_rate: 0.01,
38 exploration_rate: 0.1,
39 performance_threshold: 0.7,
40 enable_transfer_learning: true,
41 query_budget: 100,
42 overlap_tolerance: 0.1,
43 }
44 }
45}
46
47#[derive(Debug, Clone)]
49pub struct MetricComputationConfig {
50 pub enable_expensive_metrics: bool,
52 pub enable_approximation: bool,
54 pub sampling_ratio: f64,
56 pub computation_timeout: Duration,
58}
59
60impl Default for MetricComputationConfig {
61 fn default() -> Self {
62 Self {
63 enable_expensive_metrics: false,
64 enable_approximation: true,
65 sampling_ratio: 0.1,
66 computation_timeout: Duration::from_secs(60),
67 }
68 }
69}
70
71#[derive(Debug, Clone)]
73pub struct SizeConstraints {
74 pub min_size: usize,
76 pub max_size: usize,
78 pub target_size: usize,
80 pub size_tolerance: f64,
82}
83
84impl Default for SizeConstraints {
85 fn default() -> Self {
86 Self {
87 min_size: 2,
88 max_size: 100,
89 target_size: 20,
90 size_tolerance: 0.2,
91 }
92 }
93}
94
95#[derive(Debug, Clone)]
97pub struct ResourceConstraints {
98 pub max_computation_time: Duration,
100 pub max_memory_usage: usize,
102 pub num_processors: usize,
104 pub communication_bandwidth: f64,
106}
107
108impl Default for ResourceConstraints {
109 fn default() -> Self {
110 Self {
111 max_computation_time: Duration::from_secs(300),
112 max_memory_usage: 1024 * 1024 * 1024, num_processors: 4,
114 communication_bandwidth: 1000.0,
115 }
116 }
117}