haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
Quintiq file version 2.0
#parent: #root
Method GenerateEnlargedMetalsBenchmark (
  String description
)
{
  TextBody:
  [*
    // description described which feature to add
    // strategy is a temporary copy of the strategy indicated in the tracking table. We add KPIs to levels based on options. 
    
    // >> unused, values set with method 'ParseBenchmarkName'
    endproductstoadd := 1; 
    intermediatetoadd := 1; 
    periodstoadd := 1; 
    addtriplotsize := true; 
    usertriplotsize := 100.0; 
    addptolotsize := true; 
    userptolotsize := 1000.0; 
    addptominqty := true; 
    userptominqty := 5000.0; 
    addinputlotsize := true;  
    userinputlotsize := 1000.0; 
    setlotcost := true; 
    setinventorymixbalancing := true; 
    addcapsmoothing := true; 
    smoothingdelta := 2.0; // 2% smoothing 
    addpostponement := true; 
    postponementnrperiods := 1234; 
    // <<
    
    Optimization::ParseBenchmarkName( description, 
                                     endproductstoadd, 
                                     intermediatetoadd, 
                                     periodstoadd, 
                                     addtriplotsize, 
                                     usertriplotsize, 
                                     addptolotsize, 
                                     userptolotsize, 
                                     addptominqty, 
                                     userptominqty, 
                                     addinputlotsize, 
                                     userinputlotsize, 
                                     setlotcost, 
                                     setinventorymixbalancing, 
                                     addcapsmoothing, 
                                     smoothingdelta, 
                                     addpostponement, 
                                     postponementnrperiods );
              
    
    mp := this.MacroPlan(); 
    
    mp.GenerateBenchmark( 'myprod', 
                          endproductstoadd, 
                          intermediatetoadd, 
                          periodstoadd, 
                          addtriplotsize, 
                          usertriplotsize, 
                          addptolotsize, 
                          userptolotsize, 
                          addptominqty, 
                          userptominqty, 
                          addinputlotsize, 
                          userinputlotsize, 
                          setlotcost, 
                          setinventorymixbalancing, 
                          addcapsmoothing, 
                          smoothingdelta, 
                          addpostponement, 
                          postponementnrperiods );
    
    if ( addinputlotsize or addptolotsize or addtriplotsize ) 
    {
      kpwi:= select( mp, StrategyMacroPlan.KPIWeightMacroPlan, kpiw, true, kpiw.KPIName() = Translations::MP_GlobalParameters_KPILotSizeName() ); 
      kpwi.Weight( 1.0 ); 
      kpwi.Level( 1 ); // add lot size to first level ( constraints)
    }
    
    if ( addptominqty ) 
    {
      kpiw:= select( mp, StrategyMacroPlan.KPIWeightMacroPlan, kpiw, true, kpiw.KPIName() =  Translations::MP_GlobalParameters_KPIProcessMinimumQuantity() ); 
      kpiw.Weight( 1.0 ); 
      kpiw.Level( 1 ); // add process min qty to first level ( constraints )
    }
    
    if ( setinventorymixbalancing ) 
    {
      kpiw:= select( mp, StrategyMacroPlan.KPIWeightMacroPlan, kpiw, true, kpiw.KPIName() =  Translations::MP_GlobalParameters_KPIInventoryMixBalancing() ); 
      kpiw.Weight( 1.0 ); 
      kpiw.Level( 1 ); // add inv mix balance to first level ( constraints )
    }
    
    if ( addcapsmoothing ) 
    {
      kpiw:= select( mp, StrategyMacroPlan.KPIWeightMacroPlan, kpiw, true, kpiw.KPIName() =  Translations::MP_GlobalParameters_KPICapacitySmoothing() ); 
      kpiw.Weight( 1.0 ); 
      kpiw.Level( 1 ); // add cap smooth to first level ( constraints )
    }
    
    if ( setlotcost ) 
    {
      traverse( mp, StrategyMacroPlan.KPIWeightMacroPlan, kpiw, kpiw.KPIName() ~ 'ost' and kpiw.KPIName() ~ 'Lot' ) 
      {
        kpiw.Weight( 1.0 ); 
        kpiw.Level( mp.StrategyMacroPlan().MaxActiveLevel() ); // add lot cost to last level
      }
    }
    
    if ( addpostponement ) 
    {
      traverse( mp, StrategyMacroPlan.KPIWeightMacroPlan, kpiw, kpiw.KPIName() = Translations::MP_GlobalParameters_KPIPostponementPenaltyName() ) 
      {
        kpiw.Weight( 0.001 ); 
        kpiw.Level( mp.StrategyMacroPlan().MaxActiveLevel() ); // add small postponement penalty to last level (presumed cost)
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}