quantrs2_circuit/profiler/
collectors.rs

1//! Profiling collectors for gates, memory, and resources
2//!
3//! This module provides specialized profilers for different aspects of
4//! quantum circuit execution including gate-level profiling, memory profiling,
5//! and resource utilization profiling.
6
7use quantrs2_core::qubit::QubitId;
8use scirs2_core::ndarray::{Array1, Array2};
9use scirs2_core::Complex64;
10use serde::{Deserialize, Serialize};
11use std::collections::{HashMap, HashSet, VecDeque};
12use std::sync::{Arc, Mutex};
13use std::time::{Duration, Instant, SystemTime};
14
15// Import types from sibling modules
16use super::metrics::*;
17
18pub struct GateProfiler {
19    /// Gate execution profiles
20    pub gate_profiles: HashMap<String, GateProfile>,
21    /// Gate timing statistics
22    pub timing_stats: HashMap<String, TimingStatistics>,
23    /// Gate resource usage
24    pub resource_usage: HashMap<String, ResourceUsage>,
25    /// Gate error analysis
26    pub error_analysis: HashMap<String, ErrorAnalysis>,
27}
28
29/// Individual gate performance profile
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct GateProfile {
32    /// Gate name
33    pub gate_name: String,
34    /// Average execution time
35    pub avg_execution_time: Duration,
36    /// Execution time variance
37    pub execution_variance: f64,
38    /// Memory usage pattern
39    pub memory_pattern: MemoryPattern,
40    /// Resource utilization
41    pub resource_utilization: f64,
42    /// Error characteristics
43    pub error_characteristics: ErrorCharacteristics,
44    /// Optimization potential
45    pub optimization_potential: f64,
46    /// Performance ranking
47    pub performance_rank: u32,
48}
49
50/// Memory usage pattern
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct MemoryPattern {
53    /// Peak memory usage
54    pub peak_usage: usize,
55    /// Average memory usage
56    pub average_usage: f64,
57    /// Memory allocation pattern
58    pub allocation_pattern: AllocationPattern,
59    /// Memory access pattern
60    pub access_pattern: AccessPattern,
61    /// Cache efficiency
62    pub cache_efficiency: f64,
63}
64
65/// Memory allocation patterns
66#[derive(Debug, Clone, Serialize, Deserialize)]
67pub enum AllocationPattern {
68    /// Constant allocation
69    Constant,
70    /// Linear growth
71    Linear,
72    /// Exponential growth
73    Exponential,
74    /// Periodic allocation
75    Periodic,
76    /// Irregular allocation
77    Irregular,
78}
79
80/// Memory access patterns
81#[derive(Debug, Clone, Serialize, Deserialize)]
82pub enum AccessPattern {
83    /// Sequential access
84    Sequential,
85    /// Random access
86    Random,
87    /// Stride access
88    Stride { stride: usize },
89    /// Cached access
90    Cached,
91    /// Mixed access
92    Mixed,
93}
94
95/// Error characteristics for gates
96#[derive(Debug, Clone, Serialize, Deserialize)]
97pub struct ErrorCharacteristics {
98    /// Error rate
99    pub error_rate: f64,
100    /// Error distribution
101    pub error_distribution: ErrorDistribution,
102    /// Error correlation
103    pub error_correlation: f64,
104    /// Error propagation factor
105    pub propagation_factor: f64,
106    /// Mitigation effectiveness
107    pub mitigation_effectiveness: f64,
108}
109
110/// Error distribution types
111#[derive(Debug, Clone, Serialize, Deserialize)]
112pub enum ErrorDistribution {
113    /// Normal distribution
114    Normal { mean: f64, std_dev: f64 },
115    /// Exponential distribution
116    Exponential { lambda: f64 },
117    /// Uniform distribution
118    Uniform { min: f64, max: f64 },
119    /// Custom distribution
120    Custom { parameters: HashMap<String, f64> },
121}
122
123/// Timing statistics for gates
124#[derive(Debug, Clone, Serialize, Deserialize)]
125pub struct TimingStatistics {
126    /// Minimum execution time
127    pub min_time: Duration,
128    /// Maximum execution time
129    pub max_time: Duration,
130    /// Average execution time
131    pub avg_time: Duration,
132    /// Median execution time
133    pub median_time: Duration,
134    /// Standard deviation
135    pub std_deviation: Duration,
136    /// Percentile distribution
137    pub percentiles: HashMap<u8, Duration>,
138}
139
140/// Resource usage statistics
141#[derive(Debug, Clone, Serialize, Deserialize)]
142pub struct ResourceUsage {
143    /// CPU utilization
144    pub cpu_utilization: f64,
145    /// Memory utilization
146    pub memory_utilization: f64,
147    /// GPU utilization (if applicable)
148    pub gpu_utilization: Option<f64>,
149    /// I/O utilization
150    pub io_utilization: f64,
151    /// Network utilization
152    pub network_utilization: f64,
153    /// Custom resource metrics
154    pub custom_resources: HashMap<String, f64>,
155}
156
157/// Error analysis for gates
158#[derive(Debug, Clone, Serialize, Deserialize)]
159pub struct ErrorAnalysis {
160    /// Error frequency
161    pub error_frequency: f64,
162    /// Error severity distribution
163    pub severity_distribution: HashMap<ErrorSeverity, usize>,
164    /// Common error patterns
165    pub error_patterns: Vec<ErrorPattern>,
166    /// Error recovery statistics
167    pub recovery_stats: RecoveryStatistics,
168}
169
170/// Error severity levels
171#[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize, Deserialize)]
172pub enum ErrorSeverity {
173    /// Low severity error
174    Low,
175    /// Medium severity error
176    Medium,
177    /// High severity error
178    High,
179    /// Critical severity error
180    Critical,
181}
182
183/// Error pattern identification
184#[derive(Debug, Clone, Serialize, Deserialize)]
185pub struct ErrorPattern {
186    /// Pattern description
187    pub description: String,
188    /// Pattern frequency
189    pub frequency: f64,
190    /// Pattern confidence
191    pub confidence: f64,
192    /// Associated gates
193    pub associated_gates: Vec<String>,
194}
195
196/// Error recovery statistics
197#[derive(Debug, Clone, Serialize, Deserialize)]
198pub struct RecoveryStatistics {
199    /// Recovery success rate
200    pub success_rate: f64,
201    /// Average recovery time
202    pub avg_recovery_time: Duration,
203    /// Recovery strategies used
204    pub recovery_strategies: HashMap<String, usize>,
205}
206
207/// Memory profiler for quantum circuits
208#[derive(Debug, Clone)]
209pub struct MemoryProfiler {
210    /// Memory usage snapshots
211    pub snapshots: VecDeque<MemorySnapshot>,
212    /// Memory leak detection
213    pub leak_detector: LeakDetector,
214    /// Memory optimization suggestions
215    pub optimization_suggestions: Vec<MemoryOptimization>,
216    /// Memory allocation tracking
217    pub allocation_tracker: AllocationTracker,
218}
219
220/// Memory usage snapshot
221#[derive(Debug, Clone, Serialize, Deserialize)]
222pub struct MemorySnapshot {
223    /// Snapshot timestamp
224    pub timestamp: SystemTime,
225    /// Total memory usage
226    pub total_usage: usize,
227    /// Memory breakdown by category
228    pub breakdown: HashMap<String, usize>,
229    /// Peak memory usage
230    pub peak_usage: usize,
231    /// Memory efficiency score
232    pub efficiency_score: f64,
233    /// Fragmentation level
234    pub fragmentation_level: f64,
235}
236
237/// Memory leak detection system
238#[derive(Debug, Clone)]
239pub struct LeakDetector {
240    /// Detected leaks
241    pub detected_leaks: Vec<MemoryLeak>,
242    /// Leak detection threshold
243    pub detection_threshold: f64,
244    /// Leak analysis results
245    pub analysis_results: LeakAnalysisResults,
246}
247
248/// Memory leak information
249#[derive(Debug, Clone, Serialize, Deserialize)]
250pub struct MemoryLeak {
251    /// Leak location
252    pub location: String,
253    /// Leak size
254    pub size: usize,
255    /// Leak growth rate
256    pub growth_rate: f64,
257    /// Leak confidence
258    pub confidence: f64,
259    /// Suggested fixes
260    pub suggested_fixes: Vec<String>,
261}
262
263/// Leak analysis results
264#[derive(Debug, Clone, Serialize, Deserialize)]
265pub struct LeakAnalysisResults {
266    /// Total leaked memory
267    pub total_leaked: usize,
268    /// Leak sources
269    pub leak_sources: HashMap<String, usize>,
270    /// Leak severity assessment
271    pub severity_assessment: LeakSeverity,
272    /// Performance impact
273    pub performance_impact: f64,
274}
275
276/// Leak severity levels
277#[derive(Debug, Clone, Serialize, Deserialize)]
278pub enum LeakSeverity {
279    /// Minor leak
280    Minor,
281    /// Moderate leak
282    Moderate,
283    /// Major leak
284    Major,
285    /// Critical leak
286    Critical,
287}
288
289/// Memory optimization suggestion
290#[derive(Debug, Clone, Serialize, Deserialize)]
291pub struct MemoryOptimization {
292    /// Optimization type
293    pub optimization_type: MemoryOptimizationType,
294    /// Expected improvement
295    pub expected_improvement: f64,
296    /// Implementation difficulty
297    pub implementation_difficulty: OptimizationDifficulty,
298    /// Description
299    pub description: String,
300    /// Implementation steps
301    pub implementation_steps: Vec<String>,
302}
303
304/// Types of memory optimizations
305#[derive(Debug, Clone, Serialize, Deserialize)]
306pub enum MemoryOptimizationType {
307    /// Memory pool optimization
308    PoolOptimization,
309    /// Cache optimization
310    CacheOptimization,
311    /// Allocation strategy optimization
312    AllocationOptimization,
313    /// Memory compression
314    Compression,
315    /// Memory layout optimization
316    LayoutOptimization,
317}
318
319/// Implementation difficulty levels
320#[derive(Debug, Clone, Serialize, Deserialize)]
321pub enum OptimizationDifficulty {
322    /// Easy to implement
323    Easy,
324    /// Medium difficulty
325    Medium,
326    /// Hard to implement
327    Hard,
328    /// Very hard to implement
329    VeryHard,
330}
331
332/// Memory allocation tracking
333#[derive(Debug, Clone)]
334pub struct AllocationTracker {
335    /// Active allocations
336    pub active_allocations: HashMap<usize, AllocationInfo>,
337    /// Allocation history
338    pub allocation_history: VecDeque<AllocationEvent>,
339    /// Allocation statistics
340    pub allocation_stats: AllocationStatistics,
341}
342
343/// Individual allocation information
344#[derive(Debug, Clone, Serialize, Deserialize)]
345pub struct AllocationInfo {
346    /// Allocation size
347    pub size: usize,
348    /// Allocation timestamp
349    pub timestamp: SystemTime,
350    /// Allocation source
351    pub source: String,
352    /// Allocation type
353    pub allocation_type: AllocationType,
354}
355
356/// Types of memory allocations
357#[derive(Debug, Clone, Serialize, Deserialize)]
358pub enum AllocationType {
359    /// State vector allocation
360    StateVector,
361    /// Gate matrix allocation
362    GateMatrix,
363    /// Temporary buffer allocation
364    TempBuffer,
365    /// Cache allocation
366    Cache,
367    /// Workspace allocation
368    Workspace,
369}
370
371/// Memory allocation event
372#[derive(Debug, Clone, Serialize, Deserialize)]
373pub struct AllocationEvent {
374    /// Event type
375    pub event_type: AllocationEventType,
376    /// Event timestamp
377    pub timestamp: SystemTime,
378    /// Allocation size
379    pub size: usize,
380    /// Source location
381    pub source: String,
382}
383
384/// Types of allocation events
385#[derive(Debug, Clone, Serialize, Deserialize)]
386pub enum AllocationEventType {
387    /// Memory allocated
388    Allocated,
389    /// Memory deallocated
390    Deallocated,
391    /// Memory reallocated
392    Reallocated,
393    /// Memory moved
394    Moved,
395}
396
397/// Allocation statistics
398#[derive(Debug, Clone, Serialize, Deserialize)]
399pub struct AllocationStatistics {
400    /// Total allocations
401    pub total_allocations: usize,
402    /// Total deallocations
403    pub total_deallocations: usize,
404    /// Peak concurrent allocations
405    pub peak_concurrent: usize,
406    /// Average allocation size
407    pub avg_allocation_size: f64,
408    /// Allocation efficiency
409    pub allocation_efficiency: f64,
410}
411
412/// Resource profiler for quantum circuits
413#[derive(Debug, Clone)]
414pub struct ResourceProfiler {
415    /// CPU profiling data
416    pub cpu_profiling: CpuProfilingData,
417    /// GPU profiling data (if applicable)
418    pub gpu_profiling: Option<GpuProfilingData>,
419    /// I/O profiling data
420    pub io_profiling: IoProfilingData,
421    /// Network profiling data
422    pub network_profiling: NetworkProfilingData,
423    /// Resource bottleneck analysis
424    pub bottleneck_analysis: BottleneckAnalysis,
425}
426
427/// CPU profiling data
428#[derive(Debug, Clone, Serialize, Deserialize)]
429pub struct CpuProfilingData {
430    /// CPU utilization over time
431    pub utilization_history: VecDeque<f64>,
432    /// CPU core usage distribution
433    pub core_usage: HashMap<u32, f64>,
434    /// Cache miss rates
435    pub cache_miss_rates: CacheMissRates,
436    /// Instruction throughput
437    pub instruction_throughput: f64,
438    /// CPU-specific optimizations
439    pub optimization_opportunities: Vec<CpuOptimization>,
440}
441
442/// Cache miss rate statistics
443#[derive(Debug, Clone, Serialize, Deserialize)]
444pub struct CacheMissRates {
445    /// L1 cache miss rate
446    pub l1_miss_rate: f64,
447    /// L2 cache miss rate
448    pub l2_miss_rate: f64,
449    /// L3 cache miss rate
450    pub l3_miss_rate: f64,
451    /// TLB miss rate
452    pub tlb_miss_rate: f64,
453}
454
455/// CPU optimization opportunities
456#[derive(Debug, Clone, Serialize, Deserialize)]
457pub struct CpuOptimization {
458    /// Optimization type
459    pub optimization_type: CpuOptimizationType,
460    /// Potential speedup
461    pub potential_speedup: f64,
462    /// Implementation complexity
463    pub complexity: OptimizationDifficulty,
464    /// Description
465    pub description: String,
466}
467
468/// Types of CPU optimizations
469#[derive(Debug, Clone, Serialize, Deserialize)]
470pub enum CpuOptimizationType {
471    /// Vectorization optimization
472    Vectorization,
473    /// Cache optimization
474    CacheOptimization,
475    /// Branch prediction optimization
476    BranchPrediction,
477    /// Instruction reordering
478    InstructionReordering,
479    /// Parallelization
480    Parallelization,
481}
482
483/// GPU profiling data
484#[derive(Debug, Clone, Serialize, Deserialize)]
485pub struct GpuProfilingData {
486    /// GPU utilization
487    pub gpu_utilization: f64,
488    /// Memory utilization
489    pub memory_utilization: f64,
490    /// Kernel execution times
491    pub kernel_times: HashMap<String, Duration>,
492    /// Memory transfer times
493    pub transfer_times: MemoryTransferTimes,
494    /// GPU-specific optimizations
495    pub optimization_opportunities: Vec<GpuOptimization>,
496}
497
498/// Memory transfer timing data
499#[derive(Debug, Clone, Serialize, Deserialize)]
500pub struct MemoryTransferTimes {
501    /// Host to device transfer time
502    pub host_to_device: Duration,
503    /// Device to host transfer time
504    pub device_to_host: Duration,
505    /// Device to device transfer time
506    pub device_to_device: Duration,
507}
508
509/// GPU optimization opportunities
510#[derive(Debug, Clone, Serialize, Deserialize)]
511pub struct GpuOptimization {
512    /// Optimization type
513    pub optimization_type: GpuOptimizationType,
514    /// Potential speedup
515    pub potential_speedup: f64,
516    /// Implementation complexity
517    pub complexity: OptimizationDifficulty,
518    /// Description
519    pub description: String,
520}
521
522/// Types of GPU optimizations
523#[derive(Debug, Clone, Serialize, Deserialize)]
524pub enum GpuOptimizationType {
525    /// Memory coalescing
526    MemoryCoalescing,
527    /// Occupancy optimization
528    OccupancyOptimization,
529    /// Shared memory optimization
530    SharedMemoryOptimization,
531    /// Kernel fusion
532    KernelFusion,
533    /// Memory hierarchy optimization
534    MemoryHierarchyOptimization,
535}
536
537/// I/O profiling data
538#[derive(Debug, Clone, Serialize, Deserialize)]
539pub struct IoProfilingData {
540    /// Read throughput
541    pub read_throughput: f64,
542    /// Write throughput
543    pub write_throughput: f64,
544    /// I/O latency distribution
545    pub latency_distribution: LatencyDistribution,
546    /// I/O queue depth
547    pub queue_depth: f64,
548    /// I/O optimization opportunities
549    pub optimization_opportunities: Vec<IoOptimization>,
550}
551
552/// Latency distribution statistics
553#[derive(Debug, Clone, Serialize, Deserialize)]
554pub struct LatencyDistribution {
555    /// Minimum latency
556    pub min_latency: Duration,
557    /// Maximum latency
558    pub max_latency: Duration,
559    /// Average latency
560    pub avg_latency: Duration,
561    /// Latency percentiles
562    pub percentiles: HashMap<u8, Duration>,
563}
564
565/// I/O optimization opportunities
566#[derive(Debug, Clone, Serialize, Deserialize)]
567pub struct IoOptimization {
568    /// Optimization type
569    pub optimization_type: IoOptimizationType,
570    /// Potential improvement
571    pub potential_improvement: f64,
572    /// Implementation complexity
573    pub complexity: OptimizationDifficulty,
574    /// Description
575    pub description: String,
576}
577
578/// Types of I/O optimizations
579#[derive(Debug, Clone, Serialize, Deserialize)]
580pub enum IoOptimizationType {
581    /// Buffer size optimization
582    BufferSizeOptimization,
583    /// Prefetching optimization
584    PrefetchingOptimization,
585    /// Batching optimization
586    BatchingOptimization,
587    /// Compression optimization
588    CompressionOptimization,
589    /// Caching optimization
590    CachingOptimization,
591}
592
593/// Network profiling data
594#[derive(Debug, Clone, Serialize, Deserialize)]
595pub struct NetworkProfilingData {
596    /// Network bandwidth utilization
597    pub bandwidth_utilization: f64,
598    /// Network latency
599    pub network_latency: Duration,
600    /// Packet loss rate
601    pub packet_loss_rate: f64,
602    /// Connection statistics
603    pub connection_stats: ConnectionStatistics,
604    /// Network optimization opportunities
605    pub optimization_opportunities: Vec<NetworkOptimization>,
606}
607
608/// Network connection statistics
609#[derive(Debug, Clone, Serialize, Deserialize)]
610pub struct ConnectionStatistics {
611    /// Active connections
612    pub active_connections: usize,
613    /// Connection establishment time
614    pub connection_time: Duration,
615    /// Connection reliability
616    pub reliability: f64,
617    /// Throughput statistics
618    pub throughput_stats: ThroughputStatistics,
619}
620
621/// Throughput statistics
622#[derive(Debug, Clone, Serialize, Deserialize)]
623pub struct ThroughputStatistics {
624    /// Average throughput
625    pub avg_throughput: f64,
626    /// Peak throughput
627    pub peak_throughput: f64,
628    /// Throughput variance
629    pub throughput_variance: f64,
630}
631
632/// Network optimization opportunities
633#[derive(Debug, Clone, Serialize, Deserialize)]
634pub struct NetworkOptimization {
635    /// Optimization type
636    pub optimization_type: NetworkOptimizationType,
637    /// Potential improvement
638    pub potential_improvement: f64,
639    /// Implementation complexity
640    pub complexity: OptimizationDifficulty,
641    /// Description
642    pub description: String,
643}
644
645/// Types of network optimizations
646#[derive(Debug, Clone, Serialize, Deserialize)]
647pub enum NetworkOptimizationType {
648    /// Protocol optimization
649    ProtocolOptimization,
650    /// Connection pooling
651    ConnectionPooling,
652    /// Data compression
653    DataCompression,
654    /// Request batching
655    RequestBatching,
656    /// Load balancing
657    LoadBalancing,
658}
659
660/// Resource bottleneck analysis
661#[derive(Debug, Clone, Serialize, Deserialize)]
662pub struct BottleneckAnalysis {
663    /// Identified bottlenecks
664    pub bottlenecks: Vec<ResourceBottleneck>,
665    /// Bottleneck severity ranking
666    pub severity_ranking: Vec<BottleneckSeverity>,
667    /// Impact analysis
668    pub impact_analysis: BottleneckImpactAnalysis,
669    /// Mitigation strategies
670    pub mitigation_strategies: Vec<MitigationStrategy>,
671}
672
673/// Resource bottleneck information
674#[derive(Debug, Clone, Serialize, Deserialize)]
675pub struct ResourceBottleneck {
676    /// Bottleneck type
677    pub bottleneck_type: ResourceBottleneckType,
678    /// Severity score
679    pub severity: f64,
680    /// Impact on performance
681    pub performance_impact: f64,
682    /// Affected operations
683    pub affected_operations: Vec<String>,
684    /// Recommended actions
685    pub recommended_actions: Vec<String>,
686}
687
688/// Types of resource bottlenecks
689#[derive(Debug, Clone, Serialize, Deserialize)]
690pub enum ResourceBottleneckType {
691    /// CPU bottleneck
692    Cpu,
693    /// Memory bottleneck
694    Memory,
695    /// GPU bottleneck
696    Gpu,
697    /// I/O bottleneck
698    Io,
699    /// Network bottleneck
700    Network,
701    /// Mixed bottleneck
702    Mixed { types: Vec<String> },
703}
704
705/// Bottleneck severity levels
706#[derive(Debug, Clone, Serialize, Deserialize)]
707pub struct BottleneckSeverity {
708    /// Bottleneck identifier
709    pub bottleneck_id: String,
710    /// Severity level
711    pub severity: SeverityLevel,
712    /// Confidence score
713    pub confidence: f64,
714}
715
716/// Severity levels for bottlenecks
717#[derive(Debug, Clone, Serialize, Deserialize)]
718pub enum SeverityLevel {
719    /// Low severity
720    Low,
721    /// Medium severity
722    Medium,
723    /// High severity
724    High,
725    /// Critical severity
726    Critical,
727}
728
729/// Bottleneck impact analysis
730#[derive(Debug, Clone, Serialize, Deserialize)]
731pub struct BottleneckImpactAnalysis {
732    /// Overall performance impact
733    pub overall_impact: f64,
734    /// Impact on specific metrics
735    pub metric_impacts: HashMap<String, f64>,
736    /// Cascading effects
737    pub cascading_effects: Vec<CascadingEffect>,
738    /// Cost-benefit analysis
739    pub cost_benefit: CostBenefitAnalysis,
740}
741
742/// Cascading effect from bottlenecks
743#[derive(Debug, Clone, Serialize, Deserialize)]
744pub struct CascadingEffect {
745    /// Effect description
746    pub description: String,
747    /// Effect magnitude
748    pub magnitude: f64,
749    /// Affected components
750    pub affected_components: Vec<String>,
751}
752
753/// Cost-benefit analysis for optimizations
754#[derive(Debug, Clone, Serialize, Deserialize)]
755pub struct CostBenefitAnalysis {
756    /// Implementation cost estimate
757    pub implementation_cost: f64,
758    /// Expected benefit
759    pub expected_benefit: f64,
760    /// ROI estimate
761    pub roi_estimate: f64,
762    /// Risk assessment
763    pub risk_assessment: f64,
764}
765
766/// Mitigation strategy for bottlenecks
767#[derive(Debug, Clone, Serialize, Deserialize)]
768pub struct MitigationStrategy {
769    /// Strategy name
770    pub name: String,
771    /// Strategy type
772    pub strategy_type: MitigationStrategyType,
773    /// Expected effectiveness
774    pub effectiveness: f64,
775    /// Implementation timeline
776    pub timeline: Duration,
777    /// Resource requirements
778    pub resource_requirements: ResourceRequirements,
779}
780
781/// Types of mitigation strategies
782#[derive(Debug, Clone, Serialize, Deserialize)]
783pub enum MitigationStrategyType {
784    /// Hardware upgrade
785    HardwareUpgrade,
786    /// Software optimization
787    SoftwareOptimization,
788    /// Algorithm improvement
789    AlgorithmImprovement,
790    /// Resource reallocation
791    ResourceReallocation,
792    /// Workload distribution
793    WorkloadDistribution,
794}
795
796/// Resource requirements for strategies
797#[derive(Debug, Clone, Serialize, Deserialize)]
798pub struct ResourceRequirements {
799    /// CPU requirements
800    pub cpu_requirements: f64,
801    /// Memory requirements
802    pub memory_requirements: usize,
803    /// Storage requirements
804    pub storage_requirements: usize,
805    /// Network requirements
806    pub network_requirements: f64,
807    /// Human resources
808    pub human_resources: usize,
809}