Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method UpdateStatistics ( 
 | 
  MathematicalProgram program, 
 | 
  Boolean isautoscalingenabled 
 | 
) 
 | 
{ 
 | 
  Description: 'Writes attributes related to numerical statistics. This should be done after optimizer run finished for current level.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    statistics := program.Statistics(); 
 | 
     
 | 
    //result side 
 | 
    this.Kappa( statistics.Kappa() ); 
 | 
    this.Remark( program.Remark() ); 
 | 
    this.PrimalInfeasibility( statistics.MaxPrimalInfeasibility() ); 
 | 
    this.DualInfeasibility( statistics.MaxDualInfeasibility() ); 
 | 
    this.PrimalResidual( statistics.MaxPrimalResidual() ); 
 | 
    this.DualResidual( statistics.MaxDualResidual() ); 
 | 
     
 | 
    //definition side 
 | 
    this.MinCoefficient( statistics.MinimumConstraintNonZero() ); 
 | 
    this.MaxCoefficient( statistics.MaximumConstraintNonZero() ); 
 | 
    this.MinGoalCoefficient( statistics.MinimumObjectiveNonZero() ); 
 | 
    this.MaxGoalCoefficient( statistics.MaximumObjectiveNonZero() ); 
 | 
    this.MinRHS( statistics.MinimumRHSNonZero() ); 
 | 
    this.MaxCoefficientRatio( statistics.MaximumCoefficientRatio() ); 
 | 
     
 | 
    if( this.MinRHS().IsInfinite() ) //prevent MaxReal from appearing 
 | 
    { 
 | 
      this.MinRHS( 0.0 ); 
 | 
    } 
 | 
    this.MaxRHS( statistics.MaximumRHSNonZero() ); 
 | 
     
 | 
    // To improve the performance, the min/max variable value statistics are only updated in autoscaling runs 
 | 
    if( isautoscalingenabled ) 
 | 
    { 
 | 
      sets := selectvalues( program, Variables, var, var.Enabled() and guard( var.OptimalValue() <> 0, false ), abs ( var.OptimalValue() ) );  
 | 
      sets := sets.Sort(); 
 | 
      if(  sets.Size() > 0 ) 
 | 
      {   
 | 
        this.MinVariableValue( sets.Element( 0 ) ); 
 | 
        this.MaxVariableValue( sets.Element( sets.Size() - 1 ) ); 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |