Machine learning algorithm utilized to aid aviation challenge team, taking a few test runs as training and extrapolating that data to find candidates for the best combination of airplane parameters to achieve the best score for the simulation.
data.ipynb- Data preprocessing and cleaning pipelineml.ipynb- Machine learning model training and evaluationtest.ipynb- Monte Carlo optimization to find best aircraft configurationsy_test.csv- Actual scores from test sety_pred.csv- Predicted scores from trained modelformatted_data.csv- Cleaned training data (generated)results.csv- Optimized aircraft configurations (generated)model.pkl- Trained Random Forest model (generated)
The system optimizes the following aircraft design parameters:
- Horsepower (400-1000 HP in 25 HP increments)
- Extra Propeller (0 or 1)
- Retractable Landing Gear (0 or 1)
- Empty Weight (calculated based on other parameters)
- Payload Weight (1700-6000 lbs in 300 lb increments)
- Fuel Load (fixed at 300 lbs for 40 min flight)
- Total Weight (must not exceed 8000 lbs)
- Wing Semi-Length (25-60 ft in 5 ft increments)
- Wing Root Chord (2.0-6.5 ft in 0.3 ft increments)
- Wing Tip Chord (2.0-6.5 ft in 0.3 ft increments)
- Wing Area (calculated)
- Aspect Ratio (calculated)
- Wing Loading (Total Weight / Wing Area)
- Power Loading (Total Weight / Horsepower)
- Loads raw CSV data with aircraft configurations and scores
- Removes unnamed columns and invalid entries
- Filters for valid score entries only
- Calculates derived parameters (wing area, aspect ratio, etc.)
- Uses Random Forest Regressor with hyperparameter optimization
- Performs 5-fold cross-validation with 100 random search iterations
- Achieves ~81% R² score on test set
- Average prediction error: ~8.3%
- Maximum prediction error: ~16.1%
- Runs 1,000,000 Monte Carlo simulations
- Tests random combinations within parameter constraints
- Filters results to top 20% of maximum observed score
- Returns ranked list of optimal configurations
pandas
scikit-learn
numpy
scipy-
Prepare Data:
jupyter notebook data.ipynb
Ensure your raw data is in
data.csvformat. -
Train Model:
jupyter notebook ml.ipynb
This will generate
model.pkland performance metrics. -
Find Optimal Configurations:
jupyter notebook test.ipynb
This generates
results.csvwith top-performing aircraft configurations.
The trained Random Forest model achieves:
- R² Score: 0.809 (81% variance explained)
- Mean Absolute Percentage Error: 8.28%
- Maximum Percentage Error: 16.08%
The optimization process identifies aircraft configurations achieving scores ≥80% of the maximum observed score. Results are sorted by predicted score and include all design parameters plus calculated performance metrics.
- Automated parameter calculation: Derives wing area, aspect ratio, empty weight, and performance metrics
- Constraint enforcement: Ensures total weight ≤ 8000 lbs
- Monte Carlo optimization: Explores vast parameter space efficiently
- Performance filtering: Returns only high-scoring configurations
- Reproducible pipeline: End-to-end workflow from raw data to optimized designs
This tool assists aviation challenge teams by:
- Reducing the number of physical test flights needed
- Identifying promising parameter combinations quickly
- Providing quantitative guidance for design decisions
- Enabling rapid iteration on aircraft configurations
- The model assumes a fixed longitudinal arm of 13 ft for all configurations
- Fuel load is standardized at 300 lbs (40-minute flight capacity)
- Wing lateral arm is fixed at 2 ft
- Sweep angle is set to 0° for all configurations
- Empty weight calculation includes adjustments for extra propeller and retractable landing gear