General Commands > About General Commands > Least-Squares Objective Functions

Least-Squares Objective Functions
Least-squares objective functions are specified in terms of measured values, stored on file, together with information about how corresponding expressions can be evaluated for the current control variable values. An overview of the allowed properties is given in the table below.
In principle, you must specify the following for each measured value:
Each experiment corresponds to a solution of the forward problem with a given set of parameter values. In practice, measurements for each experiment must be stored in a separate file, and specified as a separate LeastSquares objective feature where you give the full path of the measurement data file in the filename property. Parameters specified in the paramnames property are given the values specified using paramexprs property during the forward solution. One forward solution is performed for each unique set of parameter names and values.
The required measurement data file format is row- and column-oriented. Entries on each row must be separated by commas or semicolons, while rows are separated by line feeds. Use the columtypes property to specify the content of each column, in the order that they appear in the data file, according to the following table:
Columns of type time are only allowed for transient problems. The measurements on the same row are assumed to be made at the specified time. Forward model values are interpolated to the given times. There must only be one column of type time, and it requires no further parameters.
Columns of type param contain parameter values for which the measurements on the same row have been made, and for which the forward problem must be solved. A data file can contain multiple parameter columns. Corresponding parameter names must be given in the columnnames property.
Columns of type coord contain global coordinates where the measurements on the same row have been made. The coordinate columns must be coupled to a coordinate variable by specifying the coordinate variable name in the columnnames property for the given column and the frame tag spatial, material, mesh or geometry in the columnexprs property. For example, in a 3D model, you need three columns of type coord with columnnames entries x, y, and z, respectively.
A value column contains measured data. For each value column, a corresponding expression to be evaluated must be specified in the columnexprs property. Entries in value columns are interpreted as real numbers when possible. Anything else, including for example hash marks (#) and the literal strings nan, Nan, NaN and NAN is interpreted as an illegal value which is excluded from the least squares objective function evaluation. A weight for the objective contribution from a column, multiplying the squared difference between the measured value and the expression, can be specified as a positive globally expression that can be evaluated using the columnexprsweights property. To exclude a measurement from a comma-separated file, you can also simply leave a value column empty.
Columns of type none can be used to exclude columns from the data file.
Coordinates are interpreted as global in the context of the objective feature’s selection. This means that the value column expressions are evaluated at the points within the selection that best match the given coordinates. If the interpolation fails for some point because its coordinates lie too far outside the selection, the corresponding value is ignored.