Critical bug fix for LLM mode optimization: **Problem**: - NXParameterUpdater.update_expressions() uses NX journal to import expressions (default use_nx_import=True) - The NX journal directly updates the PRT file on disk and saves it - But then run_optimization.py was calling updater.save() afterwards - save() writes self.content (loaded at initialization) back to file - This overwrote the NX journal changes with stale binary content! **Result**: All optimization trials produced identical FEM results because the model was never actually updated. **Fixes**: 1. Removed updater.save() call from model_updater closure in run_optimization.py 2. Added theSession.Parts.CloseAll() in import_expressions.py to ensure changes are flushed and file is released 3. Fixed test_phase_3_2_e2e.py variable name (best_trial_file → results_file) **Testing**: Verified expressions persist to disk correctly with standalone test. Next step: Address remaining issue where FEM results are still identical (likely solve journal not reloading updated PRT).
115 lines
2.7 KiB
JSON
115 lines
2.7 KiB
JSON
{
|
|
"study_name": "simple_beam_optimization",
|
|
"description": "Test Phase 3.3 post-processing features",
|
|
"substudy_name": "05_test_postprocessing_5trials",
|
|
"design_variables": {
|
|
"beam_half_core_thickness": {
|
|
"type": "continuous",
|
|
"min": 10.0,
|
|
"max": 40.0,
|
|
"baseline": 20.0,
|
|
"units": "mm",
|
|
"description": "Half thickness of beam core"
|
|
},
|
|
"beam_face_thickness": {
|
|
"type": "continuous",
|
|
"min": 10.0,
|
|
"max": 40.0,
|
|
"baseline": 20.0,
|
|
"units": "mm",
|
|
"description": "Thickness of beam face sheets"
|
|
},
|
|
"holes_diameter": {
|
|
"type": "continuous",
|
|
"min": 150.0,
|
|
"max": 450.0,
|
|
"baseline": 300.0,
|
|
"units": "mm",
|
|
"description": "Diameter of lightening holes"
|
|
},
|
|
"hole_count": {
|
|
"type": "integer",
|
|
"min": 5,
|
|
"max": 15,
|
|
"baseline": 10,
|
|
"units": "unitless",
|
|
"description": "Number of lightening holes"
|
|
}
|
|
},
|
|
"extractors": [
|
|
{
|
|
"name": "max_displacement",
|
|
"action": "extract_displacement",
|
|
"description": "Extract maximum displacement from OP2",
|
|
"parameters": {
|
|
"metric": "max"
|
|
}
|
|
},
|
|
{
|
|
"name": "max_stress",
|
|
"action": "extract_solid_stress",
|
|
"description": "Extract maximum von Mises stress from OP2",
|
|
"parameters": {
|
|
"subcase": 1,
|
|
"element_type": "auto"
|
|
}
|
|
},
|
|
{
|
|
"name": "mass",
|
|
"action": "extract_expression",
|
|
"description": "Extract mass from p173 expression",
|
|
"parameters": {
|
|
"expression_name": "p173"
|
|
}
|
|
}
|
|
],
|
|
"objectives": [
|
|
{
|
|
"name": "minimize_displacement",
|
|
"extractor": "max_displacement",
|
|
"goal": "minimize",
|
|
"weight": 0.33,
|
|
"description": "Minimize maximum displacement"
|
|
},
|
|
{
|
|
"name": "minimize_stress",
|
|
"extractor": "max_stress",
|
|
"goal": "minimize",
|
|
"weight": 0.33,
|
|
"description": "Minimize maximum von Mises stress"
|
|
},
|
|
{
|
|
"name": "minimize_mass",
|
|
"extractor": "mass",
|
|
"goal": "minimize",
|
|
"weight": 0.34,
|
|
"description": "Minimize beam mass"
|
|
}
|
|
],
|
|
"constraints": [
|
|
{
|
|
"name": "displacement_limit",
|
|
"extractor": "max_displacement",
|
|
"type": "less_than",
|
|
"value": 10.0,
|
|
"units": "mm",
|
|
"description": "Maximum displacement must be less than 10mm"
|
|
}
|
|
],
|
|
"optimization_settings": {
|
|
"algorithm": "optuna",
|
|
"n_trials": 5,
|
|
"sampler": "TPE",
|
|
"pruner": "HyperbandPruner",
|
|
"direction": "minimize",
|
|
"timeout_per_trial": 600
|
|
},
|
|
"post_processing": {
|
|
"generate_plots": true,
|
|
"plot_formats": ["png", "pdf"],
|
|
"cleanup_models": true,
|
|
"keep_top_n_models": 3,
|
|
"cleanup_dry_run": false
|
|
}
|
|
}
|