feat: Add automatic solution monitor disabling for multi-solution workflows

Problem:
When running optimization studies with multiple solutions (e.g., static + modal),
NX opens solution monitor windows for each trial. These windows superpose and cause
usability issues during long optimization runs.

Solution:
- Automatically disable solution monitor when solving all solutions (solution_name=None)
- Loop through all solutions and set "solution monitor" property to False
- Implemented in solve_simulation.py before solve execution (lines 271-295)
- Includes error handling with graceful fallback

Benefits:
- No monitor window pile-up during optimization studies
- Better performance (no GUI overhead)
- No user configuration required - works automatically
- Based on user-recorded journal (journal_monitor_window_off.py)

Documentation:
- Updated docs/NX_MULTI_SOLUTION_PROTOCOL.md with solution monitor control section
- Added implementation details and when the feature activates
- Cross-referenced user's recorded journal

Implementation: optimization_engine/solve_simulation.py
Documentation: docs/NX_MULTI_SOLUTION_PROTOCOL.md
Reference: nx_journals/user_generated_journals/journal_monitor_window_off.py
This commit is contained in:
2025-11-24 10:36:10 -05:00
parent 7837255ba8
commit 74a92803b7
2 changed files with 80 additions and 0 deletions

View File

@@ -142,11 +142,65 @@ After implementing the fix, verify:
---
## Solution Monitor Window Control (November 24, 2025)
### Problem: Monitor Window Pile-Up
When running optimization studies with multiple trials, NX opens solution monitor windows for each trial. These windows:
- Superpose on top of each other
- Cannot be easily closed programmatically
- Cause usability issues during long optimization runs
- Slow down the optimization process
### Solution: Automatic Monitor Disabling
The solution monitor is now automatically disabled when solving multiple solutions (when `solution_name=None`).
**Implementation**: `optimization_engine/solve_simulation.py` lines 271-295
```python
# CRITICAL: Disable solution monitor when solving multiple solutions
# This prevents NX from opening multiple monitor windows which superpose and cause usability issues
if not solution_name:
print("[JOURNAL] Disabling solution monitor for all solutions to prevent window pile-up...")
try:
# Get all solutions in the simulation
solutions_disabled = 0
solution_num = 1
while True:
try:
solution_obj_name = f"Solution[Solution {solution_num}]"
simSolution = simSimulation1.FindObject(solution_obj_name)
if simSolution:
propertyTable = simSolution.SolverOptionsPropertyTable
propertyTable.SetBooleanPropertyValue("solution monitor", False)
solutions_disabled += 1
solution_num += 1
else:
break
except:
break # No more solutions
print(f"[JOURNAL] Solution monitor disabled for {solutions_disabled} solution(s)")
except Exception as e:
print(f"[JOURNAL] WARNING: Could not disable solution monitor: {e}")
print(f"[JOURNAL] Continuing with solve anyway...")
```
**When this activates**:
- Automatically when `solution_name=None` (solve all solutions mode)
- For any study with multiple trials (typical optimization scenario)
- No user configuration required
**User-recorded journal**: `nx_journals/user_generated_journals/journal_monitor_window_off.py`
---
## Related Issues Fixed
1. **All trials showing identical frequency**: Fixed by ensuring modal solution runs
2. **Only one data point in dashboard**: Fixed by all trials succeeding
3. **Parallel coordinates with NaN**: Fixed by having complete data from all solutions
4. **Solution monitor windows piling up**: Fixed by automatically disabling monitor for multi-solution runs
---

View File

@@ -268,6 +268,32 @@ def main(args):
# Get the simulation object
simSimulation1 = workSimPart.FindObject("Simulation")
# CRITICAL: Disable solution monitor when solving multiple solutions
# This prevents NX from opening multiple monitor windows which superpose and cause usability issues
if not solution_name:
print("[JOURNAL] Disabling solution monitor for all solutions to prevent window pile-up...")
try:
# Get all solutions in the simulation
solutions_disabled = 0
solution_num = 1
while True:
try:
solution_obj_name = f"Solution[Solution {solution_num}]"
simSolution = simSimulation1.FindObject(solution_obj_name)
if simSolution:
propertyTable = simSolution.SolverOptionsPropertyTable
propertyTable.SetBooleanPropertyValue("solution monitor", False)
solutions_disabled += 1
solution_num += 1
else:
break
except:
break # No more solutions
print(f"[JOURNAL] Solution monitor disabled for {solutions_disabled} solution(s)")
except Exception as e:
print(f"[JOURNAL] WARNING: Could not disable solution monitor: {e}")
print(f"[JOURNAL] Continuing with solve anyway...")
# Get the solution(s) to solve - either specific or all
if solution_name:
# Solve specific solution in background mode