Quintiq file version 2.0
#parent: #root
Method RunOptimizerGlobal () id:Method_ApplicationLibMacroPlanner_RunOptimizerGlobal
{
  #keys: '[127472.0.155604647]'
  Body:
  [*
    // runs the optimizer based on last selected options
    
    periodstart := null( Period_MP );
    periodend := null( Period_MP );
    
    run := MacroPlan.Optimization().GetLastRegularAlgorithmRun();
    issmartplan := false;
    issmartplanforperiodtask := false;
    hastotalsupplyuser := false;
    totalsupplyuser := 0.0;
    forcenoautoscaling := false; 
    smartplanpispip := null( ProductInStockingPointInPeriodPlannings );
    isupstreamsmartplan := false;
    ismiddleoutsmartplan := false;
    isonlyplanonestepupstream := false;
    ispostprocessing := false;
    strategy := AlgorithmRun::GetLastStrategyUsed( MacroPlan.GlobalParameters_MP(), run, ScenarioManager, true, false );
    AlgorithmRun::GetLastOptimizationHorizon( run, MacroPlan, periodstart, periodend );
    overwritemanual := guard( run.HasOverwrittenManualPlanning(), false );
    isusingselectedunits := false;
    units := null( Units );
    process := null( Process_MP );
    
    isinventoryoptimizationrun := false;
    
    MacroPlan.RunOptimizer( issmartplan,
                                    issmartplanforperiodtask,
                                    hastotalsupplyuser,
                                    totalsupplyuser,
                                    smartplanpispip,
                                    isupstreamsmartplan,
                                    ismiddleoutsmartplan,
                                    isonlyplanonestepupstream,
                                    ispostprocessing,
                                    forcenoautoscaling,
                                    strategy,
                                    overwritemanual,
                                    periodstart,
                                    periodend,
                                    isinventoryoptimizationrun,
                                    isusingselectedunits,
                                    units,
                                    process,
                                    MacroPlan.LastUsedOptimizerPuzzle() );
    
    Application.RemoveHistory();
  *]
}
