diff --git a/docs/NX_MULTI_SOLUTION_PROTOCOL.md b/docs/NX_MULTI_SOLUTION_PROTOCOL.md index 84c6f0d0..35ae2532 100644 --- a/docs/NX_MULTI_SOLUTION_PROTOCOL.md +++ b/docs/NX_MULTI_SOLUTION_PROTOCOL.md @@ -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 --- diff --git a/optimization_engine/solve_simulation.py b/optimization_engine/solve_simulation.py index 5ad36891..a78e9955 100644 --- a/optimization_engine/solve_simulation.py +++ b/optimization_engine/solve_simulation.py @@ -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