added functions to find optimised values for ANN