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#

  1. Create Parameters for the dimensions you want to tune and bind fields to them.
  2. Mark those Parameters as design variables and give them bounds.

Define a Study#

A Study has:

PartWhat it is
ObjectiveA 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.
DirectionMinimize or maximize
StrategyThe search method, see below
BudgetHow many evaluations, or iterations for gradient methods
VariablesAll 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#

StrategyUse it when
gradientThe objective is differentiable end to end, for example a differentiable solver. Each gradient step is one evaluation.
sweepYou want a regular grid over one or two variables.
custom_sweepYou have a list of specific points to try.
monte_carloYou want random samples to explore the space or estimate spread.
geneticThe objective is noisy or has many local minima.
psoParticle swarm; a robust black-box choice for a few to tens of variables.
bayesianEach 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.