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
Quintiq file version 2.0
#parent: #root
FunctionOverride CalcSeverity
{
  TextBody:
  [*
    // mlr7 Oct-10-2020 (created)
    value := 0.0;
    if( this.Issue( relsize ) > 0 )
    {
      subOpt := this.Suboptimizer();
      acceptableThreshold := subOpt.AcceptableRollbackThreshold();
      rollbackPercent := subOpt.RollbackPercent();
      issueSeverity := average( this, Issue, i, i.Severity() );
      if( rollbackPercent < acceptableThreshold * 0.5 )
      {
        //keep the severity low while below the threshold
        value := LibOpt_Issue::Severity_2_Low();
      }
      else if( rollbackPercent > acceptableThreshold * 1.5 )
      {
        //set high severity over 1.5 times the acceptable threshold
        value := LibOpt_Issue::Severity_4_High();
      }
      else
      {
        issueSeverity := average( this, Issue, i, i.Severity() );
        ratio := guard( rollbackPercent / acceptableThreshold, 1.0 );
        //bound the severity to LB of Low and UB of High so the piecewise function connects
        value := maxvalue( LibOpt_Issue::Severity_2_Low(), minvalue( LibOpt_Issue::Severity_4_High(), ratio * issueSeverity ) );
      }
    }
    
    this.Severity( value );
  *]
}