yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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' }
}