feat: Add substudy system with live history tracking and workflow fixes

Major Features:
- Hierarchical substudy system (like NX Solutions/Subcases)
  * Shared model files across all substudies
  * Independent configuration per substudy
  * Continuation support from previous substudies
  * Real-time incremental history updates
- Live history tracking with optimization_history_incremental.json
- Complete bracket_displacement_maximizing study with substudy examples

Core Fixes:
- Fixed expression update workflow to pass design_vars through simulation_runner
  * Restored working NX journal expression update mechanism
  * OP2 timestamp verification instead of file deletion
  * Resolved issue where all trials returned identical objective values
- Fixed LLMOptimizationRunner to pass design variables to simulation runner
- Enhanced NXSolver with timestamp-based file regeneration verification

New Components:
- optimization_engine/llm_optimization_runner.py - LLM-driven optimization runner
- optimization_engine/optimization_setup_wizard.py - Phase 3.3 setup wizard
- studies/bracket_displacement_maximizing/ - Complete substudy example
  * run_substudy.py - Substudy runner with continuation
  * run_optimization.py - Standalone optimization runner
  * config/substudy_template.json - Template for new substudies
  * substudies/coarse_exploration/ - 20-trial coarse search
  * substudies/fine_tuning/ - 50-trial refinement (continuation example)
  * SUBSTUDIES_README.md - Complete substudy documentation

Technical Improvements:
- Incremental history saving after each trial (optimization_history_incremental.json)
- Expression update workflow: .prt update → NX journal receives values → geometry update → FEM update → solve
- Trial indexing fix in substudy result saving
- Updated README with substudy system documentation

Testing:
- Successfully ran 20-trial coarse_exploration substudy
- Verified different objective values across trials (workflow fix validated)
- Confirmed live history updates in real-time
- Tested shared model file usage across substudies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-16 21:29:54 -05:00
parent 90a9e020d8
commit 2f3afc3813
126 changed files with 15592 additions and 97 deletions

View File

@@ -6,13 +6,13 @@
## Overview
Phase 3 implements **automated research and code generation** for OP2 result extraction using pyNastran. The system can:
Phase 3 implements **LLM-enhanced research and code generation** for OP2 result extraction using pyNastran. The system can:
1. Research pyNastran documentation to find appropriate APIs
2. Generate complete, executable Python extraction code
3. Store learned patterns in a knowledge base
4. Auto-generate extractors from Phase 2.7 LLM output
This completes the **zero-manual-coding vision**: Users describe optimization goals in natural language → System generates all required code automatically.
This enables **LLM-enhanced optimization workflows**: Users can describe goals in natural language and optionally have the system generate code automatically, or write custom extractors manually as needed.
## Objectives Achieved
@@ -287,7 +287,7 @@ def min_to_avg_ratio_hook(context):
return {'min_to_avg_ratio': result, 'objective': result}
```
**Result**: Complete optimization setup from natural language → Zero manual coding! 🚀
**Result**: LLM-enhanced optimization setup from natural language with flexible automation! 🚀
## Testing
@@ -483,13 +483,13 @@ Phase 3 successfully implements **automated OP2 extraction code generation** usi
- ✅ Knowledge base architecture
- ✅ 3 core extraction patterns (displacement, stress, force)
This completes the **zero-manual-coding pipeline**:
This enables the **LLM-enhanced automation pipeline**:
- Phase 2.7: LLM analyzes natural language → engineering features
- Phase 2.8: Inline calculation code generation
- Phase 2.9: Post-processing hook generation
- **Phase 3: OP2 extraction code generation**
- Phase 2.8: Inline calculation code generation (optional)
- Phase 2.9: Post-processing hook generation (optional)
- **Phase 3: OP2 extraction code generation (optional)**
Users can now describe optimization goals in natural language and the system generates ALL required code automatically! 🎉
Users can describe optimization goals in natural language and choose to leverage automated code generation, manual coding, or a hybrid approach! 🎉
## Related Documentation