protected boolean considerCandidate ( double fx_candidate , double fx_prev , double predictedReduction , double stepLength ) { // compute model prediction accuracy double actualReduction = fx_prev - fx_candidate ; if ( actualReduction == 0 || predictedReduction == 0 ) { if ( verbose != null ) verbose . println ( totalFullSteps + " reduction of zero" ) ; return true ; } double ratio = actualReduction / predictedReduction ; if ( fx_candidate > fx_prev || ratio < 0.25 ) { // if the improvement is too small (or not an improvement) reduce the region size regionRadius = 0.5 * regionRadius ; } else { if ( ratio > 0.75 ) { regionRadius = min ( max ( 3 * stepLength , regionRadius ) , config . regionMaximum ) ; } } // The new state has been accepted. See if it has converged and change the candidate state to the actual state if ( fx_candidate < fx_prev && ratio > 0 ) { boolean converged = checkConvergenceFTest ( fx_candidate , fx_prev ) ; if ( verbose != null ) { verbose . printf ( "%-4d %9.3E %10.3E %9.3E %9.3E %9.3E %6.2f %6.2E\n" , totalSelectSteps , fx_candidate , fx_candidate - fx_prev , stepLength , ftest_val , gtest_val , ratio , regionRadius ) ; if ( converged ) { System . out . println ( "Converged f-test" ) ; } } return acceptNewState ( converged , fx_candidate ) ; } else { mode = Mode . DETERMINE_STEP ; return false ; } }
Consider updating the system with the change in state p . The update will never be accepted if the cost function increases .