| Quintiq file version 2.0 | 
| #parent: #root | 
| Method Copy ( | 
|   ScenarioManager scenariomanager, | 
|   Strategy strategy, | 
|   String name, | 
|   Number displayindex, | 
|   String description, | 
|   Boolean isvisible | 
| ) as Strategy | 
| { | 
|   Description: 'Make a copy of strategy' | 
|   TextBody: | 
|   [* | 
|     // Make a copy of the strategy | 
|     // Populate the variables with values from the passed in strategy | 
|     massscalingfactor := strategy.MassScalingFactor(); | 
|     monetaryscalingfactor := strategy.MonetaryScalingFactor(); | 
|     timescalingfactor := strategy.TimeScalingFactor(); | 
|     timeaccountscalingfactor := strategy.TimeAccountScalingFactor(); | 
|     inventoryholdingscalingfactor := strategy.InventoryHoldingScalingFactor(); | 
|     lastautoscalingrun := strategy.LastAutoScalingRun(); | 
|      | 
|     // Create new strategy with the values from the passed in strategy | 
|     newstrategy := Strategy::Create( scenariomanager, strategy, name, displayindex, description, | 
|                                      massscalingfactor, monetaryscalingfactor, timescalingfactor, timeaccountscalingfactor, inventoryholdingscalingfactor, | 
|                                      lastautoscalingrun, isvisible ); | 
|     //update newstrategy with the remaining attributes from strategy | 
|     newstrategy.Update( strategy.DefaultNumberOfPeriodsForAvgDemand(),  | 
|                         strategy.DurationLotsizeHorizon(), | 
|                         strategy.DurationInventoryMixBalancingCheck(), | 
|                         strategy.NumberOfPeriodsInWindow(), | 
|                         strategy.NumberOfPeriodsPerSlide(), | 
|                         strategy.NumberOfPeriodsSmartPlan(), | 
|                         strategy.UseSlidingWindowsApproach(),  | 
|                         strategy.MetaOptimizerFirstLevelHasOverride(),  | 
|                         strategy.MetaOptimizerFirstLevelOverride(),  | 
|                         strategy.MetaOptimizerLastLevelHasOverride(),  | 
|                         strategy.MetaOptimizerLastLevelOverride(),  | 
|                         strategy.UseMetaOptimizer(),  | 
|                         strategy.MetaOptimizerMaxNumberOfSecondsAllIterations(),  | 
|                         strategy.MetaOptimizerMinimizeInvEndAfterLastLevel(), | 
|                         strategy.MetaOptimizerRunFullPlanPriorToFocus(),  | 
|                         strategy.UseCampaignSequenceOptimizer(),  | 
|                         strategy.MaxNrOfElemementsCampaignOptimizerCombi(),  | 
|                         strategy.UseHierarchicalSolver(),  | 
|                         strategy.MetaOptimizerIsCollapseLevel(),  | 
|                         strategy.MetaOptimizerCollapseLevelWeight(),  | 
|                         strategy.UseShiftOptimization() ); | 
|                          | 
|     // Update strategy level instances. | 
|     newstrategylevel := newstrategy.FirstStrategyLevel(); | 
|     strategylevel := this.FirstStrategyLevel(); | 
|      | 
|     // Check if strategy level exists, continue to loop if exists | 
|     while( not isnull( newstrategylevel ) | 
|            and not isnull( strategylevel ) ) | 
|     { | 
|       // Update new strategy's level with data from the passed in strategy's level | 
|       newstrategylevel.Update( strategylevel.TimeLimit(), | 
|                                strategylevel.UseAbsoluteGap(), | 
|                                strategylevel.AbsoluteGap(), | 
|                                strategylevel.RelativeGap(), | 
|                                strategylevel.RelativeGoalSlack(), | 
|                                strategylevel.SolverSettingGroupName(),  | 
|                                strategylevel.UseHierarchicalSolverAbsTolerance(),  | 
|                                strategylevel.UseHierarchicalSolverRelTolerance(),  | 
|                                strategylevel.HierarchicalSolverAbsTolerance(),  | 
|                                strategylevel.HierarchicalSolverRelTolerance() ); | 
|                                 | 
|       newstrategylevel.CopyMetaScalingInfo( strategylevel );  | 
|        | 
|       // Set next strategy level to update | 
|       strategylevel := strategylevel.Next(); | 
|       newstrategylevel := newstrategylevel.Next(); | 
|     } | 
|      | 
|     return newstrategy; | 
|   *] | 
| } |