| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitConstraintsForPostponedSalesDemands ( | 
|   CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, | 
|   const LibOpt_Scope scope | 
| ) const | 
| { | 
|   Description: 'The constraint of fulfillment postponed sales demands to adhere to the original sales demand fulfillment.' | 
|   TextBody: | 
|   [* | 
|     // add postponement constraint for leaf sdips | 
|     traverse( scope.GetLeafSalesDemandInPeriodInRunConst(), Elements, sdip, sdip.NeedsToBePlanned() and sdip.CanBePostponed() ) | 
|     { | 
|       // Constraint: LinkedSalesDemand   | 
|       // SalesDemandQty + Sum( DelayedSalesDemandQty )  <= Quantity ∀ LeafSalesDemandInPeriod | 
|       sdip.InitConstraintsForPostponedSalesDemands( this, program, scope, 1 ); | 
|     } | 
|      | 
|     traverse( scope.GetAggregatedSalesDemandInPeriodInRunConst(), Elements, asdip, asdip.NeedsToBePlanned() and asdip.CanBePostponed() ) | 
|     { | 
|       // Constraint: SumOfDisaggregatedSalesDemand | 
|       // DisaggregatedSalesDemandQty + Sum( DelayedDisaggregatedSalesDemandQty ) + FulfilledQuantity <= Quantity ∀ AggregatedSalesDemandInPeriod | 
|       asdip.InitConstraintsForPostponedSalesDemands( this, program, scope, 1 ); | 
|     } | 
|      | 
|     // Handle sales demand before the optimization horizon, including those before the planning horizon. | 
|     traverse( scope.GetSDIPBeforeScopeInRunConst(), Elements.astype( LeafSalesDemandInPeriod ), lsdip ) | 
|     { | 
|       // Constraint: LinkedSalesDemand   | 
|       // SalesDemandQty + Sum( DelayedSalesDemandQty )  <= Quantity ∀ LeafSalesDemandInPeriod | 
|       lsdip.InitConstraintsForPostponedSalesDemands( this, program, scope, lsdip.SDIPBeforeScopeInRun().OptMinPostponementPeriod() ); | 
|     } | 
|      | 
|     traverse( scope.GetSDIPBeforeScopeInRunConst(), Elements.astype( AggregatedSalesDemandInPeriod ), asdip ) | 
|     { | 
|       // Constraint: SumOfDisaggregatedSalesDemand | 
|       // DisaggregatedSalesDemandQty + Sum( DelayedDisaggregatedSalesDemandQty ) + FulfilledQuantity <= Quantity ∀ AggregatedSalesDemandInPeriod | 
|       asdip.InitConstraintsForPostponedSalesDemands( this, program, scope, asdip.SDIPBeforeScopeInRun().OptMinPostponementPeriod() ); | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |