quantrs2_tytan/testing_framework/
config.rs

1//! Configuration types for the testing framework.
2//!
3//! This module defines configuration structures for tests, samplers,
4//! validation, and output settings.
5
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8use std::time::Duration;
9
10/// Main test configuration
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct TestConfig {
13    /// Random seed
14    pub seed: Option<u64>,
15    /// Number of test cases per category
16    pub cases_per_category: usize,
17    /// Problem sizes to test
18    pub problem_sizes: Vec<usize>,
19    /// Samplers to test
20    pub samplers: Vec<SamplerConfig>,
21    /// Timeout per test
22    pub timeout: Duration,
23    /// Validation settings
24    pub validation: ValidationConfig,
25    /// Output settings
26    pub output: OutputConfig,
27}
28
29/// Sampler configuration
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct SamplerConfig {
32    /// Sampler name
33    pub name: String,
34    /// Number of samples
35    pub num_samples: usize,
36    /// Additional parameters
37    pub parameters: HashMap<String, f64>,
38}
39
40/// Validation configuration
41#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct ValidationConfig {
43    /// Check constraint satisfaction
44    pub check_constraints: bool,
45    /// Check objective improvement
46    pub check_objective: bool,
47    /// Statistical validation
48    pub statistical_tests: bool,
49    /// Tolerance for floating point comparisons
50    pub tolerance: f64,
51    /// Minimum solution quality
52    pub min_quality: f64,
53}
54
55/// Output configuration
56#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct OutputConfig {
58    /// Generate report
59    pub generate_report: bool,
60    /// Report format
61    pub format: ReportFormat,
62    /// Output directory
63    pub output_dir: String,
64    /// Verbosity level
65    pub verbosity: VerbosityLevel,
66}
67
68/// Report format options
69#[derive(Debug, Clone, Serialize, Deserialize)]
70pub enum ReportFormat {
71    /// Plain text
72    Text,
73    /// JSON
74    Json,
75    /// HTML
76    Html,
77    /// Markdown
78    Markdown,
79    /// CSV
80    Csv,
81}
82
83/// Verbosity level for output
84#[derive(Debug, Clone, Serialize, Deserialize)]
85pub enum VerbosityLevel {
86    /// Only errors
87    Error,
88    /// Warnings and errors
89    Warning,
90    /// Info messages
91    Info,
92    /// Debug information
93    Debug,
94}