Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod GetLastStrategyUsed ( 
 | 
  GlobalParameters_MP gp, 
 | 
  AlgorithmRun run, 
 | 
  ScenarioManager scenariomanager, 
 | 
  Boolean runfinite, 
 | 
  Boolean issmartplan 
 | 
) remote as Strategy 
 | 
{ 
 | 
  Description: 'Return the last strategy used. Otherwise, return the default strategy' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Strategy name priority 
 | 
    // 1- Return lastrun strategy name if there is a lastrun. 
 | 
    // 2- If there is no last run and it is a smartplan, then return the strategy name defined on the global parameter.  
 | 
    // 3- If there is no last run and it is a smartplan and global parameter name is not defined then return default name. 
 | 
    // 4- If there is no last run and it is not a smartplan then return the default name   
 | 
    globalparameter := gp; //guard( run.Algorithm_MP().MacroPlan().GlobalParameters_MP(), null( GlobalParameters_MP ) );; 
 | 
    defaultname := ifexpr( runfinite, Translations::MP_GlobalParameters_DefaultStrategyName(), Translations::MP_GlobalParameters_DefaultStrategyInfiniteName() ); 
 | 
    qpsmartplandefaultname := guard( ifexpr( globalparameter.DefaultSmartPlanStrategy().Length() > 0, globalparameter.DefaultSmartPlanStrategy(), defaultname ), defaultname );  
 | 
    name := ifexpr( issmartplan, qpsmartplandefaultname, defaultname ); 
 | 
    strategyname := guard( run.StrategyName(), name ); 
 | 
    strategy := select( scenariomanager, Strategy, strategy, strategy.Name() = strategyname ); 
 | 
     
 | 
    return strategy; 
 | 
  *] 
 | 
} 
 |