Quintiq file version 2.0 
 | 
#parent: #root 
 | 
MethodOverride InitConstraintsForPostponedSalesDemands ( 
 | 
  const CapacityPlanningSuboptimizer subopt, 
 | 
  CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, 
 | 
  const LibOpt_Scope scope, 
 | 
  Number optminpostponementperiod 
 | 
) const 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // const constraint UoM: PISP 
 | 
    const := program.LinkedSalesDemandConstraints().New( this ); 
 | 
    const.Sense( '<=' ); 
 | 
     
 | 
    rhs := this.GetQuantityForOptimizer( scope ); 
 | 
    issdipbeforescope := scope.Contains( this.SDIPBeforeScopeInRun() ); 
 | 
     
 | 
    // Check if the SDIP is within the optimizer horizon. The SalesDemandQty variable is only created if the SDIP is within the optimizer horizon 
 | 
    // If the SDIP is within the optimizer horizon, then add the SalesDemandQty variable, otherwise subtract the fulfilled quantity. 
 | 
    if( not issdipbeforescope ) 
 | 
    { 
 | 
      // Term UoM: PISP 
 | 
      scalefactor_SDQty_constr := subopt.ScaleConstraintTerm( typeof( MPSalesDemandQtyVariable ), typeofexpression( const ) ); 
 | 
      const.NewTerm( 1.0 * scalefactor_SDQty_constr, program.SalesDemandQtyVariables().Get( this ) ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      // Adjust RHS value if this LeafSDIP is not in the run. 
 | 
      rhs := maxvalue( rhs - this.FulfilledQuantity(), 0.0 ); 
 | 
    } 
 | 
     
 | 
    // RHS UoM: PISP 
 | 
    const.RHSValue( subopt.ScaleConstraintRHS( typeofexpression( const ), rhs ) ); 
 | 
     
 | 
    this.AddTermsForDelayedSalesDemandsForward( program, const, 1.0, scope, subopt, optminpostponementperiod ); 
 | 
  *] 
 | 
} 
 |