Optimization items management#

Optimizations#

The Optimizations command allows to build interactively input files for the Zopt module (see the Zmat user manual for a complete reference on this program). An optimization item is based on a comparison between a simulation item and an experiment item, to fit the simulation to the experiment by adjusting simulation variables.

Note that optimization procedures defined can be launched either from this dialog, or from the Variables Panel dialog.

Optimizations management dialog#

The main dialog is shown in the following figure. The selection tree allows to select Optimization items to apply appropriate commands on.

../_images/opt.svg

Add opt command#

This command may be used to create a new optimization item in the database by opening the Add/Mod optimization dialog (see add_opt).

Mod opt command#

This command edits the selected optimization item. By hitting the Mod opt command, the user opens the Add/Mod optimization dialog that allows to change the definition of the item (see add_opt).

Fuse opt command#

This command allows to paste the comparisons between experimental and simulation results that define the different optimization items selected. By fusing the selected optimization items, the user will create a new optimization item containing all the comparisons. Note that a simple copy is obtained if a single optimization item is selected.

Del opt command#

This command deletes from the database all the optimization items selected in the Optimization items selection tree.

Run command#

This command launches the optimization selected in the Optimization items selection tree using the Zopt module. The optimization runs in a separate execution thread and can be stopped at any moment using the Stop command. When the optimization terminates, either because of convergence or by activation of the Stop command, a window is opened showing the best values found by the optimizer, as shown in the next figure.

../_images/setfromopt.svg

The Go button must be clicked if the user does want to update the Variables database with the optimized values. Otherwise, values are left unchanged.

Stop command#

This command stops the optimization that is currently running in a separate thread. As described above, a window is popup, that proposes to update the Variables database with the best values found until the Stop command was hit.

Plot cost command#

This command plots the evolution of the cost function associated with comparisons between experimental and simulation results during optimization iterations. The command can be activated to check the convergence while the optimizer is currently running.

../_images/cost.svg

Plot comp#

This command draws comparisons between experimental and simulation results that define the optimization item selected. The command can be activated when the optimizer is running to visualize the current distance between experimental and simulation curves.

../_images/gap.svg

Plot sim#

This command draws all plots attached to the simulations involved in the selected optimization.

Plot var#

This command plots the evolution of the variables activated by the currently selected optimization item.

../_images/varevol.svg

Cancel command#

This command closes the Optimizations management dialog without further modification to the database.

Add/Mod Optimization dialog#

Optimization items are created or modified by means of the Add/Mod optimization dialog shown in the next figure.

../_images/optdef.svg

The following sub-items can be modified :

  • The name of the Optimization item defined in the Name textfield. A default name is given at creation, that should be modified to something more meaningful to the user.

  • The optimization method that can be selected by means of the combo box at the top of the dialog. The following methods are available (see the Optimization Chapter of the Zmat manual for a complete reference) :

    • Levenberg-Marquardt : gradient-driven algorithm, particularly suitable to the minimization of least-squares type cost functions. This algorithm does not support optimization constraint.

    • Nelder-Mead : heuristic method that does not need gradient computation. The implementation supports optimization constraints and may be preferred to Levenberg-Marquardt when gradients calculated by perturbation are too imprecise or too costly to compute. Convergence may be slow however when the number of variables is increased.

    • Augmented-Lagrangian : this classic gradient-driven method should be used instead of Levenberg-Marquardt when optimization constraints are needed.

    • Evolution : a genetic algorithm implementation, that can be preferred to the previous methods to escape local optima. Note however that activating this method largely increases the number of iterations needed for convergence.

    • Single : a tool that performs a single optimization iteration, and is provided to verify the validity of input data.

  • A list of comparison items (between experimental and simulation results), managed by means of the Comparison items selection box, and its associated commands.

  • A list of optimization constraints managed by means of the Constraint items selection box, and its associated commands.

The following sub-commands can be activated from this dialog.

Add comp command#

This command opens the Add/Mod comparison dialog (see Optimizations/Add comp) to add a new comparison item in the definition of the optimization problem.

Mod comp command#

This command edits the comparison item selected in the Comparison items selection box and opens the Add/Mod comparison dialog (see Optimizations/Add comp) for modification.

Del comp command#

This command removes all the comparison items selected from the definition of the optimization problem.

Add const command#

This command opens the Add/Mod constraint dialog (see Optimizations/Add const) to add a new constraint item in the definition of the optimization problem.

Mod const command#

This command edits the constraint item selected in the Constraint items selection box and opens the Add/Mod constraint dialog (see Optimizations/Add const) for modification.

Del const command#

This command removes all the constraint items selected from the definition of the optimization problem.

Go command#

This command updates the database with the optimization item informations included in the dialog.

Edit inp command#

This command opens the Zopt input file generated automatically by the application from the informations defined in the dialog. The various convergence parameters allowed by the optimization method selected should be changed directly in the input file under the ***convergence section. Default values are provided that may be adequate in the majority of cases, so this operation is seldom needed. The Optimization chapter of the Zmat manual describes the parameters available to finely tune the optimization algorithm. Note that other sections of the input file are automatically regenerated each time the optimization item is updated with the Go command, so there is no use to manually modify the commands included in those sections.

Plot comp command#

This command plots all the comparison items selected in the Comparison items selection box.

Cancel#

This command closes the Add/Mod optimization dialog without further modification to the database.

Add/Mod Comparison dialog#

This dialog allows to add or modify a new comparison item in the definition of the optimization problem. A comparison item is built from two curves corresponding respectively to the experimental data and the simulation results. The least-square distance between those two curves is added to the cost function of the optimization problem.

The next figure shows the sub-items manipulated by this dialog.

../_images/defcomp.svg

The following sub-items can be modified :

  • The Weight textfield may be used to modify the influence of the current comparison among all the comparisons of the selected optimization. Default value is 1. Filling the Weight textfield with a value greater than the default value will also increase the weight of the current comparison in the global cost function minimized by the optimizer.

  • The active checkbox allows to deactivate the comparison without having to remove it from the definition of the optimization problem by the Del comp command (default value is active).

  • The comparison method can be selected by means of the combo box. The following methods are available (see the Optimization Chapter of the Zmat manual for a complete reference) :

    • t_file_file : standard comparison method with a time-weighted averaging.

    • g_file_file : generalized-file-file method, based on point densities, where the user has to consider the distribution of comparison points in order to control the quality of error estimation.

    • weight_file_file : comparison method especially adapted to the Set weights command. This method takes into account the weights locally assigned to points by user, so weight_file_file must be selected to activate the Set weights command.

    • scatter_file_file : comparison method adapted to the particular cases for which experimental data have several points defined by the same abscissa.

The selection tree on the left is used to select the simulation item (within the ones defined beforehand by means of the Simulations command ) used to generate the simulation curve. Selecting a simulation item has the effect to fill the two combo boxes at the bottom of the dialog with the names of the output components selected for this particular simulation (see Simulations/Define Output). A particular component must then be chosen for the X and Y values by means of these combo boxes to complete the definition of the simulation curve.

The selection tree on the right is used to select the experiment item (within the ones defined beforehand by means of the Experiments command) that defines the experimental curve.
The following sub-commands may be activated from the dialog.

Go command#

This command updates the comparison item in the definition of the optimization problem with the informations included in the dialog.

Plot command#

This command draws on the same plot the experimental and simulation curves used to build the comparison item. The use of this command is strongly recommended to verify the validity of the comparison. Note however that the simulation should have been launched once beforehand for the corresponding simulation curve to be plotted.

../_images/plotcomp.svg

Set weights command#

This command opens the Set point weights dialog that allows to assign to each point of the simulation curve a specific weight taken into account by the weight_file_file comparison method.
The next figure shows an example using the Set point weights dialog. The comparison curve is plotted on the left of the graphics area, and the weight curve on the right.
../_images/setweights2.svg

In the Set points weights dialog the following sub-items can be modified :

  • The Weight textfield may be used to define the weight value assigned to the current point selection. Default value is 1.

  • The Precision textfield defines the precision the points of the weight curve will be selected with. Default value is \(10^{-8}\).

  • Two modes of selection are allowed, the particular type chosen being specified by means of the checkbox included in the dialog.

    • Between two points mode adds to the current point selection all the points located between the two selected points. This mode may be used to assign specific weight values to some regions of the comparison curve.

    • Point by point mode adds the particular selected point to the current point selection. This mode may be used to assign specific weight values to some critical points.

The following sub-commands may be activated from this dialog.

  • The Go button updates the weight of the current point selection with the value given in the weight textfield.

  • The Start button must be clicked to initialize the point selection, using the Between two points or Point by point selection mode. Points can then be added to the current point selection by clicking either on the comparison curve on the left or on the weight curve on the right of the graphics area.

  • The Stop button must be clicked to close the point selection, using the Between two points or Point by point selection mode.

  • The Reset button updates the considered comparison item in the definition of the optimization problem with the default values.

  • The Cancel button closes the Set point weights dialog without further modification to the database.

Cancel command#

This command closes the Add/Mod comparison dialog without further modification to the database.

Add/Mod Constraint dialog#

This dialog is used to create or modify optimization constraints. Constrained optimization problems have the following general form :

(516)#\[\begin{split}\begin{aligned} \text{Find } &x_i^* \text{ such that}: & \\ & F(x_i^*)=\min F(x_i), &i = 1, \dots, n_o \text{ the number of optimization variables}\\ & g_j(x_i^*)\leq0, \quad &j = 1, \dots, n_c \text{ the number of optimization constraints} \end{aligned}\end{split}\]

Note that only inequality constraints \(g_j(x_i) \leq 0\) are currently supported. In this framework, two types of constraints may be defined :

  • Variable Constraints defined as functions of the optimization variables ;

  • Comparison Constraints that can be used to specify that the simulation response should correspond exactly to the experimental curve at some critical points.

The dialog is illustrated in the following figure.

../_images/defconst1.svg

A name can be assigned to the constraint item in the Name textfield, while the lambda0 textfield is used to specify the initial value of the Lagrange multiplier (or penalization para-meter) assigned to the constraint (default value is 1.0).

Other parameters depend on the type of constraint selected, specified by means of the checkbox on the right of the dialog :

  • Variables Constraints

    The function \(g_j(x_i)\) of the optimization variables \(x_i\) should be defined in the Constraint (variable) textfield. Most mathematical functions of the libc library are allowed in the definition.

    Example

    For a behavior with two nonlinear kinematic hardenings defined by parameters (C1,D1) and (C2,D2), one may use a constraint to specify that the saturation rate of the first mechanism (parameter D1) should be ten times higher than the second one (parameter D2). Two Variable constraints are necessary to enforce such an equality constraint :

    10.0*D2 - D1
    D1 - 10.0*D2
    
  • Comparison Constraints

    Definition of such constraints is based upon comparison items described in the previous section (see Optimizations/Add comp). All comparisons added beforehand in the definition of the optimization problem are included in the dialog selection box, where the user can choose the particular item needed. The point for which the experimental and numerical response should be equal is specified by entering the corresponding coordinate along the X axis in the X (comparison) textfield. Note that deactivated comparisons (by means of the active checkfield as described at comp:active) are allowed in the definition.

    The Grab button plots the comparison curves in the graphics area, where the constraint X coordinate can then be defined by a simple click on the region of interest. This mode can be closed by hitting the Stop grab button.

    Example

    The dialog shown in the next figure illustrates the definition of such a comparison constraint.

../_images/defconst2.svg

The following sub-commands may be activated from this dialog.

Go command#

This command updates the constraint item in the definition of the optimization problem with the informations included in the dialog.

Plot command#

This command plots in the graphics area the curve of the selected comparison item.

Cancel command#

This command closes the Add/Mod Constraint dialog without further modification to the database.