CriterionFunctionResults: Array;
The CriterionFunctionResults property returns criterion function calculation result.
To set criterion function, use the IMsBaseOptimizationProblem.CriterionFunction property.
Executing the example requires that the repository contains a modeling container with the MS identifier containing a configured optimal control problem with the CONTROL_PROBLEM identifier.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsObj: IMetabaseObject;
Ms: IMsModelSpace;
Problem: IMsProblem;
CalcSettings: IMsProblemCalculationSettings;
Calc: IMsProblemCalculation;
ControlProblem: IMsControlProblem;
i: Integer;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modeling container
MsObj := mb.ItemById("MS").Bind;
Ms := MsObj As IMsModelSpace;
// Get optimal control problem
Problem := mb.ItemByIdNamespace("CONTROL_PROBLEM", MsObj.Key).Edit As IMsProblem;
ControlProblem := Problem.Details As IMsControlProblem;
// Create problem calculation settings
CalcSettings := Problem.CreateCalculationSettings;
// Create an object for problem calculation
Calc := Problem.Calculate(CalcSettings);
// Execute calculation
Calc.Run;
// Get calculated problem
ControlProblem := Problem.Details As IMsControlProblem;
// Display criterion function calculation result in the console window
For i := 0 To ControlProblem.CriterionFunctionResults.Length - 1 Do
Debug.WriteLine(ControlProblem.CriterionFunctionResults[i]);
End For;
End Sub UserProc;
After executing the example the console window displays criterion function calculation result in the optimal control problem.
See also: