BREAKING CHANGE: Module paths have been reorganized for better maintainability. Backwards compatibility aliases with deprecation warnings are provided. New Structure: - core/ - Optimization runners (runner, intelligent_optimizer, etc.) - processors/ - Data processing - surrogates/ - Neural network surrogates - nx/ - NX/Nastran integration (solver, updater, session_manager) - study/ - Study management (creator, wizard, state, reset) - reporting/ - Reports and analysis (visualizer, report_generator) - config/ - Configuration management (manager, builder) - utils/ - Utilities (logger, auto_doc, etc.) - future/ - Research/experimental code Migration: - ~200 import changes across 125 files - All __init__.py files use lazy loading to avoid circular imports - Backwards compatibility layer supports old import paths with warnings - All existing functionality preserved To migrate existing code: OLD: from optimization_engine.nx_solver import NXSolver NEW: from optimization_engine.nx.solver import NXSolver OLD: from optimization_engine.runner import OptimizationRunner NEW: from optimization_engine.core.runner import OptimizationRunner 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
80 lines
3.0 KiB
Python
80 lines
3.0 KiB
Python
"""
|
|
Surrogate Models
|
|
================
|
|
|
|
Neural network and ML surrogate models for FEA acceleration.
|
|
|
|
Available modules:
|
|
- neural_surrogate: AtomizerField neural network surrogate
|
|
- generic_surrogate: Flexible surrogate interface
|
|
- adaptive_surrogate: Self-improving surrogate
|
|
- simple_mlp_surrogate: Simple multi-layer perceptron
|
|
- active_learning_surrogate: Active learning surrogate
|
|
- surrogate_tuner: Hyperparameter tuning
|
|
- auto_trainer: Automatic model training
|
|
- training_data_exporter: Export training data from studies
|
|
|
|
Note: Imports are done on-demand to avoid import errors from optional dependencies.
|
|
"""
|
|
|
|
# Lazy imports to avoid circular dependencies and optional dependency issues
|
|
def __getattr__(name):
|
|
"""Lazy import mechanism for surrogate modules."""
|
|
if name == 'NeuralSurrogate':
|
|
from .neural_surrogate import NeuralSurrogate
|
|
return NeuralSurrogate
|
|
elif name == 'create_surrogate_for_study':
|
|
from .neural_surrogate import create_surrogate_for_study
|
|
return create_surrogate_for_study
|
|
elif name == 'GenericSurrogate':
|
|
from .generic_surrogate import GenericSurrogate
|
|
return GenericSurrogate
|
|
elif name == 'ConfigDrivenSurrogate':
|
|
from .generic_surrogate import ConfigDrivenSurrogate
|
|
return ConfigDrivenSurrogate
|
|
elif name == 'create_surrogate':
|
|
from .generic_surrogate import create_surrogate
|
|
return create_surrogate
|
|
elif name == 'AdaptiveSurrogate':
|
|
from .adaptive_surrogate import AdaptiveSurrogate
|
|
return AdaptiveSurrogate
|
|
elif name == 'SimpleSurrogate':
|
|
from .simple_mlp_surrogate import SimpleSurrogate
|
|
return SimpleSurrogate
|
|
elif name == 'ActiveLearningSurrogate':
|
|
from .active_learning_surrogate import ActiveLearningSurrogate
|
|
return ActiveLearningSurrogate
|
|
elif name == 'SurrogateHyperparameterTuner':
|
|
from .surrogate_tuner import SurrogateHyperparameterTuner
|
|
return SurrogateHyperparameterTuner
|
|
elif name == 'tune_surrogate_for_study':
|
|
from .surrogate_tuner import tune_surrogate_for_study
|
|
return tune_surrogate_for_study
|
|
elif name == 'AutoTrainer':
|
|
from .auto_trainer import AutoTrainer
|
|
return AutoTrainer
|
|
elif name == 'TrainingDataExporter':
|
|
from .training_data_exporter import TrainingDataExporter
|
|
return TrainingDataExporter
|
|
elif name == 'create_exporter_from_config':
|
|
from .training_data_exporter import create_exporter_from_config
|
|
return create_exporter_from_config
|
|
|
|
raise AttributeError(f"module 'optimization_engine.processors.surrogates' has no attribute '{name}'")
|
|
|
|
__all__ = [
|
|
'NeuralSurrogate',
|
|
'create_surrogate_for_study',
|
|
'GenericSurrogate',
|
|
'ConfigDrivenSurrogate',
|
|
'create_surrogate',
|
|
'AdaptiveSurrogate',
|
|
'SimpleSurrogate',
|
|
'ActiveLearningSurrogate',
|
|
'SurrogateHyperparameterTuner',
|
|
'tune_surrogate_for_study',
|
|
'AutoTrainer',
|
|
'TrainingDataExporter',
|
|
'create_exporter_from_config',
|
|
]
|