Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples...

40
Breault Research Organization, Inc. Copyright © 2006-2015 All rights reserved. 6400 East Grant Road, Suite 350, Tucson, Arizona 85715 USA www.breault.com | [email protected] 800-882-5085 USA | Canada | 1-520-721-0500 Worldwide | 1-520-721-9630 Fax ASAP TECHNICAL PUBLICATION BRO4309 (AUGUST 26, 2009) Optimization General-purpose optimization methods in ASAP This technical publication describes enhanced optimization capabilities and the process for effectively using them in the Advanced Systems Analysis Program (ASAP®) from Breault Research Organization (BRO). This publica- tion complements optimization topics in ASAP HTML Help for this release. BACKGROUND The process of optimization, or minimization, in optical system design takes a set of the system’s defining param- eters, such as surface curvatures, conics, optical properties, and so on, and systematically varies their values to reach a desired result, usually measured in terms of the distribution of energy at specified locations within the sys- tem. The system parameters that are adjusted are called variables, and the description of the desired system per- formance is referred to as the merit function. The optimal solution, called the global minimum, consists of the set of variable values that locate the system that has the smallest value for the merit function that can be attained. Most systems have a range of potential solutions called local minima. Any system can have only one global minimum. In many situations, it is not possible to de- termine that a given solution is the global minimum. However, in most instances it is only necessary to locate a solution that meets the system requirements within some specified range. ASAP provides the structure for enhanced optimization capabilities. Included in ASAP are three general-purpose optimization methods: Brent’s Method Downhill Simplex Simulated Annealing Each method is effective in finding optimal solutions for many different imaging and illumination systems. A brief description of each method is included in this section. Other sections, including “Selecting the optimization meth- od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

Transcript of Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples...

Page 1: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

A S A P T E C H N I C A L P U B L I C A T I O N

B R O 4 3 0 9 ( A U G U S T 2 6 , 2 0 0 9 )

Optimization

Genera l -purpose opt imizat ion methods in ASAP

This technical publication describes enhanced optimization capabilities and the process for effectively using them in the Advanced Systems Analysis Program (ASAP®) from Breault Research Organization (BRO). This publica-tion complements optimization topics in ASAP HTML Help for this release.

BACKGROUNDThe process of optimization, or minimization, in optical system design takes a set of the system’s defining param-eters, such as surface curvatures, conics, optical properties, and so on, and systematically varies their values to reach a desired result, usually measured in terms of the distribution of energy at specified locations within the sys-tem. The system parameters that are adjusted are called variables, and the description of the desired system per-formance is referred to as the merit function.

The optimal solution, called the global minimum, consists of the set of variable values that locate the system that has the smallest value for the merit function that can be attained. Most systems have a range of potential solutions called local minima. Any system can have only one global minimum. In many situations, it is not possible to de-termine that a given solution is the global minimum. However, in most instances it is only necessary to locate a solution that meets the system requirements within some specified range.

ASAP provides the structure for enhanced optimization capabilities. Included in ASAP are three general-purpose optimization methods:

• Brent’s Method

• Downhill Simplex

• Simulated Annealing

Each method is effective in finding optimal solutions for many different imaging and illumination systems. A brief description of each method is included in this section. Other sections, including “Selecting the optimization meth-od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

Breault Research Organization, Inc.

Copyright © 2006-2015 All rights reserved.

6400 East Grant Road, Suite 350, Tucson, Arizona 85715 USA

www.breault.com | [email protected]

800-882-5085 USA | Canada | 1-520-721-0500 Worldwide | 1-520-721-9630 Fax

Page 2: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

Brent ’s methodBrent’s method is a technique for finding the minimum value of a function in a one-dimensional solution space (that is, only one variable). This technique combines several root-finding algorithms to form a very fast and ro-bust optimization technique as long as the solution space is not discontinuous.

Downhi l l s implex methodThe Nelder-Mead method uses a simplex to find the minima of an N-dimensional function, where N is the num-ber of variables. The simplex is defined by N+1 vertex points. In two dimensions, the simplex has the form of a triangle formed on a plane. In three dimensions, the simplex is tetrahedral.

The downhill simplex method solves for the minimum solution of a continuous solution space by evaluating the function at the vertex locations and then adjusting the orientation, size or shape of the simplex based on these values. After each modification of the simplex, the merit function is reevaluated at the new vertex locations, re-sulting in a further change to the simplex. This method is useful for finding a local minimum solution for situa-tions where the merit function is smooth and continuous. Modifying the simplex near the local minimum has the potential to move the solution away from a local minimum in an attempt to find the location of a better minimum.

Simulated anneal ing methodSimulated annealing is an optimization technique that attempts to mimic the physical process of annealing ma-terials such as metals or glass. Annealing is used to form materials with improved physical properties.

Three steps in the annealing process are:

1 Heating the material to the annealing temperature,

2 Holding the material at this temperature until it is uniformly heated, and

3 Cooling the material at a predefined rate to allow for the optimal orientation of atoms and

molecules.

The optimal orientation is the distribution that requires the least energy to maintain. In applying this process to optimization, the various systems (variables and their associated values as well as the resulting merit function value) are analogous to the equivalent states of the annealing material. The merit function defines the “energy state” of a particular solution.

A control parameter—the temperature—is used to limit the acceptable range of solutions. If the temperature is relatively large, solutions that result in a higher energy state may be accepted, as they may indicate a path to a more optimal state. As the temperature is reduced, the allowed range of positive departure in the merit function is reduced and as the temperature approaches zero, only solutions resulting in a lower merit function are accept-ed.

As a local minimum is achieved, the system is perturbed to a random starting point and the process runs again, looking for a different, possibly better local minimum.

2 Optimization

Page 3: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 3

OPTIMIZATION PROCESSThese are the steps involved in setting up ASAP to perform optimization. Each step is described in detail in this section.

1 Define the system in ASAP

2 Define design variables

3 Define design objectives

4 Define objective constraints

5 Select the exit criteria

6 Select the optimization method

Def in ing the system in ASAP• Optimization can be performed on almost any ASAP INR file. Before using the file for optimization, make

sure that the file runs to completion without error. If you modify a file after you open it, the file must be saved before optimization. Changed files are indicated in ASAP Workspace by an asterisk (*) after the file name.

• The optimization takes less time if any unnecessary graphical calculations are removed or “commented out” of the script before beginning the optimization process.

• Limit the extent of the solution search by starting with a “reasonable” design. This includes making sure the design can be ray traced to the surfaces of interest with reasonable efficiency. For example, if a design goal is to maximize energy on a detector and in the baseline design, little or no energy reaches the detector, ASAP can not readily determine the effects of parameter changes on the detector energy without requiring the user to define very complex, time-consuming merit function to distinguish the actual rays reaching the surface of interest. Optimization in ASAP is a tool to help optical or illumination designers do their job. It is not intended to do the job of the designer.

• The file must include command lines identifying available design variables, objectives, and constraints using the form name=value.

After the script file is modified and saved, the optimization process can be started by selecting Optimize Script on the Optimize menu on the main menu bar. This opens the Optimization Setup Summary window, shown in

Page 4: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

Figure 1. Each tab on this window is addressed separately in this section.

Figure 1 Optimization Setup Summary window (without entries)

D E F I N I N G D E S I G N V A R I A B L E S

• Any system parameter can be used as a design variable by including a variable definition command in the INR file.

• Each variable must be defined on a separate line. Comments are allowed on variable lines or between lines of variables, but variable definitions cannot be combined on a single line with a semicolon (;).

• To add a variable to the variable list, select the text in the INR file, right-click the highlighted text, and select Define Design Variable on the shortcut menu or use the Optimize menu. Follow the same procedure to select any variables that may be used during the optimization. Variables must be defined using the form name=value. Multiple variables that are listed on sequential lines in the INR file can be selected together by pressing the Shift key while selecting the first and last listed variables.

4 Optimization

Page 5: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 5

• The name and nominal value of each selected variable is displayed on the Design Variables tab of the Optimization Setup Summary window, shown in Figure 2. To make a variable easier to identify, you can optionally assign a pseudonym to the variable in the Alias column.

Figure 2 Sample entry on the Design Variable tab

• Columns limit the range of allowed values for each variable. Brent’s method requires initial bounding of parameters. If you do not provide these as input, ASAP “guesses” at proper limits, which may possibly result in a non-optimal solution. With all optimization methods, setting reasonable bounds, based on an understanding of the system’s requirements, results in more effective optimization.

• The step size, if entered, must be a value less than the difference between the maximum and minimum values. This value is used by ASAP to help determine initial movements in variable space.

• The manufacturing tolerance is used to restrict solutions to the manufacturing limit.

Page 6: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

• The Enabled State column includes a drop-down list for including (enabling) and removing (disabling) individual variables from the optimization. You can add all potential variables to the dialog, disabling some of them until later in the optimization process. Enabling and disabling variables can be used to determine which variables are most effective for a particular design.

• The Current column lists the value currently associated with each variable.

• For further information on this tab, select Help to open the topic, “Optimization Design Variables Tab” in ASAP Help.

D E F I N I N G D E S I G N O B J E C T I V E S

Design objectives describe the goals of the design. The total of the design objects is called the merit function.

• To add a design objective, select the text in the script file for the objective, right-click the highlighted text, and select Define Design Objective on the shortcut menu or use the Optimize menu. Follow the same procedure to select other objectives that may be used during the optimization. Objectives must be defined using the form name=expression. Multiple design objectives that are listed on sequential lines in the INR file can be selected together by pressing the Shift key while selecting the first and last listed objectives. Each design objective must be defined on a separate line. Comments are allowed on variable lines, but variable definitions cannot be combined on a single line with a semicolon (;).

• The goal of the optimization is to minimize the system figure of merit, which is the squared-sum of the differences between the value of each design objective and its target value, multiplied by a weighting factor. Target values and weighting factors can be entered in the appropriate columns of the Design Objectives tab of the Optimization Setup Summary window, shown in Figure 3. Default target values are 0 and the default weighting factors are 1. Design objectives can be directly constructed in the merit function to include the effects of non-zero targets and non-uniform weighting, if desired.

• The Enabled State column includes a drop-down list for including (enabling) and removing (disabling) individual design objectives from the optimization. The current values associated with each objective are reported during the optimization, even if it is disabled, but it is not included in the calculation of the system’s figure of merit.

6 Optimization

Page 7: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 7

• For further information on this tab, select Help to open the topic, “Optimization Design Objectives Tab” in ASAP Help.

Figure 3 Sample entries on the Design Objectives tab

D E F I N I N G O B J E C T I V E C O N S T R A I N T S ( O P T I O N A L )

Objective constraints are used to force system parameter or analysis result to be within a bounded range. Objec-tive constraints are not required.

• To add an objective constraint, select the text in the script file for the objective constraint, right-click the highlighted text, and select Define Objective Constraint from the menu. Follow the same procedure to select other objective constraints that may be used during the optimization. Objective constraint must be defined using the form name=value.

• The Minimum and Maximum columns on the Objective Constraints tab of the Optimization Setup Summary window are used to set the limits for the constrained item. These values are optional. This allows for single-sided constraints, such as item value is not greater than the set maximum value, with no minimum limit. See Figure 4.

• The Enabled State column includes a drop-down list for including (enabling) and removing (disabling) individual objective constraints from the optimization.

Page 8: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

• For further information on this tab, select Help to open the topic, “Optimization Constraints Tab” in ASAP Help.

Figure 4 Sample entries on Objective Constraints tab

DEFINING AND ASSIGNING A PENALTY FUNCTION (OPTIONAL)

When a penalty function is assigned to an enabled objective constraint, ASAP applies the penalty function to the Figure of Merit during any iteration of the script in which the constraint is violated. You can define penalty func-tions before or after defining objective constraints, but a penalty function can be assigned only after an objective constraint is define. Penalty functions are entered as separate items in the ASAP script in the form name=expression.

• To define a penalty function for a constraint, select a penalty function from the script, and select Define Penalty Function from the context menu by right-clicking the Editor window, or from the Optimize menu. The selected text should contain the name of the penalty function and its value.

8 Optimization

Page 9: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 9

• To assign a penalty function to a defined objective constraint, select the name of the constraint on the Objective Constraints tab, and select a pre-defined penalty function name from the drop-down menu in the Penalty Functions column on the same row.

• To remove a penalty function from a constraint, select No Penalty Functions Assigned from the drop-down menu in the Penalty Function column on the same row as the constraint. Defined constraints can be enabled or disabled, and penalty functions can be assigned or unassigned.

TIP For a more detailed description, see the Knowledge Base for the technical publication, “Optimization - Penalty Functions, Solving constrained optimization problems”, http://www.breault.com/k-base.php?kbaseID=252.

S E L E C T I N G E X I T C R I T E R I A

During optimization, ASAP attempts to find the solution resulting in the smallest figure of merit. The result is a function of the starting parameter values as well as any limits placed on the design. In almost all instances, it is not possible to know whether the optimal solution found is a local minimum or the global minimum.

After determining the location of a minimum solution, ASAP perturbs the system to start another search of solu-tion space, and continues this process until stopped. For this reason, it is always necessary to define an exit cri-terion on the Exit Criteria tab of the Optimization Setup Summary window, which triggers ASAP to stop the

Page 10: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

optimization. See Figure 5.

Figure 5 Sample entries on the Exit Criteria tab

• The default exit criterion is a limit on the number of trials of 100. You can modify the number of trials to be any integer value greater than 0. A limit on the number of trials is always required.

• The Use Acceptance Limit option defines the maximum level for an acceptable solution. Optimization stops when a solution with a figure of merit less than the acceptance level is found.

• During optimization, ASAP may select trial solutions that result in degraded performance (higher figure of merit), since these solutions may lead to solution paths with improved performance. The Relative Divergence of Trials option triggers a termination of optimization if the solutions are diverging faster than a user-specified rate over a user-specified number of trials.

10 Optimization

Page 11: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 11

• You can specify a maximum allowed variability over a user-specified number of trials with the Use Acceptable Noise option. If the results of the specified consecutive trials are the same to within the limit, optimization is stopped.

• For further information on this tab, select Help to open the topic, “Optimization Exit Criteria Tab” in ASAP Help.

S E L E C T I N G T H E O P T I M I Z A T I O N M E T H O D

Three optimization techniques are currently available on the Optimization Method tab of the Optimization Setup Summary window. One method is used for single-variable optimization and two methods are for multi-variate optimization. Each optimization session must have a title, which is used to name the data file that is automati-cally saved to the working directory at the end of each session. The default name of the file is the name of the INR script file.

CAUTION Data files are overwritten without warning if the same name is reused.

• Brent’s Method is selected by default if there is only one defined and enabled variable. Brent’s Method excludes user-specifiable options. See Figure 6.

Figure 6 Optimization Method tab, with Brent’s Method selected as the default

Page 12: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

• The Downhill Simplex method is appropriate for systems where the merit function is smooth and continuous. Select the Advanced Options button on the Optimization Method tab of the Optimization Setup Summary window to modify the scaling parameters used to resize and reposition the simplex. See Figure 7.

Figure 7 Sample parameter entries for Downhill Simplex method

12 Optimization

Page 13: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 13

• The Simulated Annealing method is appropriate for situations when the merit function may have discontinuities or it is necessary to sample wide ranges of solution space.

• The Initial Temperature is used to establish the scale of solution space. The selection of Geometric or Power Law determines the rate of cooling of the system. At higher temperatures, a wider range of solutions are explored in an attempt to find the optimal design. As the system cools, only solutions resulting in improved figure of merit values are accepted. The block size parameter defines the rate (number of trials) at which the temperature is adjusted. No one temperature is best for all systems. A temperature of 0 results in downhill simplex optimization. See Figure 8.

Figure 8 Sample parameter entries for Simulated Annealing method

• For further information on this tab, select Help to open the topic, “Optimization Method Tab” in ASAP Help.

Opt imizat ion state f i leThe Optimization feature in ASAP includes a provision for saving the current state of the optimization in a text file referred to as an optimization state file (OSF). The OSF file can be saved anytime after the optimization has completed at least one optimization cycle. It contains information identifying design variables with values, con-straints, and any other user-specified limit; design objectives with target, weight and enabled state; objective constraints and associated penalty functions; selected exit criteria; as well as the applied optimization method with associated parameter values.

Page 14: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

The OSF file also contains information about the figure of merit for all trial systems that were identified prior to halting the optimization.

You can use a saved OSF file to re-initiate the optimization process without needing to redefine any of the opti-mization inputs. The OSF logs the current state of the merit function and optimization status, and can be auto-matically updated, saved, and read into current and subsequent optimization processes.

G E N E R A T I N G A N D S A V I N G A N O P T I M I Z A T I O N S T A T E F I L E

To generate an OSF:

1 Start with an ASAP file suitable for optimization.

2 Define all desired parameters on the Optimization Setup Summary window. These can include

both enabled as well as disabled parameters.

3 Set an exit criteria and start the optimization, using the desired optimization method.

14 Optimization

Page 15: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 15

You can generate the OSF after the optimization is halted by either reaching a natural stopping point in the op-timization (for example, after exhausting the desired trials), or when you halt it after some number of trials.

Figure 9 Saving a set of optimization trials to an Optimization State File

The option to generate the OSF file is found on the Optimize menu. To access the Optimize menu, you may need to select the name of the optimized file in the ASAP Workspace window.

4 On the Optimize menu, select Save Optimization State.

5 Select Save and accept the default name or enter the file name. By default, the file is saved in

the current ASAP working directory.

NOTE No editing can be done on the ASAP file. However, you can edit the Optimization Setup Summary window.

The OSF file contains optimization information in a structured format. This text file can be opened in any exter-nal text file editor. The initial part of the file contains the original ASAP script, followed by a listing of the status

Page 16: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

and properties of all the optimization parameters. A partial file is shown in Figure 10.

Figure 10 Sample optimization state file (*.osf)

U S I N G A N O P T I M I Z A T I O N S T A T E F I L E

To resume an optimization from a previously saved state, simply load an OSF file into ASAP. Select File, Open, and select the OSF file. The file opens in optimization mode, and the Optimization Setup Summary window is

16 Optimization

Page 17: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 17

displayed. In this state, optimization elements on the tabs (design variables, objectives, and so on) can be added or deleted, enabled or disabled.

Figure 11 Open OSF file showing initial variable values

Each of the tabs on the displayed Optimization Setup Summary window contains the parameters defined during the initial optimization setup. The nominal value for each of the design variables is changed to indicate the vari-able values for the final system evaluation of the saved optimization run. Before resuming the optimization, make any desired changes within this window, and then select Start Optimization on the Optimization Method tab. The Optimization Results window is quickly populated with stored results from prior optimizations, and then resumes the optimization according to the current state of the Optimization Setup Summary window.

O P T I M I Z A T I O N S C R I P T L I B R A R I E S

ASAP users often create libraries of commonly used command sequences for frequently performed analyses. Whenever the desired function is required, the ASAP script can be reused. Similarly, a user may develop a library of useful optimization scripts; in particular, sets of design objectives that may be commonly used. An example of this might be an extensive set of test point values for an automotive headlamp.

The OSF file is designed to allow you to generate a new OSF file outside of ASAP. It appends the information that defines the design objective or variables directly into an existing ASAP script file.

Page 18: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

NOTE If you generate an OSF externally of the ASAP optimization feature, you must follow the required format. A missing parameter (such as an uninitialized variable) is ignored by ASAP, which could result in inaccurate optimization results.

See “Examples of optimization methods” on page 19.

18 Optimization

Page 19: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 19

EXAMPLES OF OPTIMIZATION METHODS

Brent ’s method exampleBrent’s method is used for systems where there is only one variable. This form of optimization may be useful for tolerance analysis of single compensator systems and for simple optimization of surface shape. We look at the optimization to determine the appropriate parabola to form an image at a given location.

A parabolic surface is a conicoid of revolution. It is rotationally, but not spherically symmetric. The parabola can be defined in several forms. Typically, it is defined by a radius of curvature (or curvature) as well as a conic con-stant that exactly equals -1. It can also be defined as a polynomial function, as shown in Equation 1.

Equation 1

where z is the surface sag and x and y are the surface coordinates. This can be described using the GENERAL surface:

SURFACE

GENERAL 0 0 0

X2 (A)

Y2 (A)

Z 1

Page 20: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

Parabolas are used to focus incident collimated light or to collimate light incident from a small source located at the focus. See Figure 12.

Figure 12 Parabola used to focus collimated light

We demonstrate Brent’s method by finding the coefficient value for a parabola of a required focal length. The starting design is shown in Figure 13.

Figure 13 Parabola design starting point

20 Optimization

Page 21: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 21

Notice that the parabola is aiming the light towards the detector surface on the left.

1 If you modified the ASAP script file, save it, and then select Optimize Script on the Optimize

menu.

The Optimization Setup Summary window opens.

2 Select the row in the ASAP script indicating the variable, right-click the highlighted text, and

select Define Design Variable.

Notice that the surface definition references the variable identifier, shown in Figure 14.

Figure 14 ASAP script defining variable and surface

3 Set an appropriate minimum and maximum value.

For example in this case, a positive coefficient causes the light to converge towards the detector surface, so we know that the coefficient should not be negative. Design experience and intuition play an important role in set-ting up a proper optimization. See Figure 15.

Figure 15 Initial design variable and limits

Page 22: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

The design objective is to minimize the RMS spot size on the detector. The necessary ASAP script is shown in Figure 16.

Figure 16 Design objective definition in ASAP script

4 Select the row in the script that defines the term size, right-click and select Define Design

Objective, and accept the default target and weight values. See Figure 17.

Figure 17 Set design objectives

No objective constraints are necessary for this problem.

5 Accept the default of 100 trials on the Exit Criteria page.

Brent’s method is the only allowable optimization technique.

6 Change the Optimization Session Title if desired, and then select Start Optimization.

22 Optimization

Page 23: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 23

The optimization rapidly converges to the solution. In this case, the local optimum is also the global optimum. See Figure 18.

Figure 18 Optimization trial data

Page 24: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

7 Select any trial solution row and the select Save System Under Evaluation on the Optimize

menu. See Figure 19.

This step saves a copy of the optimized file using the variable value of the specified trial. The information about all of the trials is saved to the working directory.

Figure 19 Create a file, based on a selected trial solution, via the Save System Under Evaluation command on the Optimize menu

24 Optimization

Page 25: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 25

8 Select the Close button on the Optimization Setup Summary window, and run the saved file,

which is listed under the INR Input section of the ASAP Workspace. See Figure 20.

Figure 20 Optimized design output

Page 26: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

Downhi l l s implex exampleFor the downhill simplex example, assume an illumination system is desired, which maximizes the light captured on a screen at some distance. In addition to capturing most of the energy, it is desired that the illumination pattern appears uniform and square. Use of the optics to help shape the illumination pattern increases the system effi-ciency, since an aperture is not used to block valuable energy.

Begin by applying design knowledge to determine a reasonable starting point. We need a distribution that has quadrant symmetry, that takes light from a source, and spreads it out to a desired size and shape. A parabola with the source gives a diverging distribution that is rotationally symmetric. We can get the desired symmetry by ex-panding the GENERAL surface definition to include additional terms. Start with one additional coefficient beyond the parabola on the x^2*y^2 term.

SURFACE

GENERAL 0 0 0

X2 (A)

Y2 (A)

X2Y2 (B)

Z 1

In terms of the design objectives, an extended source launching a large number of rays can be used. The merit function can then target the energy in a range of pixels, as well as the differences between the energy in each pixel. Although this works, there is significant ray tracing overhead. If we consider the problem at the simplest level, we are trying to map a circle at the optic onto a square at the detector. We need to define a merit function that performs this mapping. We need to use a sufficient number of rays to define our target. Because of the sys-tem’s symmetry, we need to target rays only in one quadrant. Three rays are mapped from the edge of the circle to the edge of the square, and three are mapped from the middle of the circle to the middle of the square. See

26 Optimization

Page 27: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 27

Figure 21.

Figure 21 Mapping of source to image

These rays can be used to perform the necessary mapping. See Figure 22.

Figure 22 Source rays used to perform mapping

1 Select initial parameter values so that all rays land on the detector surface.

Page 28: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

This provides a reasonable starting point for the design. See Figure 23.

Figure 23 Starting design - one example

2 Define the design variables. See Figure 24.

Figure 24 Table of design variables

28 Optimization

Page 29: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 29

3 Define the design objectives. See Figure 25.

The FLX objective is included, but disabled, so that it can be tracked during the optimization, but it is not in-cluded in the figure of merit calculation. When using downhill simplex, try to avoid objectives that may intro-duce discontinuity into the merit function.

Figure 25 Table of design objectives

No design constraints are necessary for this example.

4 Set the exit criteria to 50 trial solutions.

5 Select the Downhill Simplex Method using the default control parameters, and select the Start

Optimization button.

Page 30: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

The optimization quickly finds an optimal region of solution space, isolates the local minimum, and proceeds through the requested number of trials. If more trials were designated, the optimizer would restart the search in a different parameter space. See Figure 26.

Figure 26 Optimization results

30 Optimization

Page 31: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 31

One of the trial solutions is saved and run to view the results. The location of the six targeted rays is shown in Figure 27.

Figure 27 Ray locations on detector

Page 32: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

Now look at the design with a more realistic extended source. See the original system in Figure 28, and see the optimized system in Figure 29.

Figure 28 Starting design—original system

Page 33: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 33

Figure 29 Optimized system

In addition to saving an individual optimized system (Save System Under Evaluation), ASAP automatically saves information and all session trials in a text file that was identified by the user-entered Optimization Session Title on the Optimization Method tab of the Optimization Setup Summary window. Variable value information from any of the trials is found in this file, and can be entered into ASAP for further analysis, or the entire file can be opened in a program such as a spreadsheet for post-processing.

Page 34: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

The Print Report option is also available on the Optimize menu. If you select this option, the Print Report dialog gives you the choice of printing the entire optimization summary or only one selected system. See Figure 30.

Figure 30 Print Report dialog to select the print range

34 Optimization

Page 35: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 35

You can also choose to print the graph of the Figure of Merit vs. Trial Solution. Printed output is shown in Figure 31 and Figure 32.

Figure 31 Print report of entire system

Figure 32 Print report of selected system

Page 36: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

Simulated anneal ing exampleSimulated annealing is often used if there are discontinuities in the solution space or if the design objectives are not smoothly varying. We are using simulated annealing to optimize the coupling efficiency of an optical fiber. In this design, the source output varies in directional space, with a donut shape. This would be similar to the out-put from a vertical cavity surface emitting laster (VCSEL). The output of the source, in direction-cosine space, is shown in Figure 33.

Figure 33 Apodized source distribution

In this optimization, we determine the appropriate surface shape, radius, and conic to optimize the coupling ef-ficiency for a specific source position. This analysis can be used to study the family of conics that can be used with this source, depending on the necessary parameters for a given simulation. Additionally, the effects of errors in the relative positions of the source and fiber can be considered.

36 Optimization

Page 37: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 37

1 Start with an ASAP INR file that has the necessary variables and design objectives defined.

2 Enter the optimization mode by selecting Optimize Script on the Optimize menu.

3 Select the desired variables and assign limiting ranges on the Design Variables tab of the

Optimization Setup Summary window. See Figure 34.

Figure 34 Table of design variables showing limit ranges

4 Select the design objectives.

5 Accept the default target and weight values. See Figure 35.

Figure 35 Table of design objectives showing default values

No design constraints are necessary.

6 Use the default exit criteria of 100 trials.

7 On the Optimization Method tab, select Simulated Annealing Method.

8 Under the control parameters, set the initial temperature to 5 and select Power Law.

Page 38: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

9 Accept the default parameter values for the power law.

10 Select the Start Optimization button. See Figure 36.

Figure 36 Sample entries for Simulated Annealing method

38 Optimization

Page 39: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

. . .

. .

Optimization 39

The optimization quickly found the region of optimal performance, but the shape of solution space provides a large number of local minima in the region. See the optimization results in Figure 37.

Figure 37 Results of optimization in solution space and tabular layout

11 Save one of the optimized trials for further analysis.

For this design, the coupling efficiency is 88%. See Figure 38.

The simulated annealing process automatically restarts after determining a local minimum has been located in an attempt to find a better solution. When this occurs, a message is sent to the Command Output window. See Figure 38.

Page 40: Optimization - Optical Software, Engineering, and Training ... · od” on page 11 and “Examples of optimization methods” on page 19 discuss using the optimization user interface.

O p t i m i z a t i o n

Figure 38 Coupling efficiency and parameters of optimized design

CONCLUSIONThe general nature of the optimization methods in ASAP makes this tool useful for optimizing a wide range of optical and illumination systems.

40 Optimization