本文整理匯總了Java中burlap.behavior.policy.RandomPolicy類的典型用法代碼示例。如果您正苦於以下問題:Java RandomPolicy類的具體用法?Java RandomPolicy怎麽用?Java RandomPolicy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RandomPolicy類屬於burlap.behavior.policy包,在下文中一共展示了RandomPolicy類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DeepQLearner
import burlap.behavior.policy.RandomPolicy; //導入依賴的package包/類
public DeepQLearner(SADomain domain, double gamma, int replayStartSize, Policy policy, DQN vfa, StateMapping stateMapping) {
super(domain, gamma, vfa, stateMapping);
if (replayStartSize > 0) {
System.out.println(String.format("Starting with random policy for %d frames", replayStartSize));
this.replayStartSize = replayStartSize;
this.trainingPolicy = policy;
setLearningPolicy(new RandomPolicy(domain));
runningRandomPolicy = true;
} else {
setLearningPolicy(policy);
runningRandomPolicy = false;
}
}
示例2: main
import burlap.behavior.policy.RandomPolicy; //導入依賴的package包/類
public static void main(String[] args) {
GridWorldDomain gwd = new GridWorldDomain(11, 11);
Domain domain = gwd.generateDomain();
State s = GridWorldDomain.getOneAgentNoLocationState(domain, 1, 3);
Policy p = new RandomPolicy(domain);
EpisodeAnalysis ea = p.evaluateBehavior(s, new NullRewardFunction(), new NullTermination(), 30);
String yamlOut = ea.serialize();
System.out.println(yamlOut);
System.out.println("\n\n");
EpisodeAnalysis read = EpisodeAnalysis.parseEpisode(domain, yamlOut);
System.out.println(read.getActionSequenceString());
System.out.println(read.getState(0).toString());
System.out.println(read.actionSequence.size());
System.out.println(read.stateSequence.size());
}
示例3: main
import burlap.behavior.policy.RandomPolicy; //導入依賴的package包/類
public static void main(String[] args) {
GridWorldDomain gwd = new GridWorldDomain(11, 11);
SADomain domain = gwd.generateDomain();
State s = new GridWorldState(new GridAgent(1, 3));
Policy p = new RandomPolicy(domain);
Episode ea = PolicyUtils.rollout(p, s, domain.getModel(), 30);
String yamlOut = ea.serialize();
System.out.println(yamlOut);
System.out.println("\n\n");
Episode read = Episode.parseEpisode(yamlOut);
System.out.println(read.actionString());
System.out.println(read.state(0).toString());
System.out.println(read.actionSequence.size());
System.out.println(read.stateSequence.size());
}