Quintiq file version 2.0 
 | 
#parent: #root 
 | 
MethodOverride InitVariablesForPostponedSalesDemands ( 
 | 
  const CapacityPlanningSuboptimizer subopt, 
 | 
  CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, 
 | 
  const LibOpt_Scope scope, 
 | 
  Number optminpostponementperiod, 
 | 
  Boolean shelflifevaronly 
 | 
) const 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    if( this.AggregatedSalesDemandInPeriod().CanBePostponed() and this.AggregatedSalesDemandInPeriod().NeedsToBePlanned() )     
 | 
    { 
 | 
      pispip := this.AsPlanningBaseSalesDemandInPeriod(); 
 | 
      nextpispip := pispip.NextPlanningPISPIP(); 
 | 
       
 | 
      for( i := 2; 
 | 
           i <= optminpostponementperiod 
 | 
           and not isnull( nextpispip ); 
 | 
           i++ 
 | 
         ) 
 | 
      { 
 | 
        nextpispip := nextpispip.NextPlanningPISPIP(); 
 | 
      } 
 | 
       
 | 
      for( i := optminpostponementperiod; 
 | 
           i <= this.MaxPostponementPeriod()                                           // within the maximum number of postponement periods 
 | 
           and not isnull( nextpispip ); 
 | 
           i++ ) 
 | 
      { 
 | 
        if( scope.Contains( nextpispip.PISPIPInOptimizerRun() ) ) 
 | 
        { 
 | 
          nextperiod := nextpispip.Period_MP();  
 | 
          // DelayedDisaggregatedSalesDemandQty variable UoM: PISP 
 | 
          // look if variable is already defined, because we also init variable for the extra shelf life pispips prior to horizon 
 | 
          var := ifexpr( shelflifevaronly, program.DelayedDisaggregatedSalesDemandQtyVariables().Find( this, nextperiod ), null(  MPVariable ) );  
 | 
          if ( isnull( var ) ) 
 | 
          { 
 | 
            var := program.DelayedDisaggregatedSalesDemandQtyVariables().New( this, nextperiod );  
 | 
            upperbound := maxvalue( 0.0, this.AggregatedSalesDemandInPeriod().GetQuantityForOptimizer( scope ) );  
 | 
            subopt.FreezeVariableUpperBound( var, upperbound ); 
 | 
          } 
 | 
           
 | 
          if ( nextpispip.ProductInStockingPoint_MP().IsOptShelfLife() )  
 | 
          { 
 | 
            traverse( nextpispip, ProductInStockingPoint_MP.IncomingShelfLifeDay, islday )  
 | 
            { 
 | 
              // look if variable is already defined, because we also init variable for the extra shelf life pispips prior to horizon 
 | 
              dvar := program.DelayedDisaggregatedSalesDemandShelfLifeQtyVariables().Find( this, nextperiod, islday );  
 | 
              if ( isnull( dvar ) )  
 | 
              { 
 | 
                program.DelayedDisaggregatedSalesDemandShelfLifeQtyVariables().New( this, nextperiod, islday );  
 | 
              } 
 | 
            } 
 | 
          } 
 | 
        } 
 | 
        nextpispip := nextpispip.NextPlanningPISPIP(); 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |