The Parameter Optimization Study
The Parameter Optimization study () node collects all settings necessary for solving parameter optimization problems. It serves the dual purpose of defining the optimization problem to be solved and choosing an optimization solver, as well as controlling important solver properties and solver output.
The complete optimization problem can be set up directly in the Parameter Optimization study node when the objective function to be minimized or maximized is a global scalar expression and the only control variables to be varied are already defined as model parameters. The study step is incompatible with the Optimization and Parameter Estimation interfaces.
When you add an Parameter Optimization study node to a study, it is always inserted as the first node, at the top of the study sequence (below any parametric sweeps). The study only works with derivative-free optimization; see About Derivative-Free Solvers for more information.
This section describes the Parameter Optimization study node available with the Optimization Module. See also Studies and Solvers in the COMSOL Multiphysics Reference Manual for more information about solvers in general. In this guide, see About the Optimization Solvers for details on the capability and settings of the individual optimization solvers.
Expressions for user-defined objective and constraint functions are evaluated in the global namespace, while the expressions for physics-defined objective and constraint expressions are evaluated in the component namespace. If there are a global parameter or function and a component variable or function with the same name (for example, par or func: root.par and compi.par, root.func, and compi.func) and a user-defined objective function or constraint with expression f(par) or func, it is evaluated as f(root.par) and root.func, while a physics-defined objective or constraint with expression f(par) or func is evaluated as f(compi.par) or compi.func. Note that the evaluation of the expressions of the user-defined objective and constraint functions in the Parameter Optimization study differs from the evaluation in Results (where the expressions are evaluated in the component namespace).
The Settings window has the following sections:
Optimization Solver
Select an optimization solver and specify its most important parameters.
Method
Choose an optimization solver method. The Method list of available solvers contains the following derivative-free methods: Nelder–Mead, BOBYQA, COBYLA, and EGO. Of these options, Nelder–Mead is the most robust, whereas EGO is good for problems with many local optima. However, both of these solvers are quite slow, particularly EGO. The fastest option is BOBYQA, but sometimes COBYLA works better if there are constraints. BOBYQA can perform better if all constraints are scaled.
It is better to use The General Optimization Study study step with a gradient-based solver if all of the following conditions are met
Of these options, Nelder–Mead is the most robust, whereas EGO is good for problems with many local optima. However, both of these solvers are quite slow, particularly EGO. The fastest option is BOBYQA, but sometimes COBYLA works better if there are constraints.
Optimality Tolerance
Specify the relative Optimality tolerance. The value is applied relative to each control variable after scaling with its corresponding specified scale.
Maximum Number of Model Evaluations
Specify the Maximum number of model evaluations. The default is 1000. This number limits the computational time, but bounding the number of model evaluations. Note that the study will throw a warning, if the solver terminates on the maximum number of model evaluations.
Solver Settings
See Solver Settings for The General Optimization Study.
Gaussian Process Function
This section is visible for the EGO solver, see Gaussian Process Function for The General Optimization Study.
Objective Function
You specify the objective function for the optimization problem in the table’s Expression column. Enter any globally available expression that evaluates to a real number. Optionally, you can add a description in the Description column. Click the Add Expression () and Replace Expression () buttons to search through a list of predefined expressions.
For an optimization objective that is expressed in terms of the solution u of a PDE, Integration (described in COMSOL Multiphysics Reference Manual) is one example of how you can define a scalar objective as required by the optimization solver. The evaluation of the objective function is similar to Global Variable Probe (described in COMSOL Multiphysics Reference Manual), so any variable that can be represented by a global variable probe is suitable as an objective.
The Evaluate for column specifies the study step for which each objective contribution will be evaluated. Available options are the last study step in the sequence plus all Study Reference nodes.
Type
Select whether to perform a Minimization or a Maximization of the objective function. The default is to minimize the objective function.
Solution
Here you select which solution or solutions to use for evaluating the objective function when several solutions are present, like for Time Dependent or Eigenvalue studies. The possible choices are Auto (the default), Use first, Use last, Sum of objectives, Minimum of objectives, and Maximum of objectives. Note that the last three options first evaluate multiple objectives according to the Multiple objectives setting for each solution individually, and then compute the sum, minimum, or maximum of the individual results. The Multiple objectives setting only appears if there are multiple objectives.
With Auto selected, the solver chooses the evaluation method based on the innermost study. For studies with parametric solutions (for example, studies in the Frequency Domain), the contributions from all solutions are summed (equivalent to the Sum of objectives option). For all other study types, the optimization solver selects the last solution, like the solution at the final time for a Time Dependent problem.
Control Parameters
The first table under Control Parameters is used to select model parameters for use as control variables. Click the Add () button to add one of the parameters defined in the Settings window for Parameters under Global Definitions to the set of control variables.
From a list in the Parameter name column, select the parameter to redefine as a control variable. Specify an Initial value for the control variables you add. The initial value is used as initial guess in the optimization solver and the objective function is explored around this point.
Use the Lower bound and Upper bound columns to add lower and upper bounds to the control variables. The Optimization solver only evaluates the objective function within these bounds. If you do not want to set bounds on a variable, leave the cell in the table empty.
The Parameter Optimization study scales the control parameters based on the bounds, so bounds have to be specified. Use the The General Optimization Study to specify scales manually.
Move control parameter rows up and down using the Move up () and Move down () buttons. To remove a control parameter, select some part of that variable’s row in the table and click the Delete button (). You can also save the definitions of the control parameters to a text file by clicking the Save to file button () and using the Save to File dialog that appears. To load a text file with control parameters, use the Load from file button () and using the Load from File dialog that appears. Data must be separated by spaces or tabs.
If you have the LiveLink™ for Excel®, you can also save and load control parameters to and from Microsoft Excel Workbook (*.xlsx) files.
Constraints
The first table under Constraints lets you specify additional constraints to be imposed on the optimum solution. The Expression column accepts any globally available expression which evaluates to a real number. Constraints can be functions of the control variables both directly and indirectly via PDE solution variables. The Lower bound and Upper bound columns can only contain parameter expressions; they must not depend on control variables, PDE solution variables, or any other user-defined variables, but can include model parameters, physical constants and units. One bound column can be left blank to indicate that no upper or lower bound is required.
If there are multiple solutions, the constraints are imposed for all them, except if the Solution setting is set to First or Last under the Objective Function section. In which case the constraints are imposed only for the solution used to evaluate the objective function.
The Evaluate for column specifies the study step for which each constraint will be evaluated. Available options are the last study step in the sequence plus all Study Reference nodes.
Output
Copy Optimized Parameters to a Parameter Case
This checkbox can be used to generate a parameter case where the optimized values of the parameters are stored.
Keep Solutions
Use the Keep solutions list to control how to store the solutions from the individual optimization solutions.
Select All to store all the optimizations solutions in memory.
Select Only last or Automatic (the default) to store only the last solution from the optimization job. If the there are Parametric Sweep study steps in an Parameter Optimization study, the default option (Automatic) will save the last solution from the optimization job and all solutions from the parametric jobs.
Plot
Select Plot and choose a Plot group to update after each major iteration of the optimization algorithm.
Probes
Select which Probes to evaluate and plot in each iteration.
Keep Objective Values in Table
Select the Keep objective values in table checkbox to retain the table containing control variable and objective function values after the solver completes. Choose an existing Output table, or select New to create a new table. After computing the study, the Output table setting will be changed to the table actually being used.
Objective values displayed on the last line of the table are the converged result of the optimization when the MMA, Levenberg–Marquardt, or IPOPT solver is used.
Select the Show individual objective values checkbox to include one table column for each contribution to the objective. Otherwise, only the total objective is displayed.
Select the Table graph checkbox to plot the objective function values displayed in the objective table. Choose an existing Plot window, including the standard Graphics window, or select New window. After computing the study, the Plot window setting will be changed to the window actually being used.
Keep Constraint Values in Table
Only available for derivative-free methods. Select the Keep constraint values in table checkbox to retain the table containing global constraint values after the solver completes. Choose an existing Constraint table, or select New to create a new table. After computing the study, the Constraint table setting will be changed to the table actually being used.