# Algorithm Diagnostics Walkthrough using the Lake Problem as an example (Part 3 of 3: Metrics-based analysis of algorithm performance)

Now that you have your desired metrics based on part 2 of this series, it is possible to gain more insight into your algorithm performance. When I performed this analysis for the actual study, I used the AWRAnalysis.java, Analysis_Attainment_LakeProblem.sh and HypervolumeEval.java files found in the Github repository as explained in the README. I later discovered it was possible to do this within the framework, so that option will be discussed here.

It is possible to calculate the hypervolume of a Pareto Approximate Front within the framework using the SetHypervolume class. For more information on the MOEAFramework classes, please see the following link (http://moeaframework.org/javadoc/index.html).

I used the following command: (Note the change to version 2.3 because I reran this command today to check I remembered it correctly although it seems there is now a version 2.4. It is always best to use the newest version.)

```
java –cp MOEAFramework-2.3-Demo.jar org.moeaframework.analysis.sensitivity.SetHypervolume myLake4ObjStoch.reference –e 0.01,0.01,0.0001,0.0001 myLake4ObjStoch.reference

```

This returns a hypervolume value between 0 and 1 that is useful for threshold calculations as shown below.

To calculate threshold attainments, use the Analysis class. Below is an example of performing attainment analysis within the framework instead of using AWRAnalysis.java.  This approach generates a huge number of files, which are best understood when plotted, a subject for a future post.

```
#!/bin/bash
#source setup_LTM.sh

dim=4
problem=myLake4ObjStoch
epsilon="0.01,0.01,0.0001,0.0001"

algorithms="Borg eMOEA eNSGAII GDE3 MOEAD NSGAII"
seeds="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50"
percentiles="`seq 1 1 100`"
thresholds=(`seq 0.01 0.01 1.0`)

#compute averages across metrics
#echo "Computing averages across metrics..."
#for algorithm in \${algorithms}
#do
# echo "Working on: " \${algorithm}
# java -classpath `cygpath -wp \$CLASSPATH` org.moeaframework.analysis.sensitivity.MetricFileStatistics --mode average --output \$WORK/metrics/\${algorithm}_\${problem}.average \$WORK/metrics/\${algorithm}_\${problem}_*.metrics
#done
#echo "Done!"

#compute search control metrics (for best and attainment)
echo "Computing hypervolume search control metrics..."
for algorithm in \${algorithms}
do
echo "Working on: " \${algorithm}
counter=\$1
for percentile in \${percentiles}
do
java -classpath MOEAFramework-2.3-Demo.jar org.moeaframework.analysis.sensitivity.Analysis --parameterFile ./\${algorithm}_params.txt --parameters ./\${algorithm}_Latin --metric 0 --threshold \${thresholds[\$counter]} --hypervolume 0.7986 ./SOW6/metrics/average_replace_NaNs/\${algorithm}_\${problem}.average > ./test/Hypervolume_\${percentile}_\${algorithm}.txt
counter=\$((counter+1))
done
done
echo "Done!"

echo "Computing generational distance search control metrics..."
for algorithm in \${algorithms}
do
echo "Working on: " \${algorithm}
counter=\$1
for percentile in \${percentiles}
do
java -classpath MOEAFramework-2.3-Demo.jar org.moeaframework.analysis.sensitivity.Analysis --parameterFile ./\${algorithm}_params.txt --parameters ./\${algorithm}_Latin --metric 1 --threshold \${thresholds[\$counter]} ./SOW6/metrics/average_replace_NaNs/\${algorithm}_\${problem}.average > ./test/GenDist_\${percentile}_\${algorithm}.txt
counter=\$((counter+1))
done
done
echo "Done!"

echo "Computing additive epsilon indicator search control metrics..."
for algorithm in \${algorithms}
do
echo "Working on: " \${algorithm}
counter=\$1
for percentile in \${percentiles}
do
java -classpath MOEAFramework-2.3-Demo.jar org.moeaframework.analysis.sensitivity.Analysis --parameterFile ./\${algorithm}_params.txt --parameters ./\${algorithm}_Latin --metric 4 --threshold \${thresholds[\$counter]} ./SOW6/metrics/average_replace_NaNs/\${algorithm}_\${problem}.average > ./test/EpsInd_\${percentile}_\${algorithm}.txt
counter=\$((counter+1))
done
done
echo "Done!"

```

I did encounter some caveats while working through this process. Scripts for handling them and instructions are provided in the Diagnostic-Source README on Github. One caveat that is not covered there is increasing the speed of the hypervolume calculation. Please see Dave Hadka’s Hypervolume repository for more information (https://github.com/dhadka/Hypervolume).