src/core/reinforcement/policy/executablepolicy/AbstractExecutablePolicy.java
public int action(Matrix policyValueMatrix, HashSet<Integer> availableActions, boolean alwaysGreedy) {
        TreeSet<ActionValueTuple> stateValueSet = new TreeSet<>(Comparator.comparingDouble(o -> o.value));
        for (Integer action : availableActions) {
            stateValueSet.add(new ActionValueTuple(action, !asSoftMax ? policyValueMatrix.getValue(action, 0) : Math.exp(policyValueMatrix.getValue(action, 0))));
        }
        return stateValueSet.isEmpty() ? -1 : alwaysGreedy ? Objects.requireNonNull(stateValueSet.pollLast()).action : getAction(stateValueSet);
    }
/**
     * Takes action based on policy.
     *
     * @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 action based on policy.

@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 action based on policy . @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) {
        TreeSet<ActionValueTuple> stateValueSet = new TreeSet<>(Comparator.comparingDouble(o -> o.value));
        for (Integer action : availableActions) {
            stateValueSet.add(new ActionValueTuple(action, !asSoftMax ? policyValueMatrix.getValue(action, 0) : Math.exp(policyValueMatrix.getValue(action, 0))));
        }
        return stateValueSet.isEmpty() ? -1 : alwaysGreedy ? Objects.requireNonNull(stateValueSet.pollLast()).action : getAction(stateValueSet);
    }
public int action ( Matrix policyValueMatrix , HashSet < Integer > availableActions , boolean alwaysGreedy ) { TreeSet < ActionValueTuple > stateValueSet = new TreeSet < > ( Comparator . comparingDouble ( o -> o . value ) ) ; for ( Integer action : availableActions ) { stateValueSet . add ( new ActionValueTuple ( action , ! asSoftMax ? policyValueMatrix . getValue ( action , 0 ) : Math . exp ( policyValueMatrix . getValue ( action , 0 ) ) ) ) ; } return stateValueSet . isEmpty ( ) ? - 1 : alwaysGreedy ? Objects . requireNonNull ( stateValueSet . pollLast ( ) ) . action : getAction ( stateValueSet ) ; }
Takes action based on policy.
Takes action based on policy .