LensForge Icon

Using the optimizer

To perform an optimization:

  1. Open the Optimizer window (menu command Tools > Optimizer)
  2. Select the analyzer (merit function) that you want to apply
  3. Select the optimization method
  4. If desired, press the Options button and change the algorithm parameters
  5. Enable the desired variables (the list contains all variables that were denoted as variable in the surface editor, you can optimize with a subset)
  6. Set the scale of the variables
  7. If desired, set constraints to limit the range of the variables
  8. Press the Optimize button to start the optimization

Below is an overview of the optimizer window, indicating the various features.

optimizer overview

Optimization methods


Also known as damped least squares, the Levenberg-Marquardt method is a robust optimization algorithm for least-squares problems. This method is the traditional workhorse of lens design.

Golden Section / Nelder-Mead

Selecting this option uses the Golden Section algorithm in the case where there is only one enabled variable and otherwise uses the Nelder-Mead nonlinear simplex method. This option is provided as a complement to the Levenberg-Marquardt method. For certain merit functions, it may be faster or do a better job.

The Levenberg-Marquardt algorithm assumes that residuals may be approximated as being linear functions of the construction parameters in the neighbourhood of the optimum. If one or more residuals has a turning point near the minimum, the Nelder-Mead algorithm will be a better choice.

Variables table


This is the key path of the construction parameter (surface thickness or curvature, glass index of refraction, etc.). The keys that appear in the table are those that you have specified to be variables in the surfaces editor or the glass editor. The checkbox to the left indicates whether the parameter will be varied during the course of the optimization.


This is the present value of the parameter. You can change the value here and the change will take effect in all other windows.


The scale parameter is a hint you can give the optimizer regarding step size.

For the Levenberg-Marquardt method, the step size used to evaluate derivatives is the product of the scale parameter and 10-6.

For the Golden Section / Nelder-Mead (GSNM) method, the scale parameter is used as the initial step size.

For sensitive parameters like aspheric coefficients, you might want to reduce the scale from its default value, especially when using the GSNM method.

Minimum and Maximum

Enter values here to constrain the variable value during optimization. If you enter a minimum value smaller than the maximum value, then the value is constrained to remain in the interval (minimum,maximum): the value must satisfy

(value > minimum) AND (value < maximum)

See also