INonLDVariables.RemoveById

Syntax

RemoveById(Id: String): Boolean;

Parameters

Id is identifier of a removed variable.

Description

The RemoveById method removes the variable from the collection by its identifier. The method returns True if the deletion was successful.

Example

Executing this example requires the Optima variable that contains system of non-linear equations and parameters for its calculation. The system of equations should include variable with the "x1" identifier.

Sub Main;

Var

Optima: NonLinearDecomposition;

PeriodL, j, i: Integer;

Vars: INonLDVariables;

Vrbl: INonLDVariable;

Res: INonLoResults;

val: Double;

Begin

// Calculating the system

PeriodL := 4;

Res := Optima.Evaluate(PeriodL) As INonLoResults;

Debug.WriteLine(Res.ErrorMsg);

// Display results

If (Res.Status = 0) Then

Vars := Optima.Variables;

For j := 0 To Vars.Count - 1 Do

Vrbl := Vars.Item(j);

Debug.WriteLine("Variable: " + Vrbl.Id);

For i := 0 To PeriodL - 1 Do

Val := Res.VarValues(Vrbl.Id)[i];

Debug.WriteLine(Val);

End For;

Debug.WriteLine("-----");

End For;

Vars.RemoveById("x1");

End If;

End Sub Main;

After executing this example a non-linear equation system is created and calculated. Calculated variables is displayed in the console window, after the x1 variable is removed from the collection.

See also:

INonLDVariables