Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
Quintiq file version 2.0
#parent: #root
Method DefaultScope (
  LibOpt_Optimizer optimizer
) as owning LibOpt_ScopeElements
{
  TextBody:
  [*
    scope := construct( LibOpt_ScopeElements );
    
    settings := optimizer.ActiveSettings().astype( OptimizerSettings ); 
    periodstart := minselect( this, MacroPlan.Period_MP, p, not p.IsHistorical(), p.StartDate() ); 
    periodend := this.MacroPlan().LastPlanningPeriod(); 
    
    periods := this.GetPeriodsForOTS( periodstart, periodend, settings ); 
    
    traverse( periods, Elements, p ) 
    {
      if ( isnull( p.PeriodInOptimizerRun() ) )
      {
        p.PeriodInOptimizerRun( relnew ); 
      }
      scope.Add( p.PeriodInOptimizerRun() ); 
    }
    
    
    traverse( this.GetLaneLegsForOptimization(), Elements, laneleg ) 
    {
      if ( isnull( laneleg.LaneLegForOptimization() ) ) 
      {
        laneleg.LaneLegForOptimization( relnew );   
      }
      scope.Add( laneleg.LaneLegForOptimization() ); 
    }
    
    optacccounts := selectset( this, MacroPlan.Account_MP, account, account.IsUsedByOptimizer() ) 
    traverse( optacccounts, Elements, account ) 
    {
      if ( isnull ( account.AccountInOptimizerRun() ) )
      {
        account.AccountInOptimizerRun( relnew ); 
      }
      scope.Add( account.AccountInOptimizerRun() ); 
    }
    
    puzzle := select( this, MacroPlan.OptimizerPuzzle, puzzle, true, puzzle.Name() = settings.PuzzleName() ); 
    if ( isnull( puzzle ) ) 
    {
      puzzle := this.MacroPlan().OptimizerPuzzleWorld(); 
    }
    if ( isnull( puzzle.OptimizerPuzzleInOptimizerRun() ) )
    {
      puzzle.OptimizerPuzzleInOptimizerRun( relnew ); 
    }
    
    scope.Add( puzzle.OptimizerPuzzleInOptimizerRun() ); 
    
    return &scope;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}