yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
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
54
55
56
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;
  *]
}