admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Quintiq file version 2.0
#parent: #root
MethodOverride CreateRun () as LibOpt_Run
{
  TextBody:
  [*
    run := super.CreateRun();
    
    mp := this.Optimization().astype( Optimization ).MacroPlan(); 
    
    settings := this.ActiveSettings().astype( OptimizerFullRunSettings ); 
    puzzle := select( mp, OptimizerPuzzle, puzzle, true, puzzle.Name() = settings.PuzzleName() ); 
    
    periodstart := minselect( mp, Period_MP, p, not p.IsHistorical(), p.StartDate() ); 
    periodend := mp.LastPlanningPeriod(); 
    
    this.Optimization().astype( Optimization ).GetPeriodsForOTS( periodstart, periodend, settings ); 
    
    issmartplan := false; 
    issmartplanforperiodtask := false;  
    hastotalsupplyuser := false; 
    totalsupplyuser := 0.0; 
    smartplanpispips := null( ProductInStockingPointInPeriodPlanningLeafs ); 
    isupstreamsmartplan := false; 
    ismiddleoutsmartplan := false; 
    isonlyplanonestepupstream := false; 
    ispostprocessing := false; 
    isforcenoautoscaling := true; 
    isoverridemanualplanning := settings.OverrideManualPlanning(); 
    isinventoryoptimizationrun := false; 
    isusingselectedunits := false; 
    units := null( Units ); 
    process := null( Process_MP ); 
    
    algrun := mp.InitializeOptimizerRun( issmartplan, 
                                         issmartplanforperiodtask, 
                                         hastotalsupplyuser, 
                                         totalsupplyuser, 
                                         smartplanpispips, 
                                         isupstreamsmartplan, 
                                         ismiddleoutsmartplan, 
                                         isonlyplanonestepupstream, 
                                         ispostprocessing,
                                         isforcenoautoscaling, 
                                         null( Strategy ), // for OTS we have a workaround via method  LibOpt_BT_RunSequenceElement.MyMethodTemp that copies the strategy
                                         isoverridemanualplanning, 
                                         periodstart, 
                                         periodend, 
                                         isinventoryoptimizationrun, 
                                         isusingselectedunits, 
                                         units, 
                                         process, 
                                         puzzle );  
    
    
    context := RunContextForCapacityPlanning::Create( run, units, periodstart, periodend ); // our create component expects a fully initialized runcontext (for which we need an AlgorithmRun first)
    context.Initialize( algrun );
    return run;
  *]
}