本文整理汇总了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());
}