quantrs2_circuit/scirs2_transpiler_enhanced/
config.rs

1//! Configuration types for enhanced transpiler
2
3use super::hardware::HardwareSpec;
4use super::passes::{ExportFormat, PerformanceConstraints, TranspilationPass};
5use serde::{Deserialize, Serialize};
6
7/// Optimization levels
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9pub enum OptimizationLevel {
10    /// No optimization
11    None,
12    /// Light optimization (fast)
13    Light,
14    /// Medium optimization (balanced)
15    Medium,
16    /// Aggressive optimization (slow but optimal)
17    Aggressive,
18    /// Custom optimization with specific passes
19    Custom,
20}
21
22/// Enhanced transpiler configuration
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct EnhancedTranspilerConfig {
25    /// Target hardware specification
26    pub hardware_spec: HardwareSpec,
27
28    /// Enable ML-based routing optimization
29    pub enable_ml_routing: bool,
30
31    /// Enable hardware-aware gate decomposition
32    pub enable_hw_decomposition: bool,
33
34    /// Enable real-time performance prediction
35    pub enable_performance_prediction: bool,
36
37    /// Enable advanced error mitigation
38    pub enable_error_mitigation: bool,
39
40    /// Enable cross-platform optimization
41    pub enable_cross_platform: bool,
42
43    /// Enable visual circuit representation
44    pub enable_visual_output: bool,
45
46    /// Optimization level (0-3)
47    pub optimization_level: OptimizationLevel,
48
49    /// Custom optimization passes
50    pub custom_passes: Vec<TranspilationPass>,
51
52    /// Performance constraints
53    pub performance_constraints: PerformanceConstraints,
54
55    /// Export formats
56    pub export_formats: Vec<ExportFormat>,
57}
58
59impl Default for EnhancedTranspilerConfig {
60    fn default() -> Self {
61        Self {
62            hardware_spec: HardwareSpec::default(),
63            enable_ml_routing: true,
64            enable_hw_decomposition: true,
65            enable_performance_prediction: true,
66            enable_error_mitigation: true,
67            enable_cross_platform: true,
68            enable_visual_output: true,
69            optimization_level: OptimizationLevel::Aggressive,
70            custom_passes: Vec::new(),
71            performance_constraints: PerformanceConstraints::default(),
72            export_formats: vec![
73                ExportFormat::QASM3,
74                ExportFormat::OpenQASM,
75                ExportFormat::Cirq,
76            ],
77        }
78    }
79}