ArrangeModels(ArrangeMode: MsArrangeMode; [Problem: IMsProblem = Null]);
ArrangeModels(ArrangeMode: Prognoz.Platform.Interop.Ms.MsArrangeMode;
Problem: Prognoz.Platform.Interop.Ms.IMsProblem);
ArrangeMode. Mode of auto building a calculation chain.
Problem. The problem, by which the calculation periods of created equation system will be set. The parameter is relevant if ArrangeMode = MsArrangeMode.CreateSystems.
The ArrangeModels method automatically arranges calculation chain of models by specified parameters according to dependences between variables.
Automatic creation enables the user to find dependencies between models and create a calculation chain in accordance with these dependencies. Automatic creation ignores metamodels included into calculation chain.
Principles of automatic chain creation:
Explained model variables represent a set of Y.
The number of factors of all models includes:
Variables of the Y set.
Variables of the Y set having lags represent the Y1 set.
Variables that have no equations represent the X set.
The chain includes first X, Y1, and then Y2. Y2 models depend only on X and on Y1.
Then the Y3 set is created containing models that can be calculated based on X, Y1, Y2. The output set will be included into the chain, and so on.
If the chain includes models containing variables that depend on themselves, these models are moved to the Cycles folder.
The value of the ArrangeMode parameter influences the automatic building as follows:
ArrangeMode contains the value InsideFolders. Autobuilding is executed separately for each folder included into the chain.
ArrangeMode contains the value DeleteFolders. All models from all child folders are taken on a level, for which autobuilding is executed, and folders are removed. Thus, the chain is automatically built ignoring folders.
ArrangeMode contains the value SplitSlices. If the calculation chain includes a multivariate model containing internal cycles, or if even one of its equations forms a cycle with other model included into the chain, the multidimensional model is divided into models that correspond to the dimensions, for which the calculation method is determined. The equations that do not form cycles are placed into another multidimensional model. If the cycles are resolved by changing the order of equations in multidimensional model, a model copy is created with required order. All created models are arranged in the order of dependency. The models that form cycles are moved to the Cycle N folder, where N is a cycle sequence number. Source multidimensional models will not be changed; the created models will be named in accordance with names of source multidimensional model and saved to the folder next to this model. Folder name is generated as follows: <Source model name>(<date and time of folder creation>).
ArrangeMode does not contain the value SplitSlices. Multidimensional models containing internal cycles are moved without changes to the Cycles folder.
NOTE. If the modeling container is a child of time series database, separate use of the SplitSlices value is unavailable.
ArrangeMode contains the value CreateSystems. If the calculation chain contains linear and non-linear regression equations, determinate equation creating a cycle, they are combined into the equation system. Calculation periods of the system are taken from the modeling problem specified in the Problem parameter.
ArrangeMode contains the value NoCycles. If the calculation chain contains cycles, the models that form a cycle are retrieved from the folders corresponding to the cycles to the calculation chain instead of the folders.
Executing the example requires a modeling container with the CONT_MODEL identifier containing a metamodel with the META_ARRANGE identifier. Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ContKey: Integer;
MetaModel: IMsMetaModel;
Chain: IMsCalculationChainEntries;
Begin
mb := MetabaseClass.Active;
ContKey := mb.GetObjectKeyById("CONT_MODEL");
MetaModel := mb.ItemByIdNamespace("META_ARRANGE", ContKey).Edit As IMsMetaModel;
Chain := MetaModel.CalculationChain;
Chain.ArrangeModels(MsArrangeMode.DeleteFolders Or MsArrangeMode.SplitSlices);
(MetaModel As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the elements in calculation chain are ordered without taking into account folders, multidimensional models with cycles are divided into parts.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
ContKey: uinteger;
MetaModel: IMsMetaModel;
Chain: IMsCalculationChainEntries;
Begin
mb := Params.Metabase;
ContKey := mb.GetObjectKeyById("CONT_MODEL");
MetaModel := mb.ItemByIdNamespace["META_ARRANGE", ContKey].Edit() As IMsMetaModel;
Chain := MetaModel.CalculationChain;
Chain.ArrangeModels(MsArrangeMode.mamDeleteFolders Or MsArrangeMode.mamSplitSlices, Null);
(MetaModel As IMetabaseObject).Save();
End Sub;
See also: