public double funct(double x[]) {
        for (int j = 0; j < parameters.length; j++) {
            parameters[j] = x[j];
        }

        //model run
//        singleRun();
        currentCount++;

        //getting rid of pairs which contain missing data values
        double[] preArr = prediction;
        double[] obsArr = observation;

        Vector<Double> obsVector = new Vector<Double>();
        Vector<Double> preVector = new Vector<Double>();
        for (int i = 0; i < preArr.length; i++) {
            //consider valid values only
            if (preArr[i] > -9999 && obsArr[i] > -9999) {
                obsVector.add(obsArr[i]);
                preVector.add(preArr[i]);
            }
        }
        int dataCount = obsVector.size();
        obsArr = new double[dataCount];
        preArr = new double[dataCount];

        //converting Vectors to arrays
        for (int i = 0; i < dataCount; i++) {
            obsArr[i] = obsVector.get(i).doubleValue();
            preArr[i] = preVector.get(i).doubleValue();
        }

        //efficiency calculation
        if (effMethodName.equals("e2")) {
            return (-1 * Statistics.nashSutcliffe(preArr, obsArr, 2, -9999));
        } else if (effMethodName.equals("e1")) {
            return (-1 * Statistics.nashSutcliffe(preArr, obsArr, 1, -9999));
        } else if (effMethodName.equals("le2")) {
            return (-1 * Statistics.nashSutcliffeLog(obsArr, preArr, 2));
        } else if (effMethodName.equals("pbias")) {
            return (Math.abs(Statistics.pbias(obsArr, preArr)));
        } else {
            return -9999;
        }
    }