AdvancedOptions: MsProblemCalculationOptions;
AdvancedOptions: Prognoz.Platform.Interop.Ms.MsProblemCalculationOptions;
The AdvancedOptions property determines additional parameters of problem calculation.
This property can be used to reduce calculation time of modeling problem.
If AdvancedOptions contains the value:
MsProblemCalculationOptions.SkipOutputDataLoad. It may cause incorrect calculation of the problems, which output variables have already have data: the points, by which NAN values are unloaded, are not written to database.
MsProblemCalculationOptions.CacheCoords. Incorrect calculation of aggregation and some models on variables with slices.
Executing the example requires that the repository contains a modeling container with the MS identifier containing a modeling problem with the PROBLEM_ADV identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
ModelSpaceD: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Begin
Mb := MetabaseClass.Active;
// Get modeling container
ModelSpaceD := Mb.ItemById("MS");
// Get modeling problem
Problem := Mb.ItemByIdNamespace("PROBLEM_ADV", ModelSpaceD.Key).Bind As IMsProblem;
// Get problem calculation parameters
CalcSett := Problem.CreateCalculationSettings;
// Include the Fact scenario to calculation
CalcSett.FactIncluded := True;
// Set problem calculation periods
CalcSett.Period.IdentificationStartDate := DateTime.ComposeDay(2000, 1, 1);
CalcSett.Period.IdentificationEndDate := DateTime.ComposeDay(2004, 12, 31);
CalcSett.Period.ForecastStartDate := DateTime.ComposeDay(2005, 1, 1);
CalcSett.Period.ForecastEndDate := DateTime.ComposeDay(2007, 12, 31);
// Set additional calculation parameters
CalcSett.AdvancedOptions := MsProblemCalculationOptions.SkipOutputDataLoad Or MsProblemCalculationOptions.CacheCoords;
// Perform calculation
Problem.Calculate(CalcSett).Run;
End Sub UserProc;
After executing the example a modeling problem is calculated without loading data by output variables and with caching of data dimensions coordinates.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
ModelSpaceD: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Begin
Mb := Params.Metabase;
// Get modeling container
ModelSpaceD := Mb.ItemById["MS"];
// Get modeling problem
Problem := Mb.ItemByIdNamespace["PROBLEM_ADV", ModelSpaceD.Key].Bind() As IMsProblem;
// Get problem calculation parameters
CalcSett := Problem.CreateCalculationSettings();
// Include the Fact scenario to calculation
CalcSett.FactIncluded := True;
// Set problem calculation periods
CalcSett.Period.IdentificationStartDate := DateTime.Parse("2000/1/1");
CalcSett.Period.IdentificationEndDate := DateTime.Parse("2004/12/31");
CalcSett.Period.ForecastStartDate := DateTime.Parse("2005/1/1");
CalcSett.Period.ForecastEndDate := DateTime.Parse("2007/12/31");
// Set additional calculation parameters
CalcSett.AdvancedOptions := MsProblemCalculationOptions.mspcoSkipOutputDataLoad
Or MsProblemCalculationOptions.mspcoCacheCoords;
// Perform calculation
Problem.Calculate(CalcSett).Run();
End Sub;
See also: