| Quintiq file version 2.0 | 
| #parent: #root | 
| Method FixUserPeriodTask ( | 
|   const constcontent PeriodTaskOperations userperiodtasks, | 
|   CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program | 
| ) const | 
| { | 
|   TextBody: | 
|   [* | 
|     // Freeze the user planning period tasks | 
|     traverse( userperiodtasks, Elements, pt, pt.HasUserQuantity() )   // User quantity must be adhered by the optimizer. Optimizer cannot change the quantity planned on the period task. | 
|     { | 
|       var := program.PTQtyVariables().Find( pt.Operation(), pt.UnitPeriod().Period_MP() ); // find because in meta it may be out of scope for an iteration | 
|       if ( not isnull( var ) )  | 
|       { | 
|         var.VariableType( 'Continuous' );   // A semi-continuous variable type will still ignore the lowerbound of the variable, thus potentially setting PTQty to 0. | 
|         this.FixVariableStyleGuide( var, pt.Quantity() ); | 
|       } | 
|     } | 
|      | 
|     traverse( userperiodtasks, Elements, pt, pt.HasDependentDemandUserQuantity() )  | 
|     { | 
|       period := pt.UnitPeriod().Period_MP();  | 
|       traverse( pt, DependentDemand, dd, dd.HasUserQuantity() ) | 
|       { | 
|         pispipperiod := dd.ProductInStockingPointInPeriodPlanningLeaf().Period_MP();  | 
|         input := dd.ProcessInput().astype( OperationInput );  | 
|         if ( pt.Operation().HasLeadTime() )  | 
|         { | 
|           var := program.PartialOperationDemandQtyVariables().Get( input, pispipperiod, period );      | 
|           this.FixVariableStyleGuide( var, dd.UserQuantity() );  | 
|         } | 
|         else | 
|         { | 
|           var := program.OperationDemandQtyVariables().Get( input, period );      | 
|           this.FixVariableStyleGuide( var, dd.UserQuantity() );  | 
|         } | 
|       }  | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |