IStatMethod.PerformanceTime

Syntax

PerformanceTime: Double;

Description

The PerformanceTime property returns method execution time.

Comments

The property contains time in milliseconds from the IStatMethod.Execute method execution start to its completion.

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    QP: SmQuadraticProgramming;
    i, Res: Integer;
    time: double;
    LinC1, CF, Lb, Ub, init: Array[
3Of Double;
    H: Array[
33Of Double;
    Bound: ISlBoundaryRegion;
    LCon1: ISlLinearConstraint;
Begin
    QP := 
New SmQuadraticProgramming.Create;
    
// Set initial approximations
    init[0] := 6; init[1] := 0; init[2] := 0;
    QP.InitialApproximation.AutoCreate := 
False;
    QP.InitialApproximation.InitValues := init;
    
// Set linear part of criterion function
    CF[0] := -1; CF[1] := 0; CF[2] := -2;
    QP.CriterionFunction := CF;
    
//Set quadratic part of criterion function
    H[00] := 2; H[01] := 0; H[02] := 0;
    H[
10] := 0; H[11] := 2; H[12] := 0;
    H[
20] := 0; H[21] := 0; H[22] := 0;
    QP.QuadraticForm := H;
    
// Set definition area
    Lb[0] := 0; Ub[0] := double.PositiveInfinity;
    Lb[
1] := 0; Ub[1] := double.PositiveInfinity;
    Lb[
2] := 0; Ub[2] := double.PositiveInfinity;
    Bound := QP.Boundary;
    
// Set area borders
    Bound.BoundaryLower := Lb;
    Bound.BoundaryUpper := Ub;
    
// Set third coefficient of linear constraint
    LinC1[0] := 1; LinC1[1] := -1; LinC1[2] := 2;
    LCon1 := QP.LinearConstraints.Add;
    LCon1.Value := LinC1;
    
// Set borders of coefficient of linear constraint
    LCon1.BoundaryLower := 6;
    LCon1.BoundaryUpper := 
6;
    
// Run calculation and output results
    Res := QP.Execute;
    time := QP.PerformanceTime / 
1000;
    Debug.WriteLine(
"Execution time[sec] = " + time.ToString);
    Debug.WriteLine(
"RES=" + Res.ToString);
    Debug.WriteLine(QP.Errors);
    
If res = 0 Then
        Debug.WriteLine(
"== Criterion function value ==");
        Debug.WriteLine(QP.OptimalFunctionValue.ToString);
        Debug.WriteLine(
"== Solution ==");
        
For i := 0 To QP.Solution.Length - 1 Do
            Debug.WriteLine(i.ToString + 
": " + QP.Solution[i].ToString);
        
End For;
    
End If;
End Sub UserProc;

After executing the example the console window displays execution time and calculation result.

See also:

IStatMethod