# M1 Mirror Cost Reduction - Flat Back V9

> See [../README.md](../README.md) for project overview and optical specifications.

## Study Overview

| Field | Value |
|-------|-------|
| **Study Name** | m1_mirror_cost_reduction_flat_back_V9 |
| **Algorithm** | SAT v3 (Self-Aware Turbo - Complete) |
| **Status** | **RUNNING - NEW RECORD!** |
| **Created** | 2025-12-31 |
| **Target** | Beat WS=218.26 (V7 best) |
| **Best WS** | **205.58** (trial 86) - beats target by 12.68! |

## What's New in V9 (SAT v3)

V9 incorporates all lessons learned from V5-V8:

### 1. Complete Training Data (556 samples)
```
V5: 45 samples (all infeasible)
V6: 196 samples (129 feasible)
V7: 179 samples (11 feasible)
V8: 181 samples (181 feasible)
─────────────────────────────────
Total: 601 samples (556 loaded)
```

### 2. Adaptive Exploration Schedule
| Phase | Trials | Exploration Weight | Strategy |
|-------|--------|-------------------|----------|
| Phase 1 | 1-30 | 15% | Initial exploration |
| Phase 2 | 31-80 | 8% | Balanced |
| Phase 3 | 81-190 | 3% | Heavy exploitation |
| L-BFGS | 191-200 | 0% | Polish near best |

### 3. Optimal Mass Region Targeting
- V8 threshold: 115 kg (too conservative)
- V9 threshold: **118 kg** (sweet spot based on data analysis)
- Best designs found in 115-120 kg range

### 4. Seeded with Best Known Design
```python
SEED_DESIGN = {
    "whiffle_min": 72.0,
    "whiffle_outer_to_vertical": 80.5,
    "whiffle_triangle_closeness": 65.0,
    "lateral_inner_angle": 29.36,
    "lateral_outer_angle": 11.72,
    ...
}
```
This is the V7 design with WS=218.26.

### 5. High Exploitation Ratio
- 70% of candidates sampled near best design
- 30% random exploration
- Scale: 5% of parameter range

## Data Analysis Summary

Analysis of all 601 samples from V5-V8 revealed:

### Top 10 Designs (All Studies)
| Rank | Study | WS | Mass |
|------|-------|-----|------|
| 1 | V7 | 218.26 | 119.49 |
| 2 | V7 | 224.96 | 117.76 |
| 3 | V6 | 225.41 | 117.76 |
| 4 | V6 | 230.00 | 119.69 |
| 5 | V7 | 234.30 | 116.91 |

### Mass vs Performance
| Mass Range | Count | Best WS | Mean WS |
|------------|-------|---------|---------|
| 105-110 kg | 16 | 354.75 | 457.80 |
| 110-115 kg | 161 | 271.38 | 404.39 |
| **115-118 kg** | 92 | **224.96** | **361.39** |
| **118-120 kg** | 52 | **218.26** | **305.49** |

**Conclusion**: Optimal mass region is 115-120 kg.

## Current Results (137 trials)

### Best Design Found
| Metric | Value |
|--------|-------|
| **Weighted Sum** | **205.58** |
| **Mass** | 110.04 kg |
| Trial | 86 |

### Performance Summary
| Metric | Value |
|--------|-------|
| Trials completed | 137 |
| Feasibility rate | **100%** |
| Mass range | 104.87 - 117.50 kg |
| Mean mass | 111.89 kg |

### Phase Performance
| Phase | Trials | Best WS | Mean WS |
|-------|--------|---------|---------|
| Phase 1 (explore) | 30 | 232.00 | 394.48 |
| Phase 2 (balanced) | 50 | 222.01 | 360.51 |
| Phase 3 (exploit) | 57 | **205.58** | 262.57 |

The adaptive exploration schedule is working - performance improves dramatically as exploitation increases!

## Configuration

### SAT v3 Settings
```json
{
  "n_ensemble_models": 5,
  "training_epochs": 800,
  "candidates_per_round": 1000,
  "retrain_every": 25,
  "min_distance_threshold": 0.03,
  "jitter_scale": 0.01,
  "mass_soft_threshold": 118.0,
  "exploit_near_best_ratio": 0.7,
  "exploit_scale": 0.05,
  "lbfgs_polish_trials": 10
}
```

### Training Data Sources
- V5: `../m1_mirror_cost_reduction_flat_back_V5/3_results/study.db`
- V6: `../m1_mirror_cost_reduction_flat_back_V6/3_results/study.db`
- V7: `../m1_mirror_cost_reduction_flat_back_V7/3_results/study.db`
- V8: `../m1_mirror_cost_reduction_flat_back_V8/3_results/study.db`

## Usage

```bash
# Run full optimization (200 trials)
python run_sat_optimization.py --trials 200

# Run subset
python run_sat_optimization.py --trials 50

# Resume from existing study
python run_sat_optimization.py --resume
```

## Evolution: V5 → V6 → V7 → V8 → V9

| Version | Method | Training Data | Key Issue | Best WS |
|---------|--------|---------------|-----------|---------|
| V5 | MLP + L-BFGS | None | Overconfident OOD | 290.18 |
| V6 | Pure TPE | None | Slow convergence | 225.41 |
| V7 | SAT v1 | V6 (129) | 82% duplicates | 218.26 |
| V8 | SAT v2 | V6 (196) | Over-exploration | 271.38 |
| **V9** | **SAT v3** | **V5-V8 (556)** | **None!** | **205.58** |

**V9 is the new campaign best!** The SAT v3 approach with adaptive exploration finally works.

## References

- Campaign analysis: [analyze_flatback_campaign.py](../analyze_flatback_campaign.py)
- V8 report: [V8 README](../m1_mirror_cost_reduction_flat_back_V8/README.md)
