ICalcLinearOptimizationBlock.StubCoefficient

Syntax

StubCoefficient: IStubSelection;

Description

The StubCoefficient property determines a data source to create criterion function coefficients.

Example

Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. A linear optimization block is created and set up in calculation algorithm.

Add links to the Algo, Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo, CalcBlock: ICalcObject;
    List: ICalcObjectsList;
    CalcAlgo: ICalcAlgorithm;
    Block: ICalcLinearOptimizationBlock;
Begin
    MB := MetabaseClass.Active;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM");
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Get list of calculation algorithm objects
    List := CalcAlgo.Items;
    // Get linear optimization block
    CalcBlock := List.Item(0);
    Block := CalcBlock As ICalcLinearOptimizationBlock;
    // View information about linear optimization block
    ShowStub(Block.StubCoefficient);
    ShowStub(Block.StubValues);
    ShowStub(Block.StubLowRestriction);
    ShowStub(Block.StubHighRestriction);
    ShowStub(Block.StubExpressionRestriction);
    ShowStub(Block.StubResult);
End Sub UserProc;

Sub ShowStub(Stub: IStubSelection);
Var
    s: String;
Begin
    s := (IsNull(Stub.Stub)? "Data source is not set." : Stub.Stub.Name + '(' + Stub.Stub.Id + ')');
    Select Case Stub.Type
        Case OptimizationStubType.Coefficient: Debug.WriteLine("Criterion function coefficients : " + s);
        Case OptimizationStubType.Values: Debug.WriteLine("Initial values of controlling variables :" + s);
        Case OptimizationStubType.LowRestriction: Debug.WriteLine("Lower limit values : " + s);
        Case OptimizationStubType.HighRestriction: Debug.WriteLine("Upper limit values : " + s);
        Case OptimizationStubType.ExpressionRestriction: Debug.WriteLine("Constraints for expressions : " + s);
        Case OptimizationStubType.ResultFunction: Debug.WriteLine("Calculation result data consumer : " + Stub.Stub.Name + '(' + Stub.Stub.Id + ')');
    End Select;
End Sub ShowStub;

After executing the example the development environment console displays information about various data sources and data consumer used in the linear optimization block.

See also:

ICalcLinearOptimizationBlock