Upload qads/core/config.py
Browse files- qads/core/config.py +78 -0
qads/core/config.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""QADS Configuration System."""
|
| 2 |
+
from dataclasses import dataclass, field
|
| 3 |
+
from typing import Optional, List, Dict, Any
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
@dataclass
|
| 7 |
+
class QuantumConfig:
|
| 8 |
+
"""Quantum computation configuration."""
|
| 9 |
+
n_qubits: int = 8
|
| 10 |
+
n_layers: int = 3
|
| 11 |
+
shots: int = 1000
|
| 12 |
+
backend: str = "default.qubit"
|
| 13 |
+
use_qaoa: bool = True
|
| 14 |
+
use_vqc: bool = True
|
| 15 |
+
entropy_threshold: float = 0.5
|
| 16 |
+
activation_entropy: float = 0.6
|
| 17 |
+
max_iterations: int = 100
|
| 18 |
+
learning_rate: float = 0.01
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
@dataclass
|
| 22 |
+
class PlannerConfig:
|
| 23 |
+
"""Hybrid planner configuration."""
|
| 24 |
+
classical_planner: str = "astar"
|
| 25 |
+
quantum_planner: str = "qaoa"
|
| 26 |
+
use_quantum: bool = True
|
| 27 |
+
replan_threshold: float = 0.3
|
| 28 |
+
planning_horizon: int = 20
|
| 29 |
+
time_limit_ms: int = 500
|
| 30 |
+
grid_resolution: float = 0.5
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@dataclass
|
| 34 |
+
class RLConfig:
|
| 35 |
+
"""Reinforcement learning configuration."""
|
| 36 |
+
algorithm: str = "ppo"
|
| 37 |
+
learning_rate: float = 3e-4
|
| 38 |
+
gamma: float = 0.99
|
| 39 |
+
n_steps: int = 2048
|
| 40 |
+
batch_size: int = 64
|
| 41 |
+
n_epochs: int = 10
|
| 42 |
+
use_quantum_rewards: bool = True
|
| 43 |
+
quantum_reward_weight: float = 0.3
|
| 44 |
+
entropy_coef: float = 0.01
|
| 45 |
+
value_coef: float = 0.5
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@dataclass
|
| 49 |
+
class SimulationConfig:
|
| 50 |
+
"""Simulation environment configuration."""
|
| 51 |
+
env_type: str = "grid2d"
|
| 52 |
+
grid_size: tuple = (20, 20)
|
| 53 |
+
obstacle_density: float = 0.2
|
| 54 |
+
dynamic_obstacles: bool = True
|
| 55 |
+
uncertainty_scale: float = 0.1
|
| 56 |
+
max_steps: int = 500
|
| 57 |
+
dt: float = 0.1
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
@dataclass
|
| 61 |
+
class PerceptionConfig:
|
| 62 |
+
"""Perception layer configuration."""
|
| 63 |
+
sensor_types: List[str] = field(default_factory=lambda: ["lidar", "camera", "imu"])
|
| 64 |
+
fusion_method: str = "ekf"
|
| 65 |
+
detection_range: float = 10.0
|
| 66 |
+
update_rate: float = 30.0
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
@dataclass
|
| 70 |
+
class QADSConfig:
|
| 71 |
+
"""Master QADS configuration."""
|
| 72 |
+
quantum: QuantumConfig = field(default_factory=QuantumConfig)
|
| 73 |
+
planner: PlannerConfig = field(default_factory=PlannerConfig)
|
| 74 |
+
rl: RLConfig = field(default_factory=RLConfig)
|
| 75 |
+
simulation: SimulationConfig = field(default_factory=SimulationConfig)
|
| 76 |
+
perception: PerceptionConfig = field(default_factory=PerceptionConfig)
|
| 77 |
+
debug: bool = False
|
| 78 |
+
log_level: str = "INFO"
|