private void determineGlobalExtremumType ( ) { final double f = function ( alphaExtremum ) ; // create random alpha values double [ ] alpha_1 = new double [ alphaExtremum . length ] ; double [ ] alpha_2 = new double [ alphaExtremum . length ] ; for ( int i = 0 ; i < alphaExtremum . length ; i ++ ) { alpha_1 [ i ] = Math . random ( ) * Math . PI ; alpha_2 [ i ] = Math . random ( ) * Math . PI ; } // look if f1 and f2 are less, greater or equal to f double f1 = function ( alpha_1 ) ; double f2 = function ( alpha_2 ) ; if ( f1 < f && f2 < f ) { extremumType = ExtremumType . MAXIMUM ; } else if ( f1 > f && f2 > f ) { extremumType = ExtremumType . MINIMUM ; } else if ( Math . abs ( f1 - f ) < DELTA && Math . abs ( f2 - f ) < DELTA ) { extremumType = ExtremumType . CONSTANT ; } else { throw new IllegalStateException ( "Houston, we have a problem:" + "\n" + this + "\nextremum at " + FormatUtil . format ( alphaExtremum ) + "\nf " + f + "\nf1 " + f1 + "\nf2 " + f2 ) ; } }
Determines the type of the global extremum .