src/core/reinforcement/policy/executablepolicy/EpsilonGreedyPolicy.java
public int action(Matrix policyValueMatrix, HashSet<Integer> availableActions, boolean alwaysGreedy) {
        if (Math.random() < epsilon) {
            Object[] availableActionsArray = availableActions.toArray();
            return (int)availableActionsArray[random.nextInt(availableActionsArray.length)];
        }
        else return super.action(policyValueMatrix, availableActions, alwaysGreedy);
    }
/**
     * Takes epsilon greedy action.
     *
     * @param policyValueMatrix current state value matrix.
     * @param availableActions available actions in current state
     * @param alwaysGreedy if true greedy action is always taken.
     * @return action taken.
     */
Takes epsilon greedy action.
@param policyValueMatrix current state value matrix.
@param availableActions available actions in current state
@param alwaysGreedy if true greedy action is always taken.
@return action taken.
Takes epsilon greedy action . @param policyValueMatrix current state value matrix . @param availableActions available actions in current state @param alwaysGreedy if true greedy action is always taken . @return action taken .
public int action(Matrix policyValueMatrix, HashSet<Integer> availableActions, boolean alwaysGreedy) {
        if (Math.random() < epsilon) {
            Object[] availableActionsArray = availableActions.toArray();
            return (int)availableActionsArray[random.nextInt(availableActionsArray.length)];
        }
        else return super.action(policyValueMatrix, availableActions, alwaysGreedy);
    }
public int action ( Matrix policyValueMatrix , HashSet < Integer > availableActions , boolean alwaysGreedy ) { if ( Math . random ( ) < epsilon ) { Object [ ] availableActionsArray = availableActions . toArray ( ) ; return ( int ) availableActionsArray [ random . nextInt ( availableActionsArray . length ) ] ; } else return super . action ( policyValueMatrix , availableActions , alwaysGreedy ) ; }
Takes epsilon greedy action.
Takes epsilon greedy action .