This framework provides tools for optimizing turbine designs using surrogate modeling and multi-objective optimization techniques.
turbine_optimization/
├── config/ # Configuration files
├── data/ # Data storage
├── src/ # Source code
│ ├── data/ # Data access and processing
│ ├── models/ # Model building and evaluation
│ ├── optimization/ # Optimization algorithms
│ ├── visualization/ # Plotting and visualization
│ └── utils/ # Utility functions
├── tests/ # Test suite
└── main.py # Entry point- Python 3.10+
- NumPy
- Pandas
- Scikit-learn
- Pymoo
- Matplotlib
- PyYAML
-
Clone the repository:
git clone https://github.com/yourusername/turbine_optimization.git cd turbine_optimization -
Install dependencies:
pip install -r requirements.txt
-
Initialize configuration (optional):
python main.py --init-config
python main.pyThis will run the optimization with default settings, looking for data in the data/ directory.
You can specify a custom configuration file:
python main.py --config path/to/config.yamlThe framework allows flexible column mapping to work with any CSV data format. You can configure which columns to use as input parameters and target variables in the configuration file.
The configuration uses generic parameter and target naming:
- Parameters (inputs): x1, x2, x3, ...
- Targets (outputs/objectives): y1, y2, ...
Example configuration:
data:
columns:
# Map generic parameter names to column names in your CSV
parameters:
x1: blads # First parameter maps to 'blads' column
x2: angle-wrap # Second parameter maps to 'baojiao' column
x3: angle-inlet # Third parameter maps to 'angle_in' column
x4: angle-outlet # Fourth parameter maps to 'angle_out' column
# Map generic target names to column names
targets:
y1:
column: power # First objective maps to 'power' column
type: maximize # We want to maximize this objective
y2:
column: efficiency # Second objective maps to 'efficiency' column
type: maximize # We want to maximize this objective
# Specify which parameters should be treated as integers
integer_parameters:
- x1For target variables (objectives), you can specify:
column: The column name in the CSV filetype: Whether tomaximizeorminimizethe objective
This is important for multi-objective optimization, as it determines how the objective is treated. For maximize objectives, the values are automatically negated internally (since the optimizer always minimizes).
This allows you to use any CSV data file without needing to modify the code.
To add a new surrogate model:
- Create a new model class that extends
BaseModelinsrc/models/ - Register the model in
ModelFactory - Update your configuration to use the new model
Example for adding a Neural Network model:
# src/models/neural_network.py
from .base_model import BaseModel
class NeuralNetworkModel(BaseModel):
# Implement required methods
...
# Register in model_factory.py
ModelFactory.register_model('neural_network', NeuralNetworkModel)Then in your configuration:
models:
y1_model:
type: neural_network
params:
hidden_layers: [64, 32]
activation: reluThe following examples demonstrate how to use the framework:
from src.data.data_loader import DataLoader
from src.data.data_processor import DataProcessor
from src.models.model_factory import ModelFactory
from src.optimization.problem_definition import TurbineOptimizationProblem
from src.optimization.optimizer import MultiObjectiveOptimizer
# Load data
loader = DataLoader("data")
data = loader.load_data("turbine_data.csv")
# Define column mappings using generic names
parameter_mappings = {
"x1": "blads", # First parameter (integer)
"x2": "angle_wrap", # Second parameter
"x3": "angle_in", # Third parameter
"x4": "angle_out" # Fourth parameter
}
target_mappings = {
"y1": {
"column": "power",
"type": "maximize" # We want to maximize power
},
"y2": {
"column": "efficiency",
"type": "maximize" # We want to maximize efficiency
}
}
integer_parameters = ["x1"]
# Process data
processor = DataProcessor()
X_train, targets_dict = processor.prepare_training_data(
data, parameter_mappings, target_mappings, integer_parameters
)
# Create and train models
models = []
for target_name in target_mappings.keys():
model = ModelFactory.create_model('random_forest')
model.fit(X_train, targets_dict[target_name])
models.append(model)
# Setup optimization
problem = TurbineOptimizationProblem(
models=models,
xl=processor.x_min,
xu=processor.x_max,
integer_vars=processor.get_integer_parameter_indices()
)
# Run optimization
optimizer = MultiObjectiveOptimizer(problem)
results = optimizer.run_optimization()This project is licensed under the MIT License - see the LICENSE file for details.