Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method CheckOptimizerPuzzle ( 
 | 
  LibOpt_Task task 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    if ( this.DebugMode() )  
 | 
    { 
 | 
      debuginfo( '=== Start checking optimizer sub puzzle ===' );  
 | 
      macroplan := this.MacroPlan();  
 | 
      EPSILON := 1e-6;  
 | 
      traverse( macroplan, Unit, unit, not unit.IsInOptimizerPuzzle() )  
 | 
      { 
 | 
        traverse( unit, UnitPeriod, up )  
 | 
        { 
 | 
          diffup := up.DebugSubPuzzleQuantityToProcessPrior() - up.QuantityToProcess();   
 | 
          if ( abs ( diffup ) >= EPSILON ) 
 | 
          { 
 | 
            msg := unit.Name() + [String] up.Start() + [String] up.Unit().IsInOptimizerPuzzle() +  'qty process diff=' + [String]  diffup; 
 | 
            debuginfo( msg );  
 | 
            task.Log( 'SUBPUZZLECHECK' + msg );  
 | 
          } 
 | 
        } 
 | 
      } 
 | 
       
 | 
      traverse( macroplan, StockingPoint_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning, pispip )  
 | 
      { 
 | 
        if ( not pispip.ProductInStockingPoint_MP().Product_MP().IsInOptimizerPuzzle() 
 | 
             or not pispip.ProductInStockingPoint_MP().StockingPoint_MP().isInOptimizerPuzzle() )  
 | 
        { 
 | 
          diffpispip := pispip.DebugSubPuzzleInventoryEndPrior() - pispip.InventoryLevelEnd();  
 | 
          if ( abs(  diffpispip ) >= EPSILON )  
 | 
          { 
 | 
            msg := 'pispip inv end diff' + pispip.ProductInStockingPoint_MP().Name() + [String] pispip.Start() +  'diff = ' + [String] diffpispip +   
 | 
                        'prod:' + [String] pispip.ProductInStockingPoint_MP().Product_MP().IsInOptimizerPuzzle() +  
 | 
                        'sp:' + [String] pispip.ProductInStockingPoint_MP().StockingPoint_MP().isInOptimizerPuzzle();  
 | 
            debuginfo( msg );  
 | 
            task.Log( 'SUBPUZZLECHECK' + msg );                
 | 
          } 
 | 
        } 
 | 
      } 
 | 
      debuginfo( '=== Finished checking optimizer sub puzzle ===' );  
 | 
    } 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |