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
Quintiq file version 2.0
#parent: #root
Method CaptureForOTS (
  LibOpt_Task task
)
{
  TextBody:
  [*
    nrdecimals := 3; 
    opt := this.Run().Optimization().astype( Optimization );  
    mp := opt.MacroPlan(); 
    runcontext := select( this, Run.RunContext.astype( RunContextForCapacityPlanning ), rc, true, true ); 
    
    if ( runcontext.IsOTSCollectAllKPIData() or not runcontext.IsMetaIteration() ) // for meta optimizer it becomes quite expensive to collect all KPIs each iteration. So we have an optimizer setting option to turn this off 
    {  
      this.KPICampaign( mp.GetKPICampaign().Round( nrdecimals ) ); 
      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.Round( nrdecimals ) ); 
      this.OptCampaignTransitionScore( transscore.Round( nrdecimals ) ); 
      this.OptCampaignUncoveredPenalty( uncoveredpenalty.Round( nrdecimals ) ); 
      this.OptCampaignUtilizationScore( utilscore.Round( nrdecimals ) ); 
      this.OptCampaignSequencePenalty( sequencepenalty.Round( nrdecimals ) ); 
      
      this.KPIFulfillment( mp.GetKPIFulfillment().Round( nrdecimals ) ); 
      this.KPIFulfillmentPercentage( mp.GetKPIFulfillmentInPercentage().Round( nrdecimals ) ); 
      
      this.KPIFulfillmentTarget( mp.GetKPIFulfillmentTarget().Round( nrdecimals ) ); 
      this.KPIFulfillmentTargetAbsolute( mp.GetKPIFulfillmentTargetAbsolute().Round( nrdecimals ) ); 
      this.KPIFulfillmentTargetOpt( mp.GetKPIFulfillmentTargetOpt().Round( nrdecimals ) ); 
      this.KPIFulfillmentTargetPercentage( mp.GetKPIFulfillmentTargetPercentage().Round( nrdecimals ) ); 
      
      this.KPIInputLotSize( mp.GetKPIInputLotSizeContinuous().Round( nrdecimals ) ); 
      this.KPILotSizeTrip( mp.GetKPILotSizeTripContinuous().Round( nrdecimals ) ); 
      this.KPILotSizeOperation( mp.GetKPILotSizeOperationContinuous().Round( nrdecimals ) ); 
      this.KPILotSizeTotal( mp.GetKPILotSizeTotal().Round( nrdecimals ) ); 
      
      this.KPIInventoryMixBalancing( mp.GetKPIInventoryMixBalancing().Round( nrdecimals ) ); 
      
      this.KPITargetInventoryLevel( mp.GetKPITargetInventoryLevel().Round( nrdecimals ) ); 
      this.KPITargetInventoryPercentage( mp.GetKPITargetInventoryLevelInPecentage().Round( nrdecimals ) ); 
      
      this.KPIMaximumInventoryLevel( mp.GetKPIMaximumInventoryLevel().Round( nrdecimals ) ); 
      
      this.KPIMinimumInventoryLevel( mp.GetKPIMinimumInventoryLevel().Round( nrdecimals ) ); 
      
      this.KPIMaximumSupply( mp.GetKPIMaximumSupply().Round( nrdecimals ) ); 
      
      this.KPIMinimumSupply( mp.GetKPIMinimumSupply().Round( nrdecimals ) ); 
      
      this.KPIMinimumUnitCapacity( mp.GetKPIMinimumUnitCapacity().Round( nrdecimals ) ); 
      this.KPIUnitCapacityNotMet( mp.GetKPIUnitCapacityNotMet().Round( nrdecimals ) ); 
      
      this.KPIPostponementPenalty( mp.GetKPIPostponementPenalty().Round( nrdecimals ) ); 
      
      this.KPIProcessMaximumQuantity( mp.GetKPIProcessMaximumQuantity().Round( nrdecimals ) ); 
      
      this.KPIProcessMinimumQuantity( mp.GetKPIProcessMinimumQuantity().Round( nrdecimals ) ); 
      
      this.KPISalesDemandPriority( mp.GetKPISalesDemandPriority().Round( nrdecimals ) ); 
      
      this.KPIStockingPointCapacity( mp.GetKPIStockingPointCapacity().Round( nrdecimals ) ); 
      
      this.KPIServiceLevel( mp.GetKPIServiceLevel().Round( nrdecimals ) ); 
      
      this.KPISupplyTarget( mp.GetKPISupplyTarget().Round( nrdecimals ) ); 
      
      this.KPIUnitCapacity( mp.GetKPIUnitCapacity().Round( nrdecimals ) ); 
      
      this.KPITotalExpiredQuantity( mp.GetKPITotalExpiredQuantity().Round( nrdecimals ) ); 
      
      this.KPIBalanceViolation( mp.GetKPIBalanceViolation().Round( nrdecimals ) );
      
      this.KPIFixedCost( mp.GetKPIFixedCost().Round( nrdecimals ) ); 
      this.KPIChangeover( mp.GetKPIChangeover().Round( nrdecimals ) ); 
      this.KPIDirectCost( mp.GetKPIDirectCost().Round( nrdecimals ) ); 
      this.KPIInventoryHoldingCost( mp.GetKPIInventoryHoldingCost().Round( nrdecimals ) ); 
      this.KPIInventorySupplyCost( mp.GetKPIInventorySupplyCost().Round( nrdecimals ) ); 
      this.KPIInventoryTurns( mp.GetKPIInventoryTurns().Round( nrdecimals ) ); 
      this.KPIMargin( mp.GetKPIMargin().Round( nrdecimals ) ); 
      this.KPIOnTimeFulfillment( mp.GetKPIOnTimeFulfillment().Round( nrdecimals ) ); 
      this.KPIOnTimeInFull( mp.GetKPIOnTimeInFull().Round( nrdecimals ) ); 
      this.KPISales( mp.GetKPISales().Round( nrdecimals ) ); 
      this.KPIVolume( mp.GetKPIVolume().Round( nrdecimals ) );
      
      this.KPIBlending( mp.GetKPIBlending( runcontext.SmallestFeasibilityTolerance() ).Round( nrdecimals ) );
      
      kpi := RealVector::Construct( this.RollbackKPI() );
      opt.BT_ScoreL0( guard( kpi.Get( 0 ), 0.0 ) ); 
      opt.BT_ScoreL1( guard( kpi.Get( 1 ), 0.0 ) ); 
      opt.BT_ScoreL2( guard( kpi.Get( 2 ), 0.0 ) ); 
      opt.BT_ScoreL3( guard( kpi.Get( 3 ), 0.0 ) ); 
      opt.BT_ScoreL4( guard( kpi.Get( 4 ), 0.0 ) ); 
      opt.BT_ScoreL5( guard( kpi.Get( 5 ), 0.0 ) ); 
      opt.BT_ScoreL6( guard( kpi.Get( 6 ), 0.0 ) ); 
    
      this.CreateKPIParts( task.Scope() );
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}