# Optimization

Optimization — MC Grating documentation for Modal Collinear and Modal Conical and Modal Crossed and Chandezon Collinear and Chandezon Conical and Chandezon…

Canonical: https://mcgrating.com/docs/common/optimization.html


Written by Nikolay M. LyndinLast revised 2012-12-18

This documentation was written for releases up to 2018 and is being revised. Some dialogs have changed since. If something does not match what you see, write to [mc@mcgrating.com](mailto:mc@mcgrating.com).

This page contains several controls for the defining the optimization process parameters:

- ***Iterations in Trial: N Variables plus*** the number displayed in the related edit control. In accordance with the theory of the optimization method, in the ideal case of parabolic behavior of the ***[Criterion Function](https://mcgrating.com/docs/common/criterion.html)*** versus ***[Variables](https://mcgrating.com/docs/common/variable.html)***, the process converges after *N* iterations, where *N* is the number of variables. In many real cases it takes a much larger number of iterations and the efficiency of convergence is progressively decreasing. After defined number of iterations the optimization code continues the process from the achieved position and in the direction of the steepest descent.
- ***Accuracy*** defines the step for the numerical estimate of the derivative of the *Criterion Function* relative to each *Variable* and also defines the size of the multidimensional region of space around the targeted point in which the criterion function has an absolute minimum with respect to all variables. Once the above condition is satisfied, the process stops with the message “*Optimized!*”
- ***Correction Coefficient*** is simply the multiplier in the *Criterion Function*. This option is useful because the optimization procedure depends to some extent on the *Criterion Function* absolute value.
- ***Factor*** by default is the initial value of the determinant of the main Hessian matrix.
- ***Automatic Scale***. By default the same ***Accuracy*** step is applied to every variable but the dependency of the *Criterion Function* on the variables can be very different.
 If the box ***Automatic Scale*** is checked the software analyses these dependencies after an iteration cycle and continues the process with the new individual step for every *Variable* to equalize the dependencies. This action also changes the ***Correction Coefficient*** in order to maintain the ***Factor*** value around unity.
- ***Terminate*** button terminates the optimization process but the current *Variables* values can be used for the start of the next optimization.

Under the ***Mean-square Error*** label there is an information about the mean square deviation (average taken with the ***Weighting factor***) of the calculated values from the values assigned in the ***[Criterion Function](https://mcgrating.com/docs/common/criterion.html)***.

**Note 1** The ***Automatic Scale*** regime does not always provide the best convergence and in addition after the completion of the optimization the accuracy of the result is unknown. In order to fix this accuracy problem, the user will uncheck the checked box ***Automatic Scale*** and restart the optimization process.

**Note 2** Sometimes the optimization process finishes at the local extremum. The advice is to try the optimization with the new starting parameters or with other ***Accuracy*** value.

**Note 3** If the variable parameter is going to a negative value and this is in contradiction with a physical sense then an error message appears and the optimization process will be terminated.

From the in-application help of Modal Collinear and Modal Conical, documented through 2018. If you publish results computed with MC Grating, see [how to cite it](https://mcgrating.com/references.html#cite).
