Evolutionary algorithms for the DQW example#
- Input files:
double_QW_AlGaAs.nnp
- Python scripts:
double_QW_evolution.py
This page describes the optimization of the double quantum well design using evolutionary algorithms. For a description of the physical model and device parameters, as well as setup of the problem, see the optimization of a simple nano device page.
Optimization progress#
The code below shows how to use the Evolutionary algorithms once the IO and the Metric objects are defined.
variable_boundaries = ([4.0, 4.0, 0.0, 0.0], [12.0, 12.0, 0.3, 0.3]) # nm, nm, -, -
optimizer = Evolution(
nn_io, metric, bounds=variable_boundaries, algorithm="ga", size=30, parallel_limit=4
)
optimizer.setup_plotting(objective_log_scale=True)
result = optimizer.run(gen=30, live_progress=True)
With gen=30 and size=30, the total number of evaluations is 900.
The optimization progress is shown in the figure below:
Figure 10 Live progress of the evolutionary optimization of the DQW design. The
left panel shows the objective of every candidate, the mean value in each generation,
and the best candidate found, on a logarithmic scale set by
objective_log_scale=True. The right panels show the four design
parameters over the same candidates.#
Optimization results#
The best design found by the evolutionary algorithm can be inspected with the code below:
x = result.X
print(f"Optimal: Lx_QW1 = {x[0]:.3f} nm\n"
f" Lx_QW2 = {x[1]:.3f} nm\n"
f" Al_QW1 = {x[2]:.3f}\n"
f" Al_QW2 = {x[3]:.3f}")
print(f"Objective: {result.F[0]:.4g}")
The resulting design is shown in the table below, together with the design used to generate the targets.
Design |
Objective |
|
|
|
|
|---|---|---|---|---|---|
Ideal design |
0 |
10.506 |
11.302 |
0.182 |
0.219 |
Best candidate |
0.087 |
10.597 |
11.494 |
0.176 |
0.213 |
The evolutionary algorithm recovers the ideal design with an accuracy of 0.2nm in the well widths and 0.01 in the Al fractions.
With optimizer.plot_all() you can also plot the last population of candidates in the input space to inspect the diversity of the solutions found by the evolutionary algorithm,
see the figure below:
Figure 11 The candidates from the last generation. The Pareto set in case of the single objective problem is a single champion solution.#