-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_ampel360.py
More file actions
executable file
·112 lines (90 loc) · 4.37 KB
/
Copy pathsetup_ampel360.py
File metadata and controls
executable file
·112 lines (90 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python3
"""
AMPEL360 H₂-BWB-Q Setup and Demonstration Script
Complete setup and execution of the aircraft configuration optimization framework
"""
import subprocess
import sys
from pathlib import Path
import json
def run_command(cmd, description):
"""Run a command and handle errors"""
print(f"\n📋 {description}")
print(f"🔧 Running: {cmd}")
try:
result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True)
if result.stdout:
print(f"✅ Output:\n{result.stdout}")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error: {e}")
if e.stderr:
print(f"Error details: {e.stderr}")
return False
def main():
"""Main setup and demonstration"""
print("=" * 60)
print("🚁 AMPEL360 H₂-BWB-Q Aircraft Configuration Framework")
print(" Optimized BWB with Hydrogen Propulsion & Quantum Optimization")
print("=" * 60)
# Check if we're in the right directory
if not Path("ampel360_config.json").exists():
print("❌ Error: ampel360_config.json not found. Run from repository root.")
sys.exit(1)
# Step 1: Install dependencies
if not run_command("pip install -r requirements.txt", "Installing dependencies"):
print("⚠️ Continuing without dependency installation...")
# Step 2: Validate configuration
if not run_command("python3 ampel360_utils.py --status --validate",
"Validating configuration and file paths"):
sys.exit(1)
# Step 3: Generate feasible set and optimize
if not run_command("python3 OPTIM-FRAMEWORK/I-INTELLIGENT/scripts/qaoa_over_F.py --optimize",
"Running QAOA optimization to determine QNNN"):
sys.exit(1)
# Step 4: Load optimization results
try:
with open("qnnn_optimization_result.json", 'r') as f:
optimization_result = json.load(f)
qnnn = optimization_result['QNNN']
# Step 5: Update configuration with optimal QNNN
if not run_command(f"python3 ampel360_utils.py --set-qnnn {qnnn}",
f"Updating configuration with optimal QNNN={qnnn}"):
sys.exit(1)
# Step 6: Final validation
if not run_command("python3 ampel360_utils.py --status",
"Final configuration status"):
sys.exit(1)
# Summary
print("\n" + "=" * 60)
print("🎉 AMPEL360 H₂-BWB-Q Framework Setup Complete!")
print("=" * 60)
print("\n📊 Optimization Results:")
print(f" • Optimal passenger capacity (QNNN): {optimization_result['QNNN']}")
print(f" • Selected configuration: {optimization_result['selected_config']['id']}")
print(" • Architecture type: BWB with H₂ propulsion")
print(f" • Objective value: ${optimization_result['objective_value']:,.0f}")
selected_config = optimization_result['selected_config']['config']
print("\n🏗️ Architecture Details:")
for component, donor_id in selected_config.items():
print(f" • {component}: Donor {donor_id}")
print("\n📁 Generated Files:")
print(f" • constraints/hard_constraints.yaml - TRL gates & compatibility rules")
print(" • OPTIM-FRAMEWORK/I-INTELLIGENT/data/candidates.yaml - AMPEL donor database")
print(f" • feasible_set.json - Feasible configurations")
print(f" • qnnn_optimization_result.json - Optimization results")
print(f" • ampel360_config.json - Main configuration (updated)")
print(f"\n🚀 Next Steps:")
print(f" • Review optimization results in qnnn_optimization_result.json")
print(f" • Customize constraints in constraints/hard_constraints.yaml")
print(" • Add more candidates to OPTIM-FRAMEWORK/I-INTELLIGENT/data/candidates.yaml")
print(f" • Run detailed geometric integration analysis")
print(f" • Proceed to P3 phase with BLI/DP and morphing capabilities")
except FileNotFoundError:
print("❌ Optimization result file not found")
sys.exit(1)
except json.JSONDecodeError:
print("❌ Error reading optimization results")
sys.exit(1)
if __name__ == "__main__":
main()