lazhen
2025-01-07 b3987122cbbc46c5c59d3173f37fca3170b6dc5a
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
Quintiq file version 2.0
#parent: #root
Method RunCapacityPlanningAlgorithm (
  AlgorithmRun algorithmrun,
  ProductInStockingPointInPeriodPlannings pispipssmartplan,
  Period_MP periodstart,
  Period_MP periodend,
  Units units,
  Process_MP process,
  OptimizerPuzzle optimizerpuzzle
) as stream[JSON]
{
  Description: 'Executes capacity planning for all demands within the planning horizon of MacroPlanner'
  TextBody:
  [*
    // Select the periods that are in the optimizer horizon
    periods := this.Optimization().GetOptimizerPeriods( periodstart, periodend );  
    verify( periods.Size() > 0, Translations::Algorithm_MP_NoPeriodsAvailableError() ); 
    verify( not isnull( optimizerpuzzle ), Translations::Algorithm_MP_NoOptimizerPuzzleAvailableError() ); 
    
    //
    // ********************** Calling optimizer **********************
    // 
    opt := this.Optimization(); 
    s := null( stream[JSON] ); 
    
    if ( algorithmrun.IsSmartPlan() ) 
    {
      osp := opt.GetOptimizerSmartPlan(); 
      s := osp.Execute( algorithmrun, 
                        pispipssmartplan, 
                        opt.GetLaneLegsForOptimization(), 
                        periods, 
                        units, 
                        algorithmrun.IsUsingSelectedUnits(), 
                        process, 
                        this.GlobalParameters_MP().NumberOfPeriodsSmartPlan(), 
                        algorithmrun.IsUpstreamSmartPlan(), 
                        algorithmrun.IsMiddleOutSmartPlan(), 
                        optimizerpuzzle ); 
    }
    else if ( this.StrategyMacroPlan().UseMetaOptimizer() ) 
    {
      opmeta := opt.GetOptimizerMeta(); 
      s := opmeta.Execute( algorithmrun, periods, units, optimizerpuzzle ); 
    }
    else
    {
      ofrun := opt.GetOptimizerFullRun(); 
      s := ofrun.Execute( algorithmrun, units, periods, optimizerpuzzle ); 
    }
    return s;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}