| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitConstraintsForOperationDependentDemandInputGroup ( | 
|   CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, | 
|   const RunContextForCapacityPlanning runcontext, | 
|   const LibOpt_Scope scope | 
| ) const | 
| { | 
|   Description: 'Initialize constraints for dependent demands which is part of an input group' | 
|   TextBody: | 
|   [* | 
|     constddqtyname := typeof( MPOperationInputGroupDependentDemandQtyConstraint );  | 
|     constuppername := typeof( MPOperationInputGroupUpperBoundConstraint ); | 
|     constlowername := typeof( MPOperationInputGroupLowerBoundConstraint ); | 
|     constrelativename := typeof( MPRelativeDurationConstraint ); | 
|      | 
|     scalefactor_periodtask_constddqty := this.ScaleConstraintTerm( typeof( MPPTQtyVariable ), constddqtyname ); | 
|     scalefactor_periodtask_constupper := this.ScaleConstraintTerm( typeof( MPPTQtyVariable ), constuppername ); | 
|     scalefactor_operationinputgroupover_constupper := this.ScaleConstraintTerm( typeof( MPOperationInputGroupOverVariable ), constuppername ); | 
|     scalefactor_periodtask_constlower := this.ScaleConstraintTerm( typeof( MPPTQtyVariable ), constlowername ); | 
|     scalefactor_operationinputgroupunder_constlower := this.ScaleConstraintTerm( typeof( MPOperationInputGroupUnderVariable ), constlowername ); | 
|     scalefactor_partialoperationdemandqty_constddqty := this.ScaleConstraintTerm( typeof( MPPartialOperationDemandQtyVariable ), constddqtyname ); | 
|     scalefactor_partialoperationdemandqty_constupper := this.ScaleConstraintTerm( typeof( MPPartialOperationDemandQtyVariable ), constuppername ); | 
|     scalefactor_partialoperationdemandqty_constlower := this.ScaleConstraintTerm( typeof( MPPartialOperationDemandQtyVariable ), constlowername ); | 
|     scalefactor_partialoperationdemandqty_constrelative := this.ScaleConstraintTerm( typeof( MPPartialOperationDemandQtyVariable ), constrelativename ); | 
|     scalefactor_operationdemandqty_constddqty := this.ScaleConstraintTerm( typeof( MPOperationDemandQtyVariable ), constddqtyname ); | 
|     scalefactor_operationdemandqty_constupper := this.ScaleConstraintTerm( typeof( MPOperationDemandQtyVariable ), constuppername ); | 
|     scalefactor_operationdemandqty_constlower := this.ScaleConstraintTerm( typeof( MPOperationDemandQtyVariable ), constlowername ); | 
|      | 
|     usingproportionalleadtimelogic := this.MacroPlan().GlobalParameters_MP().OperationLeadTimeLogic() = Translations::MP_GlobalParameter_LeadTimeLogic_Proportional() | 
|      | 
|     if ( this.GetPeriodsFromPeriodTaskOperation() )  | 
|     { | 
|       traverse( scope.GetOperationInputGroupInOptimizerRunConst(), Elements, group,  | 
|                   not exists( group, OperationInput, input, | 
|                               not input.GetIsProductInOptimizerRun( runcontext.IsPostProcessing() ) ) ) //Filter group if one or more input products are excluded | 
|         { | 
|           operation := group.Operation();  | 
|           traverse( operation, PeriodTaskOperationInScope, pto )  | 
|           { | 
|             period := pto.UnitPeriod().Period_MP();  | 
|             this.InitConstraintsForOperationDependentDemandInputGroup_Add( program,  | 
|                                                                    runcontext,  | 
|                                                                    scope,  | 
|                                                                    group,  | 
|                                                                    period,  | 
|                                                                    pto,  | 
|                                                                    scalefactor_periodtask_constddqty, | 
|                                                                    scalefactor_periodtask_constupper, | 
|                                                                    scalefactor_operationinputgroupover_constupper, | 
|                                                                    scalefactor_periodtask_constlower, | 
|                                                                    scalefactor_operationinputgroupunder_constlower, | 
|                                                                    scalefactor_partialoperationdemandqty_constddqty, | 
|                                                                    scalefactor_partialoperationdemandqty_constupper, | 
|                                                                    scalefactor_partialoperationdemandqty_constlower, | 
|                                                                    scalefactor_partialoperationdemandqty_constrelative, | 
|                                                                    scalefactor_operationdemandqty_constddqty, | 
|                                                                    scalefactor_operationdemandqty_constupper, | 
|                                                                    scalefactor_operationdemandqty_constlower, | 
|                                                                    usingproportionalleadtimelogic );  | 
|           }  | 
|         } | 
|     } | 
|     else | 
|     { | 
|       traverse( scope.GetOperationInputGroupInOptimizerRunConst(), Elements, group,  | 
|                 not exists( group, OperationInput, input, | 
|                             not input.GetIsProductInOptimizerRun( runcontext.IsPostProcessing() ) ) ) //Filter group if one or more input products are excluded | 
|       { | 
|         operation := group.Operation(); | 
|         periods := this.GetPeriodsForOperation( scope, operation ); | 
|        | 
|         traverse( periods, Elements, period ) | 
|         { | 
|           this.InitConstraintsForOperationDependentDemandInputGroup_Add( program,  | 
|                                                                          runcontext,  | 
|                                                                          scope,  | 
|                                                                          group,  | 
|                                                                          period,  | 
|                                                                          null(  PeriodTaskOperation ),  | 
|                                                                          scalefactor_periodtask_constddqty, | 
|                                                                          scalefactor_periodtask_constupper, | 
|                                                                          scalefactor_operationinputgroupover_constupper, | 
|                                                                          scalefactor_periodtask_constlower, | 
|                                                                          scalefactor_operationinputgroupunder_constlower, | 
|                                                                          scalefactor_partialoperationdemandqty_constddqty, | 
|                                                                          scalefactor_partialoperationdemandqty_constupper, | 
|                                                                          scalefactor_partialoperationdemandqty_constlower, | 
|                                                                          scalefactor_partialoperationdemandqty_constrelative, | 
|                                                                          scalefactor_operationdemandqty_constddqty, | 
|                                                                          scalefactor_operationdemandqty_constupper, | 
|                                                                          scalefactor_operationdemandqty_constlower, | 
|                                                                          usingproportionalleadtimelogic );  | 
|                                                                           | 
|         } //end traverse period  | 
|       } // end traverse group | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |