Quintiq file version 2.0
#parent: #root
Method RunInventoryOptimization (
  internal[GUIComponent] parent
) id:Method_DialogInventoryOptimization_RunInventoryOptimization
{
  #keys: '[122872.1.1871609483]'
  Body:
  [*
    result := this.DoModal( parent );
    
    if( result > 0 )
    {
      // parameters from user interface
      timelimit := GUIDurationSelectorTimeLimit.Duration();
      numberofsimulations := ApplicationLibMacroPlanner.FormatStringToNumber( EditorNumberOfSimulations.Text() );
      numberofperiodsinwindow := ApplicationLibMacroPlanner.FormatStringToNumber( EditorNumberOfPeriodsInWindow.Text() );
      isselectbestiteration := CheckBoxSelectBestIteration.Checked();
      isdeleteolditerations := CheckBoxCleanUpIterations.Checked();
      isresetsimulations := CheckBoxIsResetSimulations.Checked();
      
      // Get the last used optimizer settings. 
      run := MacroPlan.GetLastAlgorithmRun();
      strategy := SelectionStrategy.Data();
      overwritemanual := guard( run.HasOverwrittenManualPlanning(), false );
      isrunonlyoneiteration := false;
    
      
      // Call method for inventory optimization 
      MacroPlan.RunInventoryOptimization( timelimit, 
                                          isrunonlyoneiteration,
                                          isselectbestiteration,
                                          isdeleteolditerations,
                                          isresetsimulations,
                                          numberofsimulations,
                                          numberofperiodsinwindow,
                                          strategy,
                                          overwritemanual );
    }
  *]
}
