| Quintiq file version 2.0 | 
| #parent: #root | 
| Method CaptureMacroPlanKPIs ( | 
|   RunContextForCapacityPlanning runcontext, | 
|   CapacityPlanningSuboptimizer subopt, | 
|   LibOpt_Scope scope | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     mp := runcontext.Run().Optimization().astype( Optimization ).MacroPlan();  | 
|     eis := mp.OptimizerMetaEIS();  | 
|     isdebug := guard( eis.OptimizerMeta().Optimization().astype( Optimization ).DebugMode(), false );  | 
|      | 
|      | 
|     if ( eis.CampaignWeight() > 0 )  | 
|     { | 
|       this.KPICampaign( mp.GetKPICampaign() );  | 
|       campaignscore := 0.0;  | 
|       transscore := 0.0;  | 
|       uncoveredpenalty := 0.0; | 
|       sequencepenalty := 0.0;   | 
|       utilscore := 0.0;  | 
|       RollbackKPIMeta::GetCampaignScore( runcontext, mp, campaignscore, transscore, utilscore ); | 
|       RollbackKPIMeta::GetCampaignCombiSlackScore( mp, uncoveredpenalty, sequencepenalty, runcontext.UseCampaignSequenceOptimizer() );  | 
|       this.OptCampaignCampaignScore( campaignscore );  | 
|       this.OptCampaignTransitionScore( transscore );  | 
|       this.OptCampaignUncoveredPenalty( uncoveredpenalty );  | 
|       this.OptCampaignUtilizationScore( utilscore );  | 
|       this.OptCampaignSequencePenalty( sequencepenalty );  | 
|     } | 
|     if ( eis.FulfillmentWeight() > 0 )  | 
|     { | 
|       this.KPIFulfillment( mp.GetKPIFulfillment() );  | 
|       this.KPIFulfillmentPercentage( mp.GetKPIFulfillmentInPercentage() );  | 
|     } | 
|     if ( eis.FulfillmentTargetWeight() > 0 ) | 
|     { | 
|       this.KPIFulfillmentTarget( mp.GetKPIFulfillmentTarget() );  | 
|       this.KPIFulfillmentTargetAbsolute( mp.GetKPIFulfillmentTargetAbsolute() );  | 
|       this.KPIFulfillmentTargetOpt( mp.GetKPIFulfillmentTargetOpt() );  | 
|       this.KPIFulfillmentTargetPercentage( mp.GetKPIFulfillmentTargetPercentage() );  | 
|     } | 
|     if ( eis.LotSizeWeight() > 0 )  | 
|     { | 
|       this.KPIInputLotSize( eis.KPILotSizeInputContinuous() );  | 
|       this.KPILotSizeTrip( eis.KPILotSizeTripContinuous() );  | 
|       this.KPILotSizeOperation( eis.KPILotSizeOperationContinuous() );  | 
|       this.KPILotSizeTotal( eis.KPILotSizeTotal() );  | 
|     } | 
|     if ( eis.InventoryMixBalancingWeight() > 0 )  | 
|     { | 
|       this.KPIInventoryMixBalancing( mp.GetKPIInventoryMixBalancing() );  | 
|     } | 
|     if ( eis.TargetInventoryLevelWeight() > 0 )  | 
|     { | 
|       this.KPITargetInventoryLevel( eis.KPITargetInventory() );  | 
|       this.KPITargetInventoryPercentage( mp.GetKPITargetInventoryLevelInPecentage() );  | 
|     } | 
|     if ( eis.MaximumInventoryLevelWeight() > 0 )  | 
|     { | 
|       this.KPIMaximumInventoryLevel( eis.KPIMaximumInventory() );  | 
|     } | 
|     if ( eis.MinimumInventoryLevelWeight() > 0 )  | 
|     { | 
|       this.KPIMinimumInventoryLevel( eis.KPIMinimumInventory() );  | 
|     } | 
|     if ( eis.MaximumSupplyWeight() > 0 )  | 
|     { | 
|       this.KPIMaximumSupply( mp.GetKPIMaximumSupply() );  | 
|     } | 
|     if ( eis.MinimumSupplyWeight() > 0 )  | 
|     { | 
|       this.KPIMinimumSupply( mp.GetKPIMinimumSupply() );  | 
|     } | 
|     if ( eis.MinimumUnitCapacityWeight() > 0 )  | 
|     { | 
|       this.KPIMinimumUnitCapacity( mp.GetKPIMinimumUnitCapacity() );  | 
|       this.KPIUnitCapacityNotMet( mp.GetKPIUnitCapacityNotMet() );  | 
|     } | 
|     if ( eis.PostponementPenaltyWeight() > 0 )  | 
|     { | 
|       this.KPIPostponementPenalty( mp.GetKPIPostponementPenalty() );  | 
|     } | 
|     if ( eis.ProcessMaximumQuantityWeight() > 0 )  | 
|     { | 
|       this.KPIProcessMaximumQuantity( mp.GetKPIProcessMaximumQuantity() );  | 
|     } | 
|     if ( eis.ProcessMinimumQuantityWeight() > 0 )  | 
|     { | 
|       this.KPIProcessMinimumQuantity( mp.GetKPIProcessMinimumQuantity() );  | 
|     } | 
|     if ( eis.SalesDemandPriorityWeight() > 0 )  | 
|     { | 
|       this.KPISalesDemandPriority( eis.KPISalesDemandPriority() ); // use attribute avoid expensive method call  | 
|     } | 
|     if ( eis.StockingPointCapacityWeight() > 0 )  | 
|     { | 
|       this.KPIStockingPointCapacity( mp.GetKPIStockingPointCapacity() );  | 
|     } | 
|     if ( eis.ServiceLevelWeight() > 0 )  | 
|     { | 
|       this.KPIServiceLevel( mp.GetKPIServiceLevel() );  | 
|     } | 
|     if ( eis.SupplyTargetWeight() > 0 )  | 
|     { | 
|       this.KPISupplyTarget( mp.GetKPISupplyTarget() );  | 
|     } | 
|     if ( eis.UnitCapacityWeight() > 0 )  | 
|     { | 
|       this.KPIUnitCapacity( mp.GetKPIUnitCapacity() );  | 
|     } | 
|     if ( eis.ExpiredQtyWeight() > 0 )  | 
|     { | 
|       this.KPITotalExpiredQuantity( mp.GetKPITotalExpiredQuantity() );  | 
|     } | 
|     this.KPIBalanceViolation( eis.KPIBalanceViolation() ); | 
|      | 
|     if ( isdebug )  | 
|     { | 
|       this.KPIFixedCost( mp.GetKPIFixedCost() );  | 
|       this.KPIChangeover( mp.GetKPIChangeover() );  | 
|       this.KPIDirectCost( mp.GetKPIDirectCost() );  | 
|       this.KPIInventoryHoldingCost( mp.GetKPIInventoryHoldingCost() );  | 
|       this.KPIInventorySupplyCost( mp.GetKPIInventorySupplyCost() );  | 
|       this.KPIInventoryTurns( mp.GetKPIInventoryTurns() );  | 
|       this.KPIMargin( mp.GetKPIMargin() );  | 
|       this.KPIOnTimeFulfillment( mp.GetKPIOnTimeFulfillment() );  | 
|       this.KPIOnTimeInFull( mp.GetKPIOnTimeInFull() );  | 
|       this.KPISales( mp.GetKPISales() );  | 
|       this.KPIVolume( mp.GetKPIVolume() ); | 
|      | 
|       // sub puzzle KPIs | 
|       pispips := scope.GetPISPIPInOptimizerRunConst();  | 
|       uperiods := scope.GetUnitPeriodInOptimizerRunConst();  | 
|       spips := scope.GetStockingPointInPeriodInOptimizerRunConst();  | 
|       this.KPIMaximumInventoryLevelSubPuzzle( mp.GetKPIMaximumInventoryLevel( pispips ) );  | 
|       this.KPIMinimumInventoryLevelSubPuzzle( mp.GetKPIMinimumInventoryLevel( pispips ) );  | 
|       this.KPILotSizeTripSubPuzzle( mp.GetKPILotSizeTripContinuous( uperiods ) );  | 
|       this.KPIUnitCapacitySubPuzzle(mp.GetKPIUnitCapacity( uperiods ) ); | 
|       this.KPIUnitCapacityNotMetSubPuzzle( mp.GetKPIUnitCapacityNotMet( uperiods ) );  | 
|       this.KPIStockingPointCapacitySubPuzzle( mp.GetKPIStockingPointCapacity( spips ) ); | 
|       this.KPIFulfillmentSubPuzzle( mp.GetKPIFulfillmentSubPuzzle( scope ) );  | 
|     } | 
|     if ( eis.BlendingWeight() > 0 )  | 
|     { | 
|       this.KPIBlending( mp.GetKPIBlending( runcontext.SmallestFeasibilityTolerance() ) );  | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |