chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Quintiq file version 2.0
#parent: #root
Method GetWeightedKPIOnLevel (
  Number levelofkpi
) declarative as Real
{
  Description: 'returns the weighted KPI corresponding to the given level'
  TextBody:
  [*
    // lauri Jun-18-2014 (created)
    
    //new implementation: info from current solution but weights from given level
    
    algorithmrun := this;
    
    //nonfinancial part of KPI, filtering by level done below
    nonfinancialresult := this.LastLevel().OptimizerNonFinancialKPIResult();
    nonfinancialkpi := nonfinancialresult.WeightedValueBlending() * ( ifexpr( levelofkpi = algorithmrun.BlendingLevel(), 1, 0 ) ) 
                       + nonfinancialresult.WeightedValueCampaign() * ( ifexpr( levelofkpi = algorithmrun.CampaignLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueFulfillment() * ( ifexpr( levelofkpi = algorithmrun.FulfillmentLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueInventoryMixBalancing() * ( ifexpr( levelofkpi = algorithmrun.InventoryMixBalancingLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueLotSize() * ( ifexpr( levelofkpi = algorithmrun.LotSizeLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueMaximumInventoryLevel() * ( ifexpr( levelofkpi = algorithmrun.MaximumInventoryLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueMaximumSupply() * ( ifexpr( levelofkpi = algorithmrun.MaximumSupplyLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueMinimumUnitCapacity() * ( ifexpr( levelofkpi = algorithmrun.MinimumUnitCapacityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueMinimumUnitSecondaryCapacity() * ( ifexpr( levelofkpi = algorithmrun.MinimumUnitCapacityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueMinimumInventoryLevel() * ( ifexpr( levelofkpi = algorithmrun.MinimumInventoryLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValuePostponementPenalty() * ( ifexpr( levelofkpi = algorithmrun.PostponementPenaltyLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueProcessMaximumQuantity() * ( ifexpr( levelofkpi = algorithmrun.ProcessMaximumQuantityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueProcessMinimumQuantity() * ( ifexpr( levelofkpi = algorithmrun.ProcessMinimumQuantityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueSalesDemandPriority() * ( ifexpr( levelofkpi = algorithmrun.SalesDemandPriorityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueShiftPatternChangesPenalty() * ( ifexpr( levelofkpi = algorithmrun.ShiftPatternChangesPenaltyLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueFulfillmentTarget() * ( ifexpr( levelofkpi = algorithmrun.FulfillmentTargetLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueServiceLevel() * ( ifexpr( levelofkpi = algorithmrun.ServiceLevelLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueSlack() * ( ifexpr( levelofkpi = algorithmrun.SlackLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueStockingPointCapacity() * ( ifexpr( levelofkpi = algorithmrun.StockingPointCapacityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueMinimumSupply() * ( ifexpr( levelofkpi = algorithmrun.MinimumSupplyLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueSupplyTarget() * ( ifexpr( levelofkpi = algorithmrun.SupplyTargetLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueTargetInventoryLevel() * ( ifexpr( levelofkpi = algorithmrun.TargetInventoryLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueUnitCapacity() * ( ifexpr( levelofkpi = algorithmrun.UnitCapacityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueUnitSecondaryCapacity() * ( ifexpr( levelofkpi = algorithmrun.UnitCapacityLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueTotalExpiredQty() * ( ifexpr( levelofkpi = algorithmrun.ExpiredQtyLevel(), 1, 0 ) )
                       + nonfinancialresult.WeightedValueCO2Emission() * ( ifexpr( levelofkpi = algorithmrun.CO2EmissionLevel(), 1, 0 ) )
                       
    
    //accounts - filtering by levels is very convenient here
    accountkpi := sum( this.LastLevel(), OptimizerAccountKPIResult, accountkpiresult,
                       accountkpiresult.Level() = levelofkpi,
                       accountkpiresult.TotalGoalValue() * accountkpiresult.Weight() );
    
    return nonfinancialkpi + accountkpi;
  *]
}