$$ \newcommand{\vb}{\mathbf} \newcommand{\wt}{\widetilde} \newcommand{\mc}{\mathcal} \newcommand{\bmc}[1]{\boldsymbol{\mathcal{#1}}} \newcommand{\sup}[1]{^{\text{#1}}} \newcommand{\pard}[2]{\frac{\partial #1}{\partial #2}} \newcommand{\VMV}[3]{ \Big\langle #1 \Big| #2 \Big| #3 \Big\rangle} $$

Design optimization with the meep adjoint solver: A reference manual


Defining your problem: Creating a subclass of OptimizationProblem

In the Overview discussion we ticked off the various data items needed to define a meep.adjoint problem. You will communicate this information to the solver by writing a python script implementing a subclass of OptimizationProblem. This is a base class implemented by meep.adjoint that knows how to do various general things involving meep geometries and objective functions, but which is lacking crucial information from you, without which it can’t do anything on its own. (That is to say, OptimizationProblem is an abstract base class coining two pure virtual methods that your derived class must override.

Mandatory and optional class-method overrides

More specifically, your subclass of OptimizationProblem must furnish implementations of the following two pure virtual methods left

Having

Evaluating your objective function

Optimizing your geometry