| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod Create ( | 
|   LibOpt_Run run, | 
|   RunContextForCapacityPlanning runcontext | 
| ) as RunContextMeta | 
| { | 
|   TextBody: | 
|   [* | 
|     rcm := run.RunContext( relnew, RunContextMeta );  | 
|     rcm.IsSelectorBeyondFirstIteration( false );  | 
|     rcm.OptionBaseForTried( 2 ); // estimated improve score is reduced by base^(nr tries anchor)  | 
|     rcm.OptionBaseForTriedAsFried( 4/3 ); // estimated improve score is reduced by base^(nr tried as friend)  | 
|     rcm.OptionStartBaseForPeriodDecay( 1.0 ); // initially estimated improvement scores are decay by this factor per period ( 1.0 means feature is unused , as we slowly move it to 1.0) | 
|     rcm.OptionStartBaseForPeriodDecayDecayFactor( 0.95 );  // guides the speed by which the decay factor moves to 1 per iteration ( the gap to 1 is decrease by this factor ) | 
|     rcm.OptionBaseForDecayNrTimeInScope( 0.99 ); // decay estimated improvement score by factor 0.99^{nr times in scope} on pispip | 
|     rcm.OptionMaxTriesForConstraintPISPIP( 10 );  | 
|     rcm.OptionMaxTriesForAnchor( 10 );  | 
|     rcm.OptionMaxTriedForAnchorConstruction( 1 );  | 
|     rcm.OptionMaxTriedForTargetInventory( 5 );  | 
|     rcm.OptionUseAdditonalMaxInventoryConstraint( true );  | 
|      | 
|     rcm.MaxFanExploreUpstreamLanes( Number::MaxNumber() );   | 
|     rcm.MaxFanExploreDownStreamLanes( 2 );  | 
|     rcm.MaxOperationExploreDownStream( 1 ); // for downstream select 1 random operation at pispip (when limiting to planning period tasks not applied) | 
|     rcm.OptionCheckSizeLimitDownStreamForAnchor( runcontext.GetIsStrongMIP() );  | 
|     rcm.OptionAdditionalUpstreamClosure( true );  | 
|     rcm.OptionCheckSizeLimitDebottleneckNeighborhood( runcontext.GetIsStrongMIP() );  | 
|      | 
|     rcm.OptionAddFriends( true );  | 
|     rcm.OptionCheckSizeLimitDownStreamForFriends( true );  | 
|     rcm.OptionAddDownStreamForFriends( true );  | 
|      | 
|     rcm.OptionPreNeighborhoodSizeInPeriods( 0 );  | 
|     rcm.OptionNumberOfSmartPlanPeriods( 1 );  | 
|      | 
|     rcm.OptionFixDecisionVariablesPriorToFocusLevel( false );  | 
|     rcm.OptionRunPastFocusLevel( false );  | 
|      | 
|     rcm.OptionMinimizePTQty( false ); // minimize total ptqty after focus level if focus level is not yet = last level strategy | 
|     rcm.OptionMinimizePTQtyDoInventoryBased( false ); // when set to true then in conjecution with previous 2 settings the extra cplex levels works on InvEnd variables instead | 
|     rcm.OptionMinimizePTQTYLevelRelativeGoalSlack( 0.0 ); // relative goal slack for focus level when we execute the extra level ( how much allowed to get worse. Purpose: avoid numerical infeasible) | 
|      | 
|     rcm.OptionCopyDataSetAfterFocusLevel( false );  | 
|      | 
|     rcm.OptionFixDemandSlackVar( true ); // beyond focus level 0 we fix the demand slack to the dependentdemandunfullfiled qty of the model | 
|      | 
|     rcm.OptionUseRollBack( true );  | 
|     rcm.OptionRollbackAlwaysAccept( false );  | 
|      | 
|     fulltime := 160 * 3600;  | 
|     rcm.OptionMaxNumberOfSecondsRun( fulltime );  | 
|      | 
|     rcm.OptionMaxNumberOfSecondsLevel0( fulltime );  | 
|     rcm.OptionMaxNumberOfSecondsLevel1( fulltime ); //ceil( fulltime * 0.01 ) );  | 
|     rcm.OptionMaxNumberOfSecondsLevel2( fulltime ); //ceil ( fulltime * 0.1 ) );  | 
|     rcm.OptionMaxNumberOfSecondsLevel3( fulltime ); //ceil( fulltime * 0.2 ) );  | 
|     rcm.OptionMaxNumberOfSecondsLevel4( fulltime ); //ceil( fulltime * 0.375 ) );  | 
|     rcm.OptionMaxNumberOfSecondsLevel5( fulltime );  | 
|     rcm.OptionMaxNumberOfSecondsLevel6( fulltime );  | 
|     rcm.OptionMaxNumberOfSecondsLevel7( fulltime );  | 
|     rcm.OptionMaxNumberOfSecondsLevel8( fulltime );  | 
|     rcm.OptionMaxNumberOfSecondsLevel9( fulltime );  | 
|     rcm.OptionMaxNumberOfSecondsLevel10( fulltime );  | 
|      | 
|     rcm.OptionPrecisionForRollback( -1 ); // no rounding  | 
|     rcm.OptionToleranceRollback( 0.001 ); // relative factor (or absolute in case close to 0 ) | 
|     rcm.OptionCutOffProcessMinQtyKPI( 1e-6 * run.Optimization().astype( Optimization ).MacroPlan().StrategyMacroPlan().MassScalingFactor() ); // relative factor, to ignore period tasks for process min qty KPI | 
|      | 
|     rcm.OptionCollectKappaStats( false ); | 
|     rcm.OptionMaximumError( 100 ); // shut off run beyond 100 error snapshots | 
|      | 
|     rcm.OptionConvergenceWindowSize( 20 );    | 
|      | 
|     rcm.OptionConvergenceThreshold( 0.0001 ); // if you set this to 0 it will never be considered converged on a level. Setting it smaller than   | 
|                                                  // OptionToleranceRollback may also causes non-convergence due to fluctuation | 
|                                                  | 
|     rcm.OptionCutOffForOptimal( 0.0001 ); // within optimal (in case known) by this much absolute means done | 
|     rcm.OptionCutOffForOptimalLevelZero( 0.001 ); // for scores > - 0.001 we fix decision variables on level 0 | 
|      | 
|     rcm.OptionMinimumMetaLevel( 0 );  | 
|     rcm.OptionCPLEXSkipLevelPriorToFocus( true ); // skip level prior to focus level by setting value from model as lower bound to kpi | 
|     rcm.OptionCPLEXFixModelBoundsForGoals( true ); // whether we set a bound on the goal value. If setting this to false, then not a good idea to still use the skipping (line above).  | 
|      | 
|      | 
|     //>> keep together | 
|     rcm.OptionMaxNumberOfPISPIPSForNeighborhood( ifexpr(  runcontext.UseCampaignSequenceOptimizer(), 500, 5000 ) );  | 
|     rcm.OptionMaxNumberOfPISPIPSForNeighborhoodOriginal( rcm.OptionMaxNumberOfPISPIPSForNeighborhood() ); // when entering new level snap to this max value | 
|     // << | 
|      | 
|     rcm.OptionAutoTuneNeighborhoodSize ( true );  | 
|     rcm.OptionMaxTimePerIterationSeconds( 15 );  | 
|     rcm.OptionMaxTimePerIterationSecondsOriginal( rcm.OptionMaxTimePerIterationSeconds() );  | 
|     rcm.OptionIntegralityTolerance( 0.0 ); // integrality tolerance is recommended to be set to 0 for iterative optimizer, to suppress rollbacks (but if user explicitlty sets a value that will be used instead) | 
|     rcm.OptionRelativeMIPGap( 0.001 ); // relative mip gap default for meta. Avoid long runs to time out because of needed to prove optimality (if user explicity sets a value that will be used) | 
|      | 
|     rcm.OptionDebugUsePresetAnchor( false );  | 
|      | 
|     rcm.OptionShiftPatternMaxActive( 2 ); // when doing shift optimization limit choices of other shift patterns to consider | 
|     rcm.OptionShiftPatternMaxUnits( 10 );  // when doing shift optimization limit how many unit are optimized at once  | 
|     rcm.OptionShiftPatternMaxActiveOriginal( rcm.OptionShiftPatternMaxActive() );  | 
|     rcm.OptionShiftPatternMaxUnitsOriginal( rcm.OptionShiftPatternMaxUnits() );  | 
|      | 
|     rcm.OptionDebugCPLEXVariablesConstraints( false );  | 
|     rcm.OptionDebugCopyDataSetForSaveRollback( false );  | 
|     rcm.OptionStopOnRollback( false );  | 
|     rcm.OptionStopOnInfeasible( false );  | 
|     run.Optimization().astype( Optimization ).MacroPlan().GlobalParameters_MP().DurationLotsizeHorizon( Duration::MaxDuration() ); // for now | 
|      | 
|     rcm.OptionMaxNrCampaignTypeActivePerUnit( 2 );  // max nr of new campaign type to consider (within window, see below line), per unit | 
|     rcm.OptionActiveWindowSizeCampaignOptimization( 12 ); // a random window of periods is selected of this size each iteration. Inside the window new combi options are considered | 
|     rcm.OptionUseHierarchicalCPLEXGoals( false );  | 
|      | 
|     overrridesettingsfromstrategy := false;  | 
|     if ( not overrridesettingsfromstrategy )  | 
|     { | 
|       str := run.Optimization().astype( Optimization ).MacroPlan().StrategyMacroPlan();  | 
|       rcm.OptionMinimumMetaLevel( maxvalue( 0, str.MetaOptimizerFirstLevel() ) ); | 
|       rcm.OptionMinimumMetaLevelRunFullPuzzlePrior( str.MetaOptimizerRunFullPlanPriorToFocus() );  | 
|       fulltime := str.MetaOptimizerMaxNumberOfSecondsAllIterations();  | 
|       rcm.OptionMaxNumberOfSecondsRun( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel0( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel1( fulltime );   | 
|       rcm.OptionMaxNumberOfSecondsLevel2( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel3( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel4( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel5( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel6( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel7( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel8( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel9( fulltime );  | 
|       rcm.OptionMaxNumberOfSecondsLevel10( fulltime ); | 
|       rcm.OptionUseHierarchicalCPLEXGoals( str.UseHierarchicalSolver() );  | 
|       rcm.OptionCollapseLevels( str.MetaOptimizerIsCollapseLevel() );  | 
|       rcm.OptionCollapseLevelWeight( str.MetaOptimizerCollapseLevelWeight() );  | 
|     } | 
|      | 
|     rcm.OptionBenchmarkStopThreshold( 0.999 ); // for benchmark stop at 98% of target score, set to maxreal to not use this stop criterium | 
|     rcm.OptionAllowScalingRecompute( true );  | 
|      | 
|     rcm.OptionRestrictSPcapacityWeight( 0.001 ); // weight factor for putting extra restricted SP capacity into the goal | 
|     rcm.OptionRestrictedSPCapacityEpsilon( 1e-6 ); // reduce SP capacity by (1-epsilon) for computing extra terms added to goal | 
|      | 
|     run.Optimization().astype( Optimization ).DebugMode( false );  | 
|     rcm.OptionCleanUpUnusedTripsPeriodTasksAfterwards( true ); // set to false during development to improve set up time | 
|     return rcm; | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |