
com.github.chen0040.rl.actionselection.SoftMaxActionSelectionStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-reinforcement-learning Show documentation
Show all versions of java-reinforcement-learning Show documentation
Classical RL algorithms implemented in Java, including Q-Learn, R-Learn, SARSA, Actor-Critic
package com.github.chen0040.rl.actionselection;
import com.github.chen0040.rl.utils.IndexValue;
import com.github.chen0040.rl.models.QModel;
import java.util.Random;
import java.util.Set;
/**
* Created by xschen on 9/27/2015 0027.
*/
public class SoftMaxActionSelectionStrategy extends AbstractActionSelectionStrategy {
private Random random = new Random();
@Override
public Object clone(){
SoftMaxActionSelectionStrategy clone = new SoftMaxActionSelectionStrategy(random);
return clone;
}
@Override
public boolean equals(Object obj){
return obj != null && obj instanceof SoftMaxActionSelectionStrategy;
}
public SoftMaxActionSelectionStrategy(){
}
public SoftMaxActionSelectionStrategy(Random random){
this.random = random;
}
@Override
public IndexValue selectAction(int stateId, QModel model, Set actionsAtState) {
return model.actionWithSoftMaxQAtState(stateId, actionsAtState, random);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy