public void calculateAndSetValues()
    {
        double val[] = mdpData.getValue();
        double prevVal[] = null;;
        
        int actionIndicesOfPolicy[] = new int[mdpData.getNoOfStates()];
        StateData tempState;
        for(int i=0; i<mdpData.getNoOfStates(); i++)
        {
            tempState = mdpData.getStateList().get(i);
            for(int j=0; j<tempState.getNoOfActions(); j++)
            {
                if(tempState.getActionList().get(j).getProbDist() == 1.0)
                {
                    actionIndicesOfPolicy[i] = j;
                    break;
                }
            }
        }
        
        while(!checkTerminationForValueIteration(prevVal, val))
        {
            prevVal = val;
            val = new double[mdpData.getNoOfStates()];
            double tempActionVal;
            int stateCounter;
            ArrayList<Double> transitionList;
            for(int i=0; i<mdpData.getNoOfStates(); i++)
            {
                tempActionVal =  mdpData.getStateList().get(i).getActionList().get(actionIndicesOfPolicy[i]).getReward();
                transitionList = mdpData.getStateList().get(i).getActionList().get(actionIndicesOfPolicy[i]).getTransitionFunc();
                for(stateCounter=0; stateCounter<mdpData.getNoOfStates(); stateCounter++)
                {
                    tempActionVal = tempActionVal + mdpData.getGamma() * (transitionList.get(stateCounter) * prevVal[stateCounter]);                    
                }
                val[i] = tempActionVal;
            }
        }
        mdpData.setValue(val);
    }