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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method GetSuggestedScalingFactor ( 
 |    Real factor 
 |  ) declarative as Real 
 |  { 
 |    Description: 'Calculate the suggested scaling factor for test instance' 
 |    TextBody: 
 |    [* 
 |      // soh yee Mar-17-2015 (grouped existing logic) 
 |       
 |      upperbound := 1e7; 
 |       
 |      // Get the larget MaxVariableValue 
 |      maxvarvalue := max( this, AlgorithmRunLevel, level, abs( level.MaxVariableValue() ) ) 
 |       
 |      if( maxvarvalue > upperbound ) 
 |      { 
 |        maxvariablevaluefactor := maxvarvalue / factor; 
 |        adjustmentneed := maxvalue( maxvariablevaluefactor / upperbound, 1 );       // Scale the value 
 |       
 |        factor := AlgorithmRun::GetClosestNumberInPower( adjustmentneed, 10 );      // Make it stays as power of 10. e.g: 1, 10, 100, 1000 
 |      } 
 |       
 |      return factor; 
 |    *] 
 |  } 
 |  
  |