Design optimization
Tune a Scene's design variables with gradient, sweep, Monte Carlo, genetic, PSO or Bayesian Studies, then apply the best point.
A Study searches the values of a Scene's design variables for the best
value of an objective. You set Studies up in the Design Optimization panel,
from Python with Scene.optimizations, or by asking the Agent.
Before you start#
- Create Parameters for the dimensions you want to tune and bind fields to them.
- Mark those Parameters as design variables and give them bounds.
Define a Study#
A Study has:
| Part | What it is |
|---|---|
| Objective | A function in a Project script, or an objective a Plugin provides. It receives the Scene at one point and returns a loss and optional metrics. |
| Direction | Minimize or maximize |
| Strategy | The search method, see below |
| Budget | How many evaluations, or iterations for gradient methods |
| Variables | All design variables, or a subset with per-variable settings |
A Scene can have several Studies that share its design variables. Studies are
saved in the .wtscene file as [[optimization]] rows.
Strategies#
| Strategy | Use it when |
|---|---|
gradient | The objective is differentiable end to end, for example a differentiable solver. Each gradient step is one evaluation. |
sweep | You want a regular grid over one or two variables. |
custom_sweep | You have a list of specific points to try. |
monte_carlo | You want random samples to explore the space or estimate spread. |
genetic | The objective is noisy or has many local minima. |
pso | Particle swarm; a robust black-box choice for a few to tens of variables. |
bayesian | Each evaluation is expensive and the budget is small. |
Plugins can add strategies through the witwin.optimizers entry point.
Black-box strategies follow an ask/tell interface: ask() proposes the next
batch of points and tell() receives their results.
Run and read the results#
Each optimization is a Run. While it runs, the panel shows the best value so far and each evaluation. Every evaluation records its point, loss, metrics, status and duration; the Run ends in a Result.
Choose Apply on any successful evaluation to write its values back to the Parameters. The bound fields update and the change can be committed like any other edit.