Optimizers#
The optimizer classes in nextnano optimizers are the main interface for device optimization. Given a device design, which is defined in the nextnano input file, the optimizer tunes the input variables aiming to minimize the given objective.
Every optimization in nextnano optimizers is defined by three parts:
IO, Metric, and an optimizer.
The basic information for optimization is included in IO (the input file
with the list of input variables varied during optimization) and Metric
(the objective that will be minimized).
The optimizer defines how the optimization is carried out, namely: how the
search is initialized, which algorithm proposes the next values of the input
variables, and the allowed range in which the input variables can be varied.
Hence, each of these three objects answers one question, and together they completely define the optimization approach:
Object |
Answers |
|---|---|
|
Which input variables may change, and which output files are read |
|
How those output datafiles become one objective value |
Optimizer |
How to search for the input values that minimize that objective |
The optimizer class is created from IO and Metric and adds nothing to
the problem definition: everything about the device, the simulation and the
optimization goal is already settled by the time the optimizer is constructed.
Note that the metric is always minimized. To maximize a quantity, invert the sign of the value returned by the extraction function. If a quantity must approach some target value, the algorithm minimizes the distance between the quantity and its target value.
Each algorithm from nextnano optimizers saves the run progress in the files
Simulation_*.log, Simulation_*.json and Simulation_*.dat, which
contain one entry per evaluation. These files are stored in the output folder of the run,
which is created automatically by the optimizer.
By default this folder is created in the output directory configured in nextanopy.
For exmaple for the evolution optimizer running InfiniteWell.nnp input file, the output folder is created as follows:
your_nextnanopy_output_dir/
InfiniteWell_evolution/
Simulation_*.log
Simulation_*.json
Simulation_*.dat
figures/
progress.png
pareto.png
inputs.png
sim_00001/
sim_00002/
sim_00003/
The sim_*/ folders hold the output of the individual simulations, one per
simulation the run executed, numbered in evaluation order, starting from sim_00001. The figures/ folder appears once the run has
been plotted: plot_all() saves there by default, and a run that is never
plotted leaves no such folder behind. See Plotting the progress and results for the figures
themselves.
Three optimization approaches are available:
Class |
Search approach |
|---|---|
|
Starts from an initial point and follows a local optimization method |
|
Builds a model of the objective and uses it to choose promising candidates |
|
Searches a bounded design space using a population of candidate designs |
For more details on how to use each of these optimizers, see the pages below. Plotting works the same way for all of them and is described on its own page.