Soon, we will launch a new and updated customer portal, which is an important step toward providing our customers with one place to learn, interact, and get help.

# Individually boundary contraints

This article shows the benefits of the new Individual Boundary constraints feature:
-Demonstration of the increase of the optimization speed and improvement of the optimization results.
-How the new feature handled adding and/or deleting surfaces and negative thicknesses
-Differences in the Merit Function value

Marine Dugas
12/16/2015
Optimization
OpticStudio

# Overview

For Zemax OpticStudio 15.5 we’ve changed how the Optimization Wizard adds boundary constraints to the merit function.  In the new version, each surface receives its own set of individual constraints.  In many situations, breaking the constraints up this way can significantly reduce the time required to find an optimal solution.

# Speed Comparison

With the optimization for multi surface boundaries, in previous releases, we were applying one constraint on a range of surface with MNCA MXCA MNEA MNCG MXCG MNEG operands. In the Merit Function 6 operands were added whatever the number of surfaces in the Lens Data Editor. (12 operands if Lens Data Editor contains mirrors)

Now with the new feature each surface are constrained individually. We are using the same operands, but instead of 6 operands for the all system, now we have 6 operands for each surface of the Lens Data Editor.
What is the point of changing this? The boundaries are not calculated in the same way, with this new feature we have changed how the overall value of the Merit Function is computed which gives faster optimization and better results in many cases. Let’s see this in an example.

Attached to this article you can find the file “ Double Gauss.zar”, open this file.

This is a Double Gauss design, and we want to optimize the system with Air and Glass boundaries to get manufactural components. We will first optimize with multi surface operands, and then compare with optimization with the new feature.

When you open the Merit Function, it is already built with the old optimization method, so 6 operands for the whole system.

In the picture above, you can see that each operand are calculating for a range of surfaces, from 1 to 11. Now we can run a local optimization:

With 90 target, it takes 19 seconds to run the optimization. And we get a Merit Function around 0.37.

Now if you have a look at the RMS vs Field plot:

The maximum RMS Wavefront Error is around 1.2 waves after the optimization.

Now let’s compare with an optimization with the new feature.

Re-open the same file, but we are going to rebuild the Merit Function with the new boundary feature.

We want to perform the same optimization, so we are using the same criteria: RMS Wavefront reference to Centroid, with 4 rings and 6 arms. Boundary value are the same, the only difference is the number of operands created when the Merit Function has been built:

Now we have 6 operands for each surface! They are same operands as with the old optimization tool.

And if you are running a local optimization:

Note that initial Merit Function value has changed (as detailed later).
Optimization now takes 1.3 seconds with 150 targets.

We have more targets in the Merit Function because we have more operands, due to the new feature. And the new Merit Function is around 0.08.

We can check the RMS vs Field plot to compare results:

The maximum RMS Wavefront Error is now around 0.6 waves!

With the new feature we get a better result 15 times faster!

The new individual boundary operand feature increases and speed up optimization !

When you are adding or deleting a surface in the Lens Data Editor, the Merit Function automatically updates operands. Having 6 operands for each surface, for both Glass and Air boundaries make this update easier. If a surface switches from Air to Glass material, or Glass to Air material, you do not need to rebuild the Merit Function! It is automatically updated.
However you need to be careful with mirrors! Adding a mirror or switching a surface from mirror to not a mirror require rebuilding the merit function. As described below.

# Negative thickness

This new feature perfectly handles negative thickness introduced by mirrors. Let’s see what happens in the Merit Function. Open the second sample file “ Double Pass.zar”.

In this file we have 3 mirrors to create a double pass. The first thickness is the object distance and is positive, but the second surface is a mirror and the thickness becomes negative. The direction of propagation changes after the mirror. Once rays hit the second mirror ( surface 4), the propagation is positive again and after the third mirror the propagation change again so the thickness is negative:

Open the Optimization wizard and build the Merit Function as follows:

We are applying boundary constraints for Air and Glass and get 6 operands for each surface as shown in the previous example. But if you look at the operand, there are not all the same:

First thing to note is that the surface 0, the object, is constrained. When the object is at a finite distance, then the surface 0 will appear in the Merit Function. But if the object is at an infiny distance, we don’t need to constraint this surface. The image plane is never constrained.

Surface 0 has positive thickness so MNCA MXCA MNEA MNCG MXCG MNEG operands are used. But surfaces 1 and 2 have negative thicknesses in the Lens Data Editor so they used different operands, because targets are negative. Now in the Merit Function operands are MXCA MNCA MXEA MXCG MNCG MXEG for surfaces with a negative thickness.

# Differences in Merit Function Value

Another important difference between using “Per Surface” and multi surface boundaries lies in how the bounds are calculated.  These differences result in different values of the Merit Function and in this section we’ll explore why that is the case.
In what follows, we’ll focus on the changes that resulted from switching from MNCA with surf1 = first surface and surf2 = last surface to one MNCA constraint per surface.  I’ll refer to the first case as multi surface constraints and the second case as per-surface constraints.  The same argument applies to the other operands we’ve changed to per-surface constraints, such as MXCG etc.

The value of the multi surface MNCA operand is

Where  is the target thickness and

Then the merit function is

Where  is the weight on the MNCA operand,  is the sum of all the other merit function operands with nonzero weight and    is the weight of all the other operands. We can simplify this a bit to

Where j and k run over all surfaces.

To find the MF that results from separating the boundary constraints into per-surface MNCA operands, we let the value of the MNCA operand associated with surface  be

Then the merit function is

Which simplifies a bit to

There are several important difference between  and.  First of all, there are cross terms in the sum over  and  in  that don’t exist in :

Secondly, the  in the denominator of  is multiplied by .   Because of these differences, the same optical system will have a different merit function value depending on whether we use multi surface or per-surface bounds. The individual boundary feature makes the calculation of derivatives more efficient.

# Conclusion

This article has discussed the new individual boundary optimization feature and shows its benefits.
In this example the optimization is 15 times faster! And gives better results.