你怎么能在Burlap中创建图域的初始状态节点?

时间:2017-01-24 11:19:37

标签: java reinforcement-learning

https://classroom.udacity.com/courses/ud600/lessons/3780788560/concepts/40374085350923

在上面的链接中,它指的是为了创建图域的初始状态,您执行以下命令: GraphDefinedDomain.getState(domain,0)

getState 不存在作为当前Burlap库的静态方法。

那么如何在Burlap(http://burlap.cs.brown.edu/)中创建图域的初始状态节点?

(我看到的版本是什么,从那时起Burlac的变化有多少,我在哪里可以找到迁移指南?还可以提供帮助)

1 个答案:

答案 0 :(得分:0)

我有同样的问题。经过一些研究后,我找到了GraphStateNode课,这似乎有效。

请参阅下面的代码示例:

public FirstMDP(double p1, double p2, double p3, double p4) {
    this.numStates = 6;
    this.dg = new GraphDefinedDomain(numStates);

    // actions for initial state 0
    ((GraphDefinedDomain) this.dg).setTransition(0,0,1,1.); //action a
    ((GraphDefinedDomain) this.dg).setTransition(0,1,2,1.); //action b
    ((GraphDefinedDomain) this.dg).setTransition(0,2,3,1.); //action c

    // actions for all the other states
    ((GraphDefinedDomain) this.dg).setTransition(1,0,1,1.); //action for state 1
    ((GraphDefinedDomain) this.dg).setTransition(2,0,4,1.); //action for state 2
    ((GraphDefinedDomain) this.dg).setTransition(3,0,5,1.); //action for state 3
    ((GraphDefinedDomain) this.dg).setTransition(4,0,2,1.); //action for state 4
    ((GraphDefinedDomain) this.dg).setTransition(5,0,5,1.); //action for state 5    

    this.domain = this.dg.generateDomain();
    this.initState = new GraphStateNode();  // Initial state is created
    ((GraphStateNode) this.initState).setId(0); // Initial state is initialized
    this.rf = new FourParamRF(p1,p2,p3,p4);
    this.tf = new NullTermination();
    this.hashFactory = new SimpleHashableStateFactory();
}

确保导入GraphStateNode类:

import burlap.domain.singleagent.graphdefined.GraphStateNode;

如果有帮助,请告诉我。