Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SetTargets 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
     
 | 
     
 | 
    // we use 10000 as a big number to give sufficient supply in upstream locations 
 | 
    // leaf locations have target 0 to start with 
 | 
    // this is used to initiate the calculations so that after this we find suitable target to leaf locations and can be sure that we have sufficient supply in upstream 
 | 
     
 | 
    // we need to set pispip.MEIO_Target according to beloew R code  
 | 
     
 | 
    target_max := this.MEIO_Parameters().InitialLargeValueParentResupply();  
 | 
     
 | 
    // Set all targets to max value on non-leafs 
 | 
    // Set targets to 0 at leafs 
 | 
    nodes := this.GetAllTreePISP(); 
 | 
    traverse( nodes, Elements, pisp ) 
 | 
    { 
 | 
      for ( p := pisp.MEIO_Leadtime() + 1; p <= this.LastPeriodNumber(); p++ )  
 | 
      { 
 | 
        if ( pisp.MEIO_IsLeaf() )  
 | 
        { 
 | 
          pisp.GetPISPIPFromPeriodNumber( p ).MEIO_Target( 0 );  
 | 
        } 
 | 
        else 
 | 
        { 
 | 
          pisp.GetPISPIPFromPeriodNumber( p ).MEIO_Target( target_max ); 
 | 
        } 
 | 
      } 
 | 
       
 | 
      for ( p := 1; p <= pisp.MEIO_Leadtime(); p++ )  // copy from MP current value 
 | 
      { 
 | 
        pispip := pisp.GetPISPIPFromPeriodNumber( p  );  
 | 
        pispip.MEIO_Target( pispip.TargetInQuantity() ); 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |