陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
MethodOverride CreateComponents (
  LibOpt_Run run
)
{
  TextBody:
  [*
    // create needed components. The design consists of 2 sub optimizers fed by two transformers (down stream then upstream, whic is done by having an iterator of 2 iterations and a
    // round robin switch). This is the complete middle out smart plan. In case we just do upstream or downstream smartplan we set the start component to be the corresponding transformer. 
    
    prepostcomp := run.Component( relnew, OptimizerPrePostProcessing, Name := 'PrePostProcessing_SmartPlan' ); 
    
    //iterator := this.Iterator( run, 'IteratorTwoTimes' ); // default start component 
    //iterator.SetMaxIterations( 2 ); 
    //roundrobin := this.SwitchRoundRobin( run, 'RoundRobinDownstreamUpstream' ); 
    runcontext := RunContextForCapacityPlanning::GetRunContextCapacityPlanning( run ); 
    transformerdownstream := TransformerSmartPlanDownStream::Create(  run, 
                                                                      'TransformerDownStream', 
                                                                      Number::MaxNumber(), 
                                                                      runcontext.NumberOfPeriodsSmartPlan() );
    transformerupstream := TransformerSmartPlanUpStream::Create( run, 
                                                                 'TransformerUpStream', 
                                                                 Number::MaxNumber(), 
                                                                 runcontext.NumberOfPeriodsSmartPlan() ); 
    suboptimizerup := CapacityPlanningSuboptimizer::Create( 5,                                                    // focuslevel
                                                          false,                                                // ispriorlevelsfixed
                                                          false,                                                // isupdatescaling
                                                          false,                                                // runpastfocuslevel
                                                          run, 
                                                          'CapacityPlanningSubOptimizerForSmartPlanUpStream',            // name
                                                          false,  // user supply correction for carried fwd inventory 
                                                          false,  // keep total available supply
                                                          true,   // use periodtaskoperation in definition
                                                          true,   // only plan demand smart plan pispips  
                                                          false,  // no extra level to minimize ptqty
                                                          false,  // not applicable 
                                                          0.0,    // not applicable
                                                          true,   // apply noise threshold
                                                          false,  // hierarhical cplex goals  
                                                          runcontext.SmallestIntegralityTolerance(),
                                                          runcontext.SmallestFeasibilityTolerance(),  
                                                          false,  // full plan for meta  
                                                          false,  // collapse level
                                                          0.0 );  // collapse level weight
    
    RollbackKPIMeta::Create( suboptimizerup, 
                             RunContextForCapacityPlanning::GetRunContextCapacityPlanning( run ), 
                             0,   // unused
                             0.0, // unused
                             0.0, // unused
                             runcontext.SmallestFeasibilityTolerance(), // blending KPI precision
                             true, // unused
                             runcontext.MaxLevel(), 
                             true ); // always accept - just want to see scores in snapshots
    
                                                            
    suboptimizerdown := CapacityPlanningSuboptimizer::Create( 5,                                                    // focuslevel
                                                              false,                                                // ispriorlevelsfixed
                                                              false,                                                // isupdatescaling
                                                              false,                                                // runpastfocuslevel
                                                              run, 
                                                              OptimizerSmartPlan::DownStreamSubOptimizerName(),     // name
                                                              true,    // user supply correction for carried fwd inventory 
                                                              true,    // keep total available supply
                                                              true,    // use periodtaskoperation in definition
                                                              false,   // only plan demand smart plan pispips
                                                              false,   // no extra level to minimize ptqty
                                                              false,   // not applicable
                                                              0.0,     // not applicable
                                                              true,    // apply noise threshold
                                                              false,   // hierarhical cplex goals
                                                              runcontext.SmallestIntegralityTolerance(), 
                                                              runcontext.SmallestFeasibilityTolerance(),
                                                              false,   // full plan for meta 
                                                              false,   // collapse level
                                                              0.0 );   /// collapse level weight
    
    
    RollbackKPIMeta::Create( suboptimizerdown, 
                             RunContextForCapacityPlanning::GetRunContextCapacityPlanning( run ), 
                             0,   // unused
                             0.0, // unused
                             0.0, // unused
                             runcontext.SmallestFeasibilityTolerance(), // blending KPI precision
                             true, // unused
                             runcontext.MaxLevel(), 
                             true ); // always accept - just want to see scores in snapshots
    
    
    // create the tree by linking created components - default is to create middle out smart plan diagram (which we modify in execute for upstream/downstream smartplan)
    //prepostcomp.To( iterator ); 
    //iterator.To( roundrobin ); 
    prepostcomp.To(  transformerdownstream ); 
    //roundrobin.Branch( transformerdownstream ); 
    //roundrobin.Branch( transformerupstream ); 
    transformerdownstream.To( suboptimizerdown );
    suboptimizerdown.To(  transformerupstream ); 
    transformerupstream.To( suboptimizerup );
  *]
}