JacobianCalcFrequency: Integer;
The JacobianCalcFrequency property determines frequency of calculating the Jacobian when a non-linear equation system is solved using the Newton method. The default value is one, that is, Jacobian is calculated at every iteration. The greater is the value of this parameter, the more seldom Jacobian is calculated and the faster the equation system is solved.
The method of system calculation is determined by the IMsNonLinearEquationsTransform.MethodType property: it must have the value NonLinearEquationsType.NewtonMethod. When other calculation methods are selected, the JacobianCalcFrequency property is ignored.
Executing the example requires a modeling container with the CONT_MODEL identifier and a model of the System of Non-linear Equations type with the NON_LINEAR identifier.
Sub Main;
Var
ActiveMetabase: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Descript: IMetabaseObjectDescriptor;
Obj: IMetabaseObject;
Model: IMsModel;
Eq: IMsNonLinearEquationsTransform;
Transform: IMsFormulaTransform;
Begin
ActiveMetabase := MetabaseClass.Active;
ModelCont := ActiveMetabase.ItemById("CONT_MODEL");
Descript := ActiveMetabase.ItemByIdNamespace("NON_LINEAR", ModelCont.Key);
Obj := Descript.Edit;
Model := Obj As IMsModel;
Model.TreatNullsAsZeros := True;
Transform := Model.Transform;
Eq := Transform.EquationsFormula.Method As IMsNonLinearEquationsTransform;
Eq.MethodType := NonLinearEquationsType.NewtonMethod;
Eq.DerivativeShift := 2.1;
Eq.LinearEqSolutionMethod := LinearEqSolutionType.InvMatrix;
Eq.JacobianCalcFrequency := 5;
Obj.Save;
End Sub Main;
After executing the example the Newton method is set as the solution method of non-linear equations. The following parameters are set for it:
Argument increment is 2.1.
Jacobian calculation frequency: each fifth iteration.
Method for calculating the next approximation is inverse matrix.
After that the model is saved.
See also: