IMsTargetProblem.OptimisticScenario

Syntax

OptimisticScenario: IMsScenario;

Description

The OptimisticScenario property determines optimization problem scenario.

Comments

To seta criterion problem scenario and criterion problem trajectory scenario, use the IMsTargetProblem.TargetScenario and IMsTargetProblem.TrajectoryScenario properties.

Example

Executing the example requires that the repository contains a modeling container with the MS_DEFAULT identifier containing a modelling problem with the TARGET_PROBLEM identifier. The problem should be used for web application and contain criterion function.

Add links to the Metabase and Express system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsObj: IMetabaseObject;
    Ms: IMsModelSpace;
    ScenarioTree: IMsScenarioTreeEntries;
    OptimisticScenario: IMsScenarioTreeElement;
    Scenario: IMsScenario;
    Problem: IMsProblem;
    TargetProblem: IMsTargetProblem;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get modeling container
    MsObj := mb.ItemById("MS_DEFAULT").Edit;
    Ms := MsObj As IMsModelSpace;
    // Get scenarios
    ScenarioTree := Ms.ScenarioTree;
    // Add a new scenario
    OptimisticScenario := ScenarioTree.AddScenario(FalseTrue);
    OptimisticScenario.Name := "Optimization problem scenario";
    Scenario := OptimisticScenario.Scenario;
    // Get criterion problem
    Problem := mb.ItemByIdNamespace("TARGET_PROBLEM", MsObj.Key).Edit As IMsProblem;
    TargetProblem := Problem.AdditionalDetails.Item(0As IMsTargetProblem;
    // Set optimization problem scenario
    Problem.Scenarios.AddScenario(Scenario);
    TargetProblem.OptimisticScenario := Scenario;
    // Save changes
    (Problem As IMetabaseObject).Save;
    MsObj.Save;
End Sub UserProc;

After executing the example the optimization problem scenario is set for the modeling problem.

See also:

IMsTargetProblem