Quintiq file version 2.0 
 | 
#parent: #root 
 | 
MethodOverride CreateIssues 
 | 
{ 
 | 
  Description: 'Create `LibOpt_Issues` to highlight potential issues about values collected by this `LibOpt_StatisticTimeSuboptimizer`.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // lle13 Oct-1-2020 (created) 
 | 
     
 | 
    valuesvector := RealVector::Construct( this.ValuesAsRealVector() ); 
 | 
     
 | 
    // Check for lower threshold violations. 
 | 
    booleanvector_lowerthresholdviolation := valuesvector.SmallerThan( this.LowerThreshold() ); 
 | 
    indexvector_lowerthresholdviolation := booleanvector_lowerthresholdviolation.AsIndexVector(); 
 | 
    haslowerthresholdviolations := indexvector_lowerthresholdviolation.Size() > 0; 
 | 
     
 | 
    // Check for upper threshold violations. 
 | 
    booleanvector_upperthresholdviolation := valuesvector.GreaterThan( this.UpperThreshold() ); 
 | 
    indexvector_upperthresholdviolation := booleanvector_upperthresholdviolation.AsIndexVector(); 
 | 
    hasupperthresholdviolations := indexvector_upperthresholdviolation.Size() > 0; 
 | 
     
 | 
    // Create issues if there are violations. 
 | 
    if( haslowerthresholdviolations or hasupperthresholdviolations ) 
 | 
    { 
 | 
      // Variables needed for Issues creation. 
 | 
      issuetype := this.GetIssueType(); 
 | 
      algorithmsnapshots := selectsortedset( this, Suboptimizer.SnapshotComponent.Children.astype( LibOpt_SnapshotAlgorithm ), algorithmsnapshot, 
 | 
                                             // FILTER 
 | 
                                             true, 
 | 
                                             // VALUE 
 | 
                                             algorithmsnapshot.SequenceNr() 
 | 
                                           ); 
 | 
       
 | 
      if( haslowerthresholdviolations ) 
 | 
      { 
 | 
        severityscaleentries_lowerthresholdviolation := LibOpt_Statistic::GetSeverityScaleEntriesSortedByThreshold( this.GetSeverityScaleForLowerThresholdViolation() ); 
 | 
         
 | 
        traverse( indexvector_lowerthresholdviolation.AsValues(), Elements, index ) 
 | 
        { 
 | 
          value := valuesvector.Get( index ); 
 | 
           
 | 
          // Create an Issue and link it to the relevant Snapshot. 
 | 
          algorithmsnapshot := algorithmsnapshots.Element( index ); 
 | 
          LibOpt_Issue::Create( this, 
 | 
                                algorithmsnapshot, 
 | 
                                this.GetIssueType(), 
 | 
                                this.Focus() 
 | 
                                  + ', ' + Translations::LibOpt_Suboptimizer_ExecutionNr( algorithmsnapshot.ExecutionNr() ) 
 | 
                                  + ', ' + Translations::LibOpt_IterationNr( algorithmsnapshot.GetIteration().IterationNr(), this.Run().TotalNrOfIterations() ), 
 | 
                                this.GetSeverity( value, false /*is upper threshold violation*/, severityscaleentries_lowerthresholdviolation ), 
 | 
                                this.GetIssueDetails( value ) 
 | 
                              ); 
 | 
        } 
 | 
      } 
 | 
     
 | 
      if( hasupperthresholdviolations ) 
 | 
      { 
 | 
        severityscaleentries_upperthresholdviolation := LibOpt_Statistic::GetSeverityScaleEntriesSortedByThreshold( this.GetSeverityScaleForUpperThresholdViolation() ); 
 | 
         
 | 
        traverse( indexvector_upperthresholdviolation.AsValues(), Elements, index ) 
 | 
        { 
 | 
          value := valuesvector.Get( index ); 
 | 
           
 | 
          // Create an Issue and link it to the relevant Snapshot. 
 | 
          algorithmsnapshot := algorithmsnapshots.Element( index ); 
 | 
          LibOpt_Issue::Create( this, 
 | 
                                algorithmsnapshot, 
 | 
                                issuetype, 
 | 
                                this.Focus() 
 | 
                                  + ', ' + Translations::LibOpt_Suboptimizer_ExecutionNr( algorithmsnapshot.ExecutionNr() ) 
 | 
                                  + ', ' + Translations::LibOpt_IterationNr( algorithmsnapshot.GetIteration().IterationNr(), this.Run().TotalNrOfIterations() ), 
 | 
                                this.GetSeverity( value, true /*is upper threshold violation*/, severityscaleentries_upperthresholdviolation ), 
 | 
                                this.GetIssueDetails( value ) 
 | 
                              ); 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |