yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
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
Quintiq file version 2.0
#parent: #root
Method GetKPI (
  Boolean includeintbased,
  Boolean intbasedonly,
  const WeightLevelNonFinancial weightlevels,
  output RealVector financialvec_o,
  output RealVector financialvec_pos_o,
  output String financialdescr
) as owning RealVector
{
  TextBody:
  [*
    maxlevel := this.MaxLevel() ; 
    result := RealVector::Construct( maxlevel + 1 ); // 1 more for slack level
    financialvec_o.Resize( maxlevel + 1, 0.0 ); // 1 more for slack level
    financialvec_pos_o.Resize( maxlevel + 1, 0.0 ); // 1 more for slack level
    applyrounding := this.RoundPuzzleScoreDecimal() >= 0; 
    financialdescr := ''; 
    for ( i := 0; i <= maxlevel; i++ ) 
    {
      minweightused := Real::MaxReal(); 
      maxweightused := 0.0; 
      fdescr := ''; 
      score_vec := this.GetPuzzleScore( i, includeintbased, intbasedonly, weightlevels, minweightused, maxweightused, fdescr ); 
      score := score_vec.Get( 0 ); 
      score_financial := score_vec.Get( 2 ); 
      score_financialpos := score_vec.Get( 3 ); 
      if ( not fdescr = '' )
      { 
        financialdescr := financialdescr + 'level=' + [String] i + fdescr; 
      }
      if ( applyrounding ) 
      {
        score := score.Round( this.RoundPuzzleScoreDecimal() ); 
        score_financial := score_financial.Round( this.RoundPuzzleScoreDecimal() ); 
        score_financialpos := score_financialpos.Round( this.RoundPuzzleScoreDecimal() ); 
      }
      result.Set( i, score / maxvalue(  1.0, maxweightused ) );   
      financialvec_o.Set( i, score_financial / maxvalue(  1.0, maxweightused ) );   
      financialvec_pos_o.Set( i, score_financialpos / maxvalue(  1.0, maxweightused ) );   
    }    
    return &result
  *]
  InterfaceProperties { Accessibility: 'Module' }
}