# How to design a singlet lens, Part 3: Optimization

This series of three articles is intended as an introduction to new users on interfacing with OpticStudio Sequential Mode. Using a singlet lens as an example, the articles walks you through the basic process of designing a lens, including building the system (Part 1), analyzing its performance (Part 2), and optimizing it for the required prescription and design constraints (Part 3).

Authored By Dan Hill

## Introduction

This is Part 3 of a series of three articles. It introduces the basic concepts of optimization, demonstrates how to set parameters as variables, shows how to use the Merit Function Wizard to assess the quality of the design, and explains how to perform the optimization itself. The article concludes with an evaluation of the final system performance.

In Part 1, we discuss how to set up the system using the System Explorer and the Lens Data Editor. In Part 2, we discuss some analyses that can be used to evaluate the system performance.

## Setting variables and constructing the default Merit Function

There are certainly limits as to how well a singlet can perform, but OpticStudio can still be used to find a better solution than the one which currently exists. In doing so, it is important to first determine how many degrees of freedom the current design has. That is, how many parameters are free to adjust? For the singlet in this exercise, one of the parameters (Surface 2 Radius), can no longer be considered a freely varying parameter since it is controlled by a solve to meet a specific design constraint. However, the center thickness of the lens (Surface 1 Thickness), the radius of curvature of the front surface (Surface 1 Radius), and the distance from the back of the lens to the image plane (Surface 2 Thickness) can all be varied in attempt to minimize the RMS spot radius of the singlet.

To allow OpticStudio to consider a parameter as a degree of freedom during optimization, a Variable solve type must be placed on the cell in the LDE which represents that parameter. You may set the solve type by clicking on the box at the right of the desired cell or by highlighting the appropriate cell and pressing <Ctrl+Z> on the keyboard. In the solve dialog which appears, select Variable as the Solve Type. The letter “V” next to the parameter is indicative of a variable in place. Place a variable solve on all three of the parameters which are free to vary during optimization.

Once the variables are set, we can now construct the default Merit Function. The Merit Function is constructed in a completely separate editor from the LDE, called the Merit Function Editor (MFE). Open the MFE by navigating to Optimize...Merit Function Editor.

The Merit Function is a numerical representation of how closely an optical system meets a specified set of goals. From within the MFE, OpticStudio uses a list of operands which individually represent different constraints or goals for the system. Once the Merit Function is complete, the optimization algorithm in OpticStudio will attempt to make the value of the Merit Function as small as possible.

Although it is possible to construct a Merit Function by hand, it is much easier to have OpticStudio construct one for you. A default Merit Function can be constructed by selecting Wizards and Operands...Optimization Wizard from the menu bar in the MFE.

Upon selecting this option, the Optimization Wizard dialog will appear, from which various options may be selected for defining a default Merit Function. Each of the options available in this dialog is discussed in detail in OpticStudio's Help System at "The Optimize Tab (sequential UI mose)...Automatic Optimization Group...Merit Function Editor (automatic optimization group)."

For the current exercise, the singlet is to be optimized for RMS Spot Radius with respect to the centroid, all of which are options already built-in to OpticStudio’s Optimization Wizard. Under Optimization Function, select Type: RMS, Criterion: Spot, and Reference: Centroid.

To prevent the singlet from becoming too thick or to thin, it is important that we set boundary constraints on the thickness of this element. Within the Optimization Wizard, we may set boundary constraints on both glass and air thicknesses in the Boundary Values section. By checking the “Glass” option, minimum, maximum, and edge thickness values can be manually typed into the appropriate entries. As was described in the system requirements, the singlet center thickness shall be no larger than 12 mm, no smaller than 2 mm, and shall have an edge thickness greater than 2 mm. Type the appropriate values into the dialog for the Min, Max, and Edge glass thickness entries.

All other parameters may be left as the default for the purposes of this exercise.

Click OK to close the dialog.

## Performing optimization

You will now notice that optimization operands have been automatically inserted into MFE. Each of these operands have a particular Target, Weight, and Value which contributes to the value of the Merit Function, located in the upper left hand corner of the MFE.

During optimization, OpticStudio attempts to lower this Merit Function value, which means the design is closer to the goal described in the Merit Function Editor.

To optimize the system, select Optimize...Optimize!. This will open the Optimization dialog box. Note that within the Optimization dialog, there are a number of different cycles to choose from. Selecting Automatic will ask OpticStudio to run the optimization routine until it has found a local minimum, a solution to the current Merit Function.

Note that OpticStudio reports both the Initial MF as well as the Current MF values. Run the optimization by pressing the Automatic button, and note the change in the Merit Function value:

Click Exit to close the Optimization dialog.

## Evaluating final system results

Now the that optimization routine is complete, we can evaluate the final design performance and ensure that all of the initial design constraints are met. Each of the previously opened analysis windows can be updated by selecting Update from the menu bar of each individual graphics window.

Ultimately, OpticStudio has optimized a singlet lens under the constraints which were given in the initial system requirements. Compared to the initial performance analysis, the RMS and Geometrical Spot radii have dropped by nearly a factor of 10! It is also important to note that OpticStudio's chosen thickness for the lens falls within the desired range, and the edge thickness is certainly greater than 2 mm; each of which meet the initial system requirements. Though the performance of the singlet is not diffraction limited, the process by which the final design was achieved can be applied to much more complex, more-desirable optical systems!

Previous Article: How to design a singlet lens, Part 2: Analysis , that explains how to visualize and evaluate the system performance.

KA-01823