quantrs2_device/mapping_scirs2/
types.rs

1//! Type definitions for SciRS2 mapping
2
3use super::*;
4
5/// Initial mapping algorithms
6#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7pub enum InitialMappingAlgorithm {
8    /// Spectral embedding for optimal initial placement
9    SpectralEmbedding,
10    /// Community detection based mapping
11    CommunityBased,
12    /// Centrality-weighted assignment
13    CentralityWeighted,
14    /// Minimum spanning tree based
15    MSTreeBased,
16    /// PageRank weighted assignment
17    PageRankWeighted,
18    /// Bipartite matching for optimal assignment
19    BipartiteMatching,
20    /// Multi-level graph partitioning
21    MultilevelPartitioning,
22}
23
24/// SciRS2 routing algorithms
25#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
26pub enum SciRS2RoutingAlgorithm {
27    /// Enhanced A* with graph metrics
28    AStarEnhanced,
29    /// Community-aware routing
30    CommunityAware,
31    /// Spectral-based shortest paths
32    SpectralRouting,
33    /// Centrality-guided routing
34    CentralityGuided,
35    /// Multi-path routing with load balancing
36    MultiPath,
37    /// Adaptive routing based on real-time metrics
38    AdaptiveRouting,
39}
40
41/// Optimization objectives
42#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
43pub enum OptimizationObjective {
44    /// Minimize number of SWAP operations
45    MinimizeSwaps,
46    /// Minimize circuit depth
47    MinimizeDepth,
48    /// Maximize gate fidelity
49    MaximizeFidelity,
50    /// Minimize execution time
51    MinimizeTime,
52    /// Hybrid objective combining multiple factors
53    HybridObjective,
54    /// Custom objective function
55    CustomObjective,
56}
57
58/// Community detection methods
59#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
60pub enum CommunityMethod {
61    /// Louvain community detection
62    Louvain,
63    /// Leiden algorithm
64    Leiden,
65    /// Label propagation
66    LabelPropagation,
67    /// Spectral clustering
68    SpectralClustering,
69    /// Walktrap algorithm
70    Walktrap,
71}
72
73/// ML model types for mapping
74#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
75pub enum MLModelType {
76    GraphNeuralNetwork { hidden_dims: Vec<usize> },
77    GraphConvolutionalNetwork { layers: usize },
78    GraphAttentionNetwork { heads: usize },
79    DeepQLearning { experience_buffer_size: usize },
80    PolicyGradient { actor_critic: bool },
81    TreeSearch { simulation_count: usize },
82    EnsembleMethod { base_models: Vec<String> },
83}
84
85/// Feature selection methods
86#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
87pub enum FeatureSelectionMethod {
88    VarianceThreshold { threshold: f64 },
89    UnivariateSelection { k_best: usize },
90    RecursiveElimination { step_size: usize },
91    LassoRegularization { alpha: f64 },
92    MutualInformation { bins: usize },
93    PrincipalComponentAnalysis { n_components: usize },
94}
95
96/// Analysis depth levels
97#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
98pub enum AnalysisDepth {
99    Basic,
100    Standard,
101    Comprehensive,
102    Expert,
103}
104
105/// Tracking metrics
106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
107pub enum TrackingMetric {
108    ExecutionTime,
109    MemoryUsage,
110    MappingQuality,
111    SwapCount,
112    FidelityLoss,
113    CommunicationOverhead,
114    ResourceUtilization,
115    ConvergenceRate,
116}
117
118/// Anomaly detection methods
119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120pub enum AnomalyDetectionMethod {
121    IsolationForest,
122    OneClassSVM,
123    LocalOutlierFactor,
124    EllipticEnvelope,
125    StatisticalThreshold,
126}
127
128/// Notification methods
129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
130pub enum NotificationMethod {
131    Log,
132    Email,
133    Webhook,
134    MQTT,
135    Console,
136}
137
138/// Report formats
139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
140pub enum ReportFormat {
141    JSON,
142    XML,
143    CSV,
144    HTML,
145    PDF,
146}
147
148/// Selection methods for multi-objective optimization
149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
150pub enum SelectionMethod {
151    Tournament { size: usize },
152    Roulette,
153    Rank,
154    Random,
155}
156
157/// Scalarization methods
158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
159pub enum ScalarizationMethod {
160    WeightedSum { weights: Vec<f64> },
161    Tchebycheff { reference_point: Vec<f64> },
162    AugmentedTchebycheff { weights: Vec<f64>, rho: f64 },
163    WeightedMetric { p: f64, weights: Vec<f64> },
164}
165
166/// Constraint types
167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
168pub enum ConstraintType {
169    ConnectivityConstraint,
170    TimingConstraint,
171    ResourceConstraint,
172    FidelityConstraint,
173    PowerConstraint,
174}
175
176/// Penalty methods
177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
178pub enum PenaltyMethod {
179    QuadraticPenalty { coefficient: f64 },
180    ExponentialPenalty { base: f64 },
181    AdaptivePenalty { initial_penalty: f64 },
182    BarrierMethod { barrier_parameter: f64 },
183}
184
185/// Search strategies
186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
187pub enum SearchStrategy {
188    GeneticAlgorithm,
189    SimulatedAnnealing,
190    ParticleSwarm,
191    DifferentialEvolution,
192    HybridSearch,
193    TabuSearch,
194}
195
196/// Load balancing strategies
197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
198pub enum LoadBalancingStrategy {
199    Static,
200    Dynamic,
201    WorkStealing,
202    RoundRobin,
203}
204
205/// Synchronization methods
206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
207pub enum SynchronizationMethod {
208    Synchronous,
209    Asynchronous,
210    BulkSynchronous,
211    EventDriven,
212}
213
214/// Domain adaptation methods
215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
216pub enum DomainAdaptationMethod {
217    FineTuning,
218    FeatureAlignment,
219    AdversarialTraining,
220    DomainAdversarialNeuralNetwork,
221    GradientReversal,
222}
223
224/// Calibration methods for prediction confidence
225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
226pub enum CalibrationMethod {
227    PlattScaling,
228    IsotonicRegression,
229    TemperatureScaling,
230    BetaCalibration,
231    HistogramBinning,
232}
233
234/// Suggestion priority levels
235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
236pub enum SuggestionPriority {
237    High,
238    Medium,
239    Low,
240}
241
242/// Trend direction
243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
244pub enum TrendDirection {
245    Increasing,
246    Decreasing,
247    Stable,
248    Oscillating,
249}
250
251/// Quality metric types
252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
253pub enum QualityMetricType {
254    Accuracy,
255    Precision,
256    Recall,
257    F1Score,
258    AUC,
259    MeanAbsoluteError,
260    RootMeanSquareError,
261    R2Score,
262}
263
264/// Result analysis types
265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
266pub enum ResultAnalysisType {
267    Statistical,
268    Temporal,
269    Comparative,
270    Predictive,
271    Causal,
272}
273
274/// Optimization phases
275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
276pub enum OptimizationPhase {
277    Initialization,
278    Exploration,
279    Exploitation,
280    Convergence,
281    PostProcessing,
282}
283
284/// Risk assessment levels
285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
286pub enum RiskLevel {
287    Low,
288    Medium,
289    High,
290    Critical,
291}
292
293/// Performance categories
294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
295pub enum PerformanceCategory {
296    Excellent,
297    Good,
298    Average,
299    Poor,
300    Critical,
301}
302
303/// Resource utilization states
304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
305pub enum ResourceState {
306    Underutilized,
307    Optimal,
308    Overutilized,
309    Saturated,
310    Unavailable,
311}
312
313/// Learning phases
314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
315pub enum LearningPhase {
316    Initialization,
317    Training,
318    Validation,
319    Testing,
320    Deployment,
321}
322
323/// Adaptation triggers
324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
325pub enum AdaptationTrigger {
326    PerformanceDegradation,
327    EnvironmentChange,
328    ResourceConstraints,
329    QualityThreshold,
330    TimeInterval,
331    ManualTrigger,
332}