feat: Add TrialManager and DashboardDB for unified trial management
- Add TrialManager (trial_manager.py) for consistent trial_NNNN naming - Add DashboardDB (dashboard_db.py) for Optuna-compatible database schema - Update CLAUDE.md with trial management documentation - Update ATOMIZER_CONTEXT.md with v1.8 trial system - Update cheatsheet v2.2 with new utilities - Update SYS_14 protocol to v2.3 with TrialManager integration - Add LAC learnings for trial management patterns - Add archive/README.md for deprecated code policy Key principles: - Trial numbers NEVER reset (monotonic) - Folders NEVER get overwritten - Database always synced with filesystem - Surrogate predictions are NOT trials (only FEA results) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,17 +106,21 @@ studies/
|
||||
studies/{geometry_type}/{study_name}/
|
||||
├── optimization_config.json # Problem definition
|
||||
├── run_optimization.py # FEA optimization script
|
||||
├── run_nn_optimization.py # Neural acceleration (optional)
|
||||
├── run_turbo_optimization.py # GNN-Turbo acceleration (optional)
|
||||
├── README.md # MANDATORY documentation
|
||||
├── STUDY_REPORT.md # Results template
|
||||
├── 1_setup/
|
||||
│ ├── optimization_config.json # Config copy for reference
|
||||
│ └── model/
|
||||
│ ├── Model.prt # NX part file
|
||||
│ ├── Model_sim1.sim # NX simulation
|
||||
│ └── Model_fem1.fem # FEM definition
|
||||
├── 2_iterations/ # FEA trial folders (iter1, iter2, ...)
|
||||
├── 2_iterations/ # FEA trial folders (trial_NNNN/)
|
||||
│ ├── trial_0001/ # Zero-padded, NEVER reset
|
||||
│ ├── trial_0002/
|
||||
│ └── ...
|
||||
├── 3_results/
|
||||
│ ├── study.db # Optuna database
|
||||
│ ├── study.db # Optuna-compatible database
|
||||
│ ├── optimization.log # Logs
|
||||
│ └── turbo_report.json # NN results (if run)
|
||||
└── 3_insights/ # Study Insights (SYS_16)
|
||||
@@ -435,11 +439,68 @@ python -m optimization_engine.auto_doc templates
|
||||
|
||||
---
|
||||
|
||||
## Trial Management System (v2.3)
|
||||
|
||||
New unified trial management ensures consistency across all optimization methods:
|
||||
|
||||
### Key Components
|
||||
|
||||
| Component | Path | Purpose |
|
||||
|-----------|------|---------|
|
||||
| `TrialManager` | `optimization_engine/utils/trial_manager.py` | Unified trial folder + DB management |
|
||||
| `DashboardDB` | `optimization_engine/utils/dashboard_db.py` | Optuna-compatible database wrapper |
|
||||
|
||||
### Trial Naming Convention
|
||||
|
||||
```
|
||||
2_iterations/
|
||||
├── trial_0001/ # Zero-padded, monotonically increasing
|
||||
├── trial_0002/ # NEVER reset, NEVER overwritten
|
||||
├── trial_0003/
|
||||
└── ...
|
||||
```
|
||||
|
||||
**Key principles**:
|
||||
- Trial numbers **NEVER reset** (monotonically increasing)
|
||||
- Folders **NEVER get overwritten**
|
||||
- Database is always in sync with filesystem
|
||||
- Surrogate predictions (5K) are NOT trials - only FEA results
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
from optimization_engine.utils.trial_manager import TrialManager
|
||||
|
||||
tm = TrialManager(study_dir)
|
||||
|
||||
# Start new trial
|
||||
trial = tm.new_trial(params={'rib_thickness': 10.5})
|
||||
|
||||
# After FEA completes
|
||||
tm.complete_trial(
|
||||
trial_number=trial['trial_number'],
|
||||
objectives={'wfe_40_20': 5.63, 'mass_kg': 118.67},
|
||||
weighted_sum=42.5,
|
||||
is_feasible=True
|
||||
)
|
||||
```
|
||||
|
||||
### Database Schema (Optuna-Compatible)
|
||||
|
||||
The `DashboardDB` class creates Optuna-compatible schema for dashboard integration:
|
||||
- `trials` - Main trial records with state, datetime, value
|
||||
- `trial_values` - Objective values (supports multiple objectives)
|
||||
- `trial_params` - Design parameter values
|
||||
- `trial_user_attributes` - Metadata (source, solve_time, etc.)
|
||||
- `studies` - Study metadata (directions, name)
|
||||
|
||||
---
|
||||
|
||||
## Version Info
|
||||
|
||||
| Component | Version | Last Updated |
|
||||
|-----------|---------|--------------|
|
||||
| ATOMIZER_CONTEXT | 1.7 | 2025-12-20 |
|
||||
| ATOMIZER_CONTEXT | 1.8 | 2025-12-28 |
|
||||
| BaseOptimizationRunner | 1.0 | 2025-12-07 |
|
||||
| GenericSurrogate | 1.0 | 2025-12-07 |
|
||||
| Study State Detector | 1.0 | 2025-12-07 |
|
||||
@@ -452,6 +513,9 @@ python -m optimization_engine.auto_doc templates
|
||||
| Subagent Commands | 1.0 | 2025-12-07 |
|
||||
| FEARunner Pattern | 1.0 | 2025-12-12 |
|
||||
| Study Insights | 1.0 | 2025-12-20 |
|
||||
| TrialManager | 1.0 | 2025-12-28 |
|
||||
| DashboardDB | 1.0 | 2025-12-28 |
|
||||
| GNN-Turbo System | 2.3 | 2025-12-28 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user