Quintiq file version 2.0
#parent: #root
Method PTF_TestLaunchOptimizer (
  output Real duration,
  output String response,
  String strategystr,
  String optimizerstr,
  String starttime,
  String endtime
) as Boolean id:Method_LibPTF_pnlTestRunner_PTF_TestLaunchOptimizer
{
  #keys: '[136682.0.314444061]'
  Body:
  [*
    return true; 
    /* DISABLED mjn3 
    
    issuccessful := false;
    
    // get all the relevent data to run optimizer
    // this was take out from the startprecisionctr to prevent the data retrieve take too long
    // since this test only tested on the performance of run optimizer not data retrieve
    
    strategy := select( ScenarioManager, Strategy, str, str.Name() = strategystr );
    MacroPlan.DuplicateStrategySettings( strategy, false );
    
    periodstart := null( Period_MP );
    periodend := null( Period_MP );
    
    convert := StringToDateTime::StandardConverter();
    convert.SetCustomConversion();
    convert.CustomFormatString( 'dd-MMM-yyyy' );
    
    if( convert.CanConvert( starttime ) and convert.CanConvert( endtime ) )
    {
      startdatetime := convert.Convert( starttime );
      enddatetime := convert.Convert( endtime );
      periodstart := maxselect( MacroPlan, Period_MP, p, p.Start() <= startdatetime, p.Start() );
      periodend := minselect( MacroPlan, Period_MP, p, p.End() >= enddatetime, p.End() );
    }
    
    preconditionflag := not isnull( strategy )
                        and not isnull( periodstart )
                        and not isnull( periodend ); // Your precondition before executing the action
    
    if( preconditionflag )
    {
      startprecisionctr := OS::PrecisionCounter();
      this.PTF_ExecutePreAsyncAction();
    
      isautotunecopy := false;
      hasautotunecopy := false;
      issmartplan := false;
      issmartplanforperiodtask := false;
      hastotalsupplyuser := false;
      totalsupplyuser := 0.0;
      isupstreamsmartplan := false;
      ismiddleoutsmartplan := false;
      isonlyplanonestepupstream := false;
      isforcenoautoscaling := false;
      ispostprocessing := false;
      isoverridelockedplanning := true;
      smartplanpispips := null( ProductInStockingPointInPeriodPlannings );
      isinventoryoptimization := false;
      isusingselectedunits := false;
      units := null( Units );
    
      MacroPlan.Algorithm().SynchronizeAllConstraintScaleType();
      MacroPlan.Algorithm().AlgorithmParameter().Update( issmartplan,
                                                         issmartplanforperiodtask,
                                                         hastotalsupplyuser,
                                                         totalsupplyuser,
                                                         isupstreamsmartplan,
                                                         ismiddleoutsmartplan,
                                                         isonlyplanonestepupstream,
                                                         ispostprocessing,
                                                         isforcenoautoscaling,
                                                         isoverridelockedplanning,
                                                         isinventoryoptimization,
                                                         isusingselectedunits, 
                                                         false );
    
    
      MacroPlan.UpdateParameters( isautotunecopy, hasautotunecopy,
                                  smartplanpispips,
                                  MacroPlan.StrategyMacroPlan(),
                                  ScenarioManager, 
                                  periodstart,
                                  periodend );
    
      smartplanpispip := null( ProductInStockingPointInPeriodPlannings );
      this.PTF_GetMPPTFLibrary().MacroPlan().RunCapacityPlanningAlgorithm( smartplanpispip, periodstart, periodend, units, null( Process_MP) );
      //12570
      //this.PTF_GetMPPTFLibrary().MacroPlan().RunOptimizer( strategy, param, true, periodstart, periodend,
      //                                                    true, null( Units ), true, null( ProductInStockingPoint_MPs ), false );
    
      duration   := this.PTF_GetDurationInMilisecond( startprecisionctr );
      response   := 'Launch Optimizer' ;
      issuccessful := true;
    }
    else
    {
      response := 'PTF_TestCreateData: Precondition failed because < input value not correct >'; // Your precondition failed reason
    }
    
    return issuccessful;
  *]
}
