Files
Atomizer/archive/test_scripts/test_new_optimization.md
Anto01 2b3573ec42 feat: Add AtomizerField training data export and intelligent model discovery
Major additions:
- Training data export system for AtomizerField neural network training
- Bracket stiffness optimization study with 50+ training samples
- Intelligent NX model discovery (auto-detect solutions, expressions, mesh)
- Result extractors module for displacement, stress, frequency, mass
- User-generated NX journals for advanced workflows
- Archive structure for legacy scripts and test outputs
- Protocol documentation and dashboard launcher

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 12:01:50 -05:00

2.8 KiB

New Optimization Testing Guide

Test Real-Time Dashboard with Active Optimization

This will let you see the WebSocket updates in real-time as trials complete.

1. Start Dashboard (Both Servers)

Terminal 1 - Backend

cd atomizer-dashboard/backend
python -m uvicorn api.main:app --reload --port 8000

Terminal 2 - Frontend

cd atomizer-dashboard/frontend
npm run dev

Visit: http://localhost:3003

2. Connect WebSocket to Existing Study

Open browser console and run:

const ws = new WebSocket('ws://localhost:8000/api/ws/optimization/bracket_stiffness_optimization_V3');

ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
  console.log(`[${message.type}]`, message.data);
};

ws.onopen = () => console.log('✓ Connected to optimization stream');

You should see:

✓ Connected to optimization stream
[connected] {study_id: "bracket_stiffness_optimization_V3", current_trials: 100, ...}

3. Start a Small Optimization Run (5 Trials)

Terminal 3 - Run Optimization

cd studies/bracket_stiffness_optimization_V3
python run_optimization.py --trials 5

4. Watch Real-Time Events

As trials complete, you'll see WebSocket events:

// Trial completed
[trial_completed] {
  trial_number: 101,
  objective: 0.0234,
  params: {rib_thickness_1: 2.3, ...},
  ...
}

// Progress update
[progress] {
  current: 101,
  total: 105,
  percentage: 96.19
}

// New best found (if better than previous)
[new_best] {
  trial_number: 103,
  objective: 0.0198,
  ...
}

// Pareto front update (multi-objective)
[pareto_front] {
  pareto_front: [{...}, {...}],
  count: 49
}

5. Test Report Generation While Running

While optimization is running, generate a report:

curl -X POST "http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/generate-report?format=html"

Then download it:

curl http://localhost:8000/api/optimization/studies/bracket_stiffness_optimization_V3/reports/optimization_report.html -o report.html

Open report.html in browser to see formatted report with all 100+ trials.

6. Expected Behavior

  • WebSocket receives events as trials complete (2-5 minute intervals per trial)
  • Progress percentage updates
  • Pareto front grows if new non-dominated solutions found
  • Report can be generated at any point during optimization
  • All endpoints remain responsive during optimization

7. Production Testing

For full production test:

python run_optimization.py --trials 50

This will run for several hours and provide extensive real-time data for dashboard testing.

Notes

  • Each trial takes 2-5 minutes (NX simulation solve time)
  • WebSocket will broadcast updates immediately upon trial completion
  • Frontend should handle all 6 event types gracefully
  • Reports update dynamically as new trials complete