refactor: Major reorganization of optimization_engine module structure
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>
This commit is contained in:
@@ -7,7 +7,7 @@ This extractor reads expressions using the .exp export method for accuracy.
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any
|
||||
from optimization_engine.nx_updater import NXParameterUpdater
|
||||
from optimization_engine.nx.updater import NXParameterUpdater
|
||||
|
||||
|
||||
def extract_expression(prt_file: Path, expression_name: str):
|
||||
|
||||
@@ -228,11 +228,11 @@ from pathlib import Path
|
||||
# Add optimization engine to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||
|
||||
from optimization_engine.intelligent_optimizer import IntelligentOptimizer
|
||||
from optimization_engine.nx_updater import NXParameterUpdater
|
||||
from optimization_engine.nx_solver import NXSolver
|
||||
from optimization_engine.core.intelligent_optimizer import IntelligentOptimizer
|
||||
from optimization_engine.nx.updater import NXParameterUpdater
|
||||
from optimization_engine.nx.solver import NXSolver
|
||||
from optimization_engine.extractors.frequency_extractor import extract_first_frequency
|
||||
from optimization_engine.generate_report_markdown import generate_markdown_report
|
||||
from optimization_engine.reporting.markdown_report import generate_markdown_report
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -29,7 +29,7 @@ import matplotlib.pyplot as plt
|
||||
project_root = Path(__file__).parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
|
||||
from optimization_engine.active_learning_surrogate import (
|
||||
from optimization_engine.processors.surrogates.active_learning_surrogate import (
|
||||
ActiveLearningSurrogate,
|
||||
extract_training_data_from_study
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ project_root = Path(__file__).parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
sys.path.insert(0, str(project_root / 'atomizer-field'))
|
||||
|
||||
from optimization_engine.simple_mlp_surrogate import SimpleSurrogate
|
||||
from optimization_engine.processors.surrogates.simple_mlp_surrogate import SimpleSurrogate
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -63,7 +63,7 @@ def load_config_bounds(study_path: Path) -> dict:
|
||||
|
||||
return bounds
|
||||
|
||||
from optimization_engine.active_learning_surrogate import EnsembleMLP
|
||||
from optimization_engine.processors.surrogates.active_learning_surrogate import EnsembleMLP
|
||||
|
||||
|
||||
class ValidatedSurrogate:
|
||||
|
||||
@@ -22,7 +22,7 @@ import matplotlib.pyplot as plt
|
||||
project_root = Path(__file__).parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
|
||||
from optimization_engine.active_learning_surrogate import (
|
||||
from optimization_engine.processors.surrogates.active_learning_surrogate import (
|
||||
EnsembleMLP,
|
||||
extract_training_data_from_study
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ import optuna
|
||||
project_root = Path(__file__).parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
|
||||
from optimization_engine.simple_mlp_surrogate import SimpleSurrogate
|
||||
from optimization_engine.processors.surrogates.simple_mlp_surrogate import SimpleSurrogate
|
||||
|
||||
def load_fea_data_from_database(db_path: str, study_name: str):
|
||||
"""Load actual FEA results from database for comparison."""
|
||||
|
||||
@@ -12,8 +12,8 @@ Expected behavior:
|
||||
import numpy as np
|
||||
import optuna
|
||||
from pathlib import Path
|
||||
from optimization_engine.adaptive_characterization import CharacterizationStoppingCriterion
|
||||
from optimization_engine.landscape_analyzer import LandscapeAnalyzer
|
||||
from optimization_engine.processors.adaptive_characterization import CharacterizationStoppingCriterion
|
||||
from optimization_engine.reporting.landscape_analyzer import LandscapeAnalyzer
|
||||
|
||||
|
||||
def simple_smooth_function(trial):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Test neural surrogate integration."""
|
||||
|
||||
import time
|
||||
from optimization_engine.neural_surrogate import create_surrogate_for_study
|
||||
from optimization_engine.processors.surrogates.neural_surrogate import create_surrogate_for_study
|
||||
|
||||
print("Testing Neural Surrogate Integration")
|
||||
print("=" * 60)
|
||||
|
||||
@@ -7,7 +7,7 @@ project_root = Path(__file__).parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
sys.path.insert(0, str(project_root / 'atomizer-field'))
|
||||
|
||||
from optimization_engine.neural_surrogate import create_parametric_surrogate_for_study
|
||||
from optimization_engine.processors.surrogates.neural_surrogate import create_parametric_surrogate_for_study
|
||||
|
||||
# Create surrogate
|
||||
print("Creating parametric surrogate...")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Test parametric surrogate integration."""
|
||||
|
||||
import time
|
||||
from optimization_engine.neural_surrogate import create_parametric_surrogate_for_study
|
||||
from optimization_engine.processors.surrogates.neural_surrogate import create_parametric_surrogate_for_study
|
||||
|
||||
print("Testing Parametric Neural Surrogate")
|
||||
print("=" * 60)
|
||||
|
||||
@@ -117,7 +117,7 @@ from pathlib import Path
|
||||
# Add parent directory to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||
|
||||
from optimization_engine.runner import OptimizationRunner
|
||||
from optimization_engine.core.runner import OptimizationRunner
|
||||
|
||||
def main():
|
||||
"""Run the optimization."""
|
||||
|
||||
Reference in New Issue
Block a user