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 ); 
 | 
  *] 
 | 
} 
 |