Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetWeightedKPI () declarative as Real 
 | 
{ 
 | 
  Description: 
 | 
  [* 
 | 
    Returns the sum of weighted KPIs, over KPIs that are assigned to current level. 
 | 
    Can be different from ProgramGoalValue if CPLEX includes goal terms of earlier fixed levels. 
 | 
  *] 
 | 
  TextBody: 
 | 
  [* 
 | 
    curlevel := this.Level(); 
 | 
    algorithmrun := this.AlgorithmRun(); 
 | 
     
 | 
    //nonfinancial part of KPI, filtering by level done below 
 | 
    nonfinancialresult := this.OptimizerNonFinancialKPIResult(); 
 | 
    // for each weightedn value in the non financialresult, it is determined if it should be accounted for 
 | 
    // first Blending, Campaign, Fullfillment, InventoryMixBalancing, LotSize, MaximumInventoryLevel, MaximumSupply, MinimumInventoryLevel, MinimumUnitCapacity and MinimumSecondaryCapacity 
 | 
    // are added 
 | 
    nonfinancialkpi := nonfinancialresult.WeightedValueBlending() * ( ifexpr( curlevel = algorithmrun.BlendingLevel(), 1, 0 ) )  
 | 
                       + nonfinancialresult.WeightedValueCampaign() * ( ifexpr( curlevel = algorithmrun.CampaignLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueFulfillment() * ( ifexpr( curlevel = algorithmrun.FulfillmentLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueInventoryMixBalancing() * ( ifexpr( curlevel = algorithmrun.InventoryMixBalancingLevel(), 1 , 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueLotSize() * ( ifexpr( curlevel = algorithmrun.LotSizeLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueMaximumInventoryLevel() * ( ifexpr( curlevel = algorithmrun.MaximumInventoryLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueMaximumSupply() * ( ifexpr( curlevel = algorithmrun.MaximumSupplyLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueMinimumInventoryLevel() * ( ifexpr( curlevel = algorithmrun.MinimumInventoryLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueMinimumUnitCapacity() * ( ifexpr( curlevel = algorithmrun.MinimumUnitCapacityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueMinimumUnitSecondaryCapacity() * ( ifexpr( curlevel = algorithmrun.MinimumUnitCapacityLevel(), 1, 0 ) ) 
 | 
                       // after which we continue with MinimumSupply, PostponentPenalty, ProcessMinimum and -MaximumQuantity, SalesDemandPriority, FulfillmentTarget, ServiceLevel, Slack 
 | 
                       // StockingPointCapacity, SupplyTarget, TargetInventoryLevel, UnitCapacity, UnitSecondaryCapacity, TotalExpiredQty, and CO2Emission 
 | 
                       + nonfinancialresult.WeightedValueMinimumSupply() * ( ifexpr( curlevel = algorithmrun.MinimumSupplyLevel(), 1, 0 ) )  
 | 
                       + nonfinancialresult.WeightedValuePostponementPenalty() * ( ifexpr( curlevel = algorithmrun.PostponementPenaltyLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueProcessMaximumQuantity() * ( ifexpr( curlevel = algorithmrun.ProcessMaximumQuantityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueProcessMinimumQuantity() * ( ifexpr( curlevel = algorithmrun.ProcessMinimumQuantityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueSalesDemandPriority() * ( ifexpr( curlevel = algorithmrun.SalesDemandPriorityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueShiftPatternChangesPenalty() * ( ifexpr( curlevel = algorithmrun.ShiftPatternChangesPenaltyLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueFulfillmentTarget() * ( ifexpr( curlevel = algorithmrun.FulfillmentTargetLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueServiceLevel() * ( ifexpr( curlevel = algorithmrun.ServiceLevelLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueSlack() * ( ifexpr( curlevel = algorithmrun.SlackLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueStockingPointCapacity() * ( ifexpr( curlevel = algorithmrun.StockingPointCapacityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueSupplyTarget() * ( ifexpr( curlevel = algorithmrun.SupplyTargetLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueTargetInventoryLevel() * ( ifexpr( curlevel = algorithmrun.TargetInventoryLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueUnitCapacity() * ( ifexpr( curlevel = algorithmrun.UnitCapacityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueUnitSecondaryCapacity() * ( ifexpr( curlevel = algorithmrun.UnitCapacityLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueTotalExpiredQty() * ( ifexpr( curlevel = algorithmrun.ExpiredQtyLevel(), 1, 0 ) ) 
 | 
                       + nonfinancialresult.WeightedValueCO2Emission() * ( ifexpr( curlevel = algorithmrun.CO2EmissionLevel(), 1, 0 ) ) 
 | 
     
 | 
    //accounts - filtering by levels is very convenient here 
 | 
    accountkpi := sum( this, OptimizerAccountKPIResult, accountkpiresult, 
 | 
                       accountkpiresult.Level() = this.Level(), 
 | 
                       accountkpiresult.TotalGoalValue() * accountkpiresult.Weight() ); 
 | 
     
 | 
    return nonfinancialkpi + accountkpi; 
 | 
  *] 
 | 
} 
 |