Kevin Kok Khah Whey
2023-09-26 f548609873fb52f530f0e7e32f255a4f69a5b648
Kevin: Fixed optimizer error according to OOTB 6.4.2.
已修改2个文件
43 ■■■■ 文件已修改
LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LibMacroPlannerOptimizer/BL/Type_CapacityPlanningSuboptimizer/Method_CapacityPlanningAlgorithmHandleFeasibleOperationDependentDemandInputG.qbl
@@ -9,7 +9,6 @@
  Description: 'Assign the optimal quantity from optimizer for dependent demand in input group.'
  TextBody:
  [*
    // Tianma fix 20230727
    // Dependent demand of input group fulfillment
    ptperiod := periodtaskoperation.UnitPeriod().Period_MP();
    operation := periodtaskoperation.Operation();
@@ -19,22 +18,24 @@
              dd, 
              dd.HasRegularProductForOptimizer() or dd.OperationInput().GetIsProductInOptimizerRun( runcontext.IsPostProcessing() ) )
    {
      pispipperiods := construct( Period_MPs, constcontent );
      if ( getfromperiodtask ) // in case we are able to get from period tasks, below method refinds periodtask for (operation, ptperiod) i.e. periodtaskoperation and then output dep.demand periods
      {
        traverse( periodtaskoperation, DependentDemand.ProductInStockingPointInPeriodPlanningLeaf.Period_MP, ddperiod )
        {
          pispipperiods.Add( ddperiod );
        }
      }
      else
      {
        CapacityPlanningSuboptimizer::GetOperationDependentDemandPeriods( ptperiod, operation, &pispipperiods, getfromperiodtask );
      }
      fulfilledqty := 0.0;
      
      fulfilledqty := 0.0;
      if( operation.HasLeadTime() )     // Get the dependent demands that is located at different period from the period of period task.
      {
        // compute dependent demand periods
        pispipperiods := construct( Period_MPs, constcontent );
        if ( getfromperiodtask ) // in case we are able to get from period tasks, below method refinds periodtask for (operation, ptperiod) i.e. periodtaskoperation and then output dep.demand periods
        {
          traverse( periodtaskoperation, DependentDemand.ProductInStockingPointInPeriodPlanningLeaf.Period_MP, ddperiod )
          {
            pispipperiods.Add( ddperiod );
          }
        }
        else
        {
          CapacityPlanningSuboptimizer::GetOperationDependentDemandPeriods( ptperiod, operation, &pispipperiods, getfromperiodtask );
        }
        fulfilledqty := sum( pispipperiods, Elements, pispipperiod,
                             this.GetOptimalValue( program.PartialOperationDemandQtyVariables().Get( dd.OperationInput(), pispipperiod, ptperiod ) ) );
        if ( runcontext.IsMetaIteration() and operation.IsBlending() ) // no filtering for numerical sensitive blending operation in meta optimizer
@@ -44,15 +45,15 @@
        }                     
      }
      else
      {
        fulfilledqty := sum( pispipperiods, Elements, pispipperiod,
                             this.GetOptimalValue( program.OperationDemandQtyVariables().Get( dd.OperationInput(), pispipperiod ) ) );
      {
        // note that in case there is no lead time then the set of dependent demand periods just equals the singleton set {ptperiod}
        fulfilledqty := this.GetOptimalValue( program.OperationDemandQtyVariables().Get( dd.OperationInput(), ptperiod ) );
        if( runcontext.IsMetaIteration() and operation.IsBlending() ) // no filtering for numerical sensitive blending operation in meta optimizer
        {
          fulfilledqty := sum( pispipperiods, Elements, pispipperiod,
                               this.GetOptimalValueUnfiltered( program.OperationDemandQtyVariables().Get( dd.OperationInput(), pispipperiod ) ) );
          fulfilledqty := this.GetOptimalValueUnfiltered( program.OperationDemandQtyVariables().Get( dd.OperationInput(), ptperiod ) );
        }
      }
      dd.OptimizerFulfilledQuantity( fulfilledqty );
    }
  *]
LibMacroPlannerOptimizer/BL/Type_SelectorFullPuzzle/Method_SetOptimizerInput.qbl
@@ -175,10 +175,12 @@
      
      if ( ddperiodstotal.Size() > 0 ) 
      {
        minstart := min( ddperiodstotal, Elements, p, p.Start() );
        minstartperiods := min( periods, Elements, p, p.Start() );
        pispiptoadd := selectset( operation, 
                                  OperationInput.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning, 
                                  pispip,
                                  ddperiodstotal.Find( pispip.Period_MP() ) > 0
                                  pispip.Start() >= minstart and pispip.Start() < minstartperiods // must add the entire block. Don't want gaps in the pispip horizon
                                  and ( pispip.HasRegularProductForOptimizer() or pispip.GetProductIsIncludedInOptimizerRun( runcontext.IsPostProcessing() ) ) 
                                  and not scope.Contains( pispip.PISPIPInOptimizerRun() ) )