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 ); 
 | 
  *] 
 | 
} 
 |