| Quintiq file version 2.0 | 
| #parent: #root | 
| Method CapacityPlanningAlgorithmHandleFeasibleShiftPattern ( | 
|   CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, | 
|   const RunContextForCapacityPlanning runcontext, | 
|   LibOpt_Scope scope | 
| ) | 
| { | 
|   Description: 'Update or create unit availabilities depending on the assigned shift pattern.' | 
|   TextBody: | 
|   [* | 
|     if( runcontext.UseShiftOptimization() ) | 
|     { | 
|       // Iterate on every unit and then on every unitperiod in scope. | 
|       traverse( scope.GetUnitInOptimizerRun(), Elements, parentunit, parentunit.GetUseShiftOptimization() ) | 
|       { | 
|         traverse( parentunit.GetUnitForShiftOptimization(), Elements, unit ) | 
|         { | 
|           traverse( unit, UnitPeriod.astype(UnitPeriodTime), up, up.IsInScopeForShiftOptimization( scope ) )  | 
|           {  | 
|             traverse( unit, UnitShiftPatternAllowed.ShiftPattern, sp ) | 
|             { | 
|               // Look for the shift pattern choosen by the optimizer for this unit period. | 
|               shiftpatternisused := this.GetOptimalValue( program.ShiftPatternIsUsedVariables().Get( sp, up ) ) > 0.5; | 
|                | 
|               if( shiftpatternisused )  | 
|               { | 
|                 //We set a temporary shift pattern during meta optimizer processing for efficiency (meta iterations). Component OptimizerPrePostProcessing transfers the value  | 
|                 //over to regular planning using unit availability | 
|                 up.SetTemporaryOptimizerShiftPattern( sp.Name() );  | 
|               } | 
|             } | 
|           } | 
|         } | 
|       } | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |