Quintiq file version 2.0
|
#parent: #root
|
Method InitializeOptimizerRun (
|
Boolean issmartplan,
|
Boolean issmartplanforperiodtask,
|
Boolean hastotalsupplyuser,
|
Real totalsupplyuser,
|
ProductInStockingPointInPeriodPlannings smartplanpispips,
|
Boolean isupstreamsmartplan,
|
Boolean ismiddleoutsmartplan,
|
Boolean isonlyplanonestepupstream,
|
Boolean ispostprocessing,
|
Boolean isforcenoautoscaling,
|
Strategy strategy,
|
Boolean isoverridemanualplanning,
|
Period_MP periodstart,
|
Period_MP periodend,
|
Boolean isinventoryoptimizationrun,
|
Boolean isusingselectedunits,
|
Units units,
|
Process_MP process,
|
OptimizerPuzzle optimizerpuzzle
|
) as AlgorithmRun
|
{
|
Description: 'Copy the setting from scenario manager and run the optimizer asynchronous. Make selection meta or regular based on attribute.'
|
TextBody:
|
[*
|
//copy strategy setting to globalparameter
|
if ( not isnull( strategy ) ) // calling with null( Strategy ) means re-using existing StrategyMacroPlan
|
{
|
this.DuplicateStrategySettings( strategy, false );
|
if ( not isnull( strategy.ScenarioManager() ) ) // for LibOpt_BT we use a workaround of creating some dummy strategy so we can query for KPIs stored on the snapshots
|
{
|
strategy.ScenarioManager().ActiveStrategy( relset, strategy );
|
}
|
}
|
|
// Change lastUsedOptimizer OptimizerPuzzle
|
if( not isnull( optimizerpuzzle ) )
|
{
|
optimizerpuzzle.ChangeLastUsedOptimizerPuzzle();
|
}
|
|
// Clean up data, remove the redundant data in the dataset.
|
this.RemoveUnusedInstancesBeforeOptimizerRun();
|
|
runsync := this.GlobalParameters_MP().RunSmartPlanSynchronously() and issmartplan;
|
// Set the optimizer status to running
|
if ( not runsync )
|
{
|
runningsync := true;
|
sm := Util::GetScenarioManagerStream();
|
sm->UpdateScenarioOptimizerStatus( this.MDSID(),
|
Translations::MP_GlobalParameters_GetOptimizerRunningStatus(),
|
ifexpr( runningsync, '', Translations::MP_GlobalParameters_GetOptimizerRunningLevel(1, counter( strategy, StrategyLevel, strategyLevel, strategyLevel.KPIWeight( relsize ) > 0 ) ) ), //When running synchronously, it is not possible to update the levels running.
|
"" );
|
}
|
|
// Update the algorithm parameters
|
this.GetAlgorithmParameter().Update( issmartplan,
|
issmartplanforperiodtask,
|
hastotalsupplyuser,
|
totalsupplyuser,
|
isupstreamsmartplan,
|
ismiddleoutsmartplan,
|
isonlyplanonestepupstream,
|
ispostprocessing,
|
isforcenoautoscaling,
|
isoverridemanualplanning,
|
isinventoryoptimizationrun,
|
isusingselectedunits,
|
runsync );
|
|
// Set the optimizer settings and parameters
|
algrun := this.UpdateParameters( smartplanpispips,
|
this.StrategyMacroPlan(),
|
periodstart,
|
periodend );
|
|
|
if ( isnull( periodstart ) or isnull( periodend ) )
|
{
|
AlgorithmRun::GetLastOptimizationHorizon( algrun, this, periodstart, periodend );
|
}
|
return algrun;
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|