From df9a3435dd333c445e57a1aeb2b5ee702ecce7b5 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Fri, 18 Mar 2016 13:59:46 +0000 Subject: [PATCH] Reverted check if two fitness values are the same (shouldn't happen if fitness function has been designed correctly). --- gprMax/optimisation_taguchi.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gprMax/optimisation_taguchi.py b/gprMax/optimisation_taguchi.py index 97cdea5a..e7a211ca 100644 --- a/gprMax/optimisation_taguchi.py +++ b/gprMax/optimisation_taguchi.py @@ -378,7 +378,13 @@ def calculate_optimal_levels(optparams, levels, levelsopt, fitnessvalues, OA, N, responses[2] /= cnt3 # Calculate optimal level from table of responses - levelsopt[p] = np.where(responses == np.amax(responses))[0] + optlevel = np.where(responses == np.amax(responses))[0] + + # If 2 experiments produce the same fitness value (this shouldn't happen if the fitness function is designed correctly) + if len(optlevel): + optlevel = optlevel[0] + + levelsopt[p] = optlevel # Update dictionary of parameters to optimise with lists of new values; clear dictionary first optparams = OrderedDict((key, list()) for key in optparams)