本文整理汇总了Java中burlap.mdp.core.action.Action.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Action.toString方法的具体用法?Java Action.toString怎么用?Java Action.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类burlap.mdp.core.action.Action
的用法示例。
在下文中一共展示了Action.toString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: qValue
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public double qValue(State s, Action a) {
HashableState sh = this.hashingFactory.hashState(s);
QAndQGradient qvs = this.rootLevelQValues.get(sh);
if(qvs == null){
this.planFromState(s);
qvs = this.rootLevelQValues.get(sh);
}
for(QValue qv : qvs.qs){
if(qv.a.equals(a)){
return qv.q;
}
}
throw new RuntimeException("Could not find a Q-value for: " + a.toString());
}
示例2: qValue
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public double qValue(State s, Action a) {
HashableState sh = this.hashingFactory.hashState(s);
List<QValue> qs = this.rootLevelQValues.get(sh);
if(qs == null){
this.planFromState(s);
qs = this.rootLevelQValues.get(sh);
}
for(QValue qv : qs){
if(qv.a.equals(a)){
return qv.q;
}
}
throw new RuntimeException("Q-value for action " + a.toString() +" does not exist.");
}
示例3: qValue
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public double qValue(State s, Action a) {
//if we haven't done any planning, then do so now
if(this.root == null){
this.planFromState(s);
}
//if the root node isn't the query state, then replan
HashableState sh = this.hashingFactory.hashState(s);
if(!sh.equals(this.root.state)){
this.resetSolver();
this.planFromState(s);
}
for(UCTActionNode act : this.root.actionNodes){
if(act.action.equals(a)){
return act.averageReturn();
}
}
throw new RuntimeException("UCT does not know about action: " + a.toString() + "; cannot return Q-value for it");
}
示例4: executeAction
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public EnvironmentOutcome executeAction(Action a) {
State startState = this.currentObservation();
ActionPublisher ap = this.actionPublishers.get(a.actionName());
if(ap == null){
throw new RuntimeException("AbstractRosEnvironment has no ActionPublisher available to handle action " + a.toString());
}
int delay = ap.publishAction(a);
if(delay > 0){
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
State finalState = this.currentObservation();
this.lastReward = this.getMostRecentRewardSignal(startState, a, finalState);
EnvironmentOutcome eo = new EnvironmentOutcome(startState, a, finalState, this.lastReward, this.isInTerminalState());
if(this.isInTerminalState()){
this.handleEnterTerminalState();
}
return eo;
}
示例5: getOrCreateActionNode
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
/**
* Returns the {@link TabularModel.StateActionNode} object associated with the given hashed state and action.
* If there is not an associated {@link TabularModel.StateActionNode} object, then one will be created.
* @param sh the hashed state
* @param ga the grounded action
* @return the associated {@link TabularModel.StateActionNode}
*/
protected StateActionNode getOrCreateActionNode(HashableState sh, Action ga){
StateNode sn = this.stateNodes.get(sh);
StateActionNode toReturn = null;
if(sn == null){
sn = new StateNode(sh);
this.stateNodes.put(sh, sn);
//List <GroundedAction> allActions = sh.s.getAllGroundedActionsFor(this.sourceDomain.getActions());
List<Action> allActions = ActionUtils.allApplicableActionsForTypes(this.sourceDomain.getActionTypes(), sh.s());
for(Action tga : allActions){
StateActionNode san = sn.addActionNode(tga);
if(tga.equals(ga)){
toReturn = san;
}
}
}
else{
toReturn = sn.actionNode(ga);
}
if(toReturn == null){
throw new RuntimeException("Could not finding matching grounded action in model for action: " + ga.toString());
}
return toReturn;
}
示例6: sample
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public State sample(State s, Action a) {
BlocksWorldState bs = (BlocksWorldState)s.copy();
if(a.actionName().equals(ACTION_STACK)){
return stack(bs, (ObjectParameterizedAction)a);
}
else if(a.actionName().equals(ACTION_UNSTACK)){
return unstack(bs, (ObjectParameterizedAction)a);
}
throw new RuntimeException("Unknown action " + a.toString());
}
示例7: sample
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public State sample(State s, Action a) {
FrostbiteState fs = (FrostbiteState)s.copy();
String aname = a.actionName();
if(aname.equals(ACTION_EAST)){
move(fs, 1, 0);
}
else if(aname.equals(ACTION_WEST)){
move(fs, -1, 0);
}
else if(aname.equals(ACTION_NORTH)){
move(fs, 0, -1);
}
else if(aname.equals(ACTION_SOUTH)){
move(fs, 0, 1);
}
else if(aname.equals(ACTION_IDLE)){
move(fs, 0, 0);
}
else{
throw new RuntimeException("Unknown action " + a.toString());
}
return fs;
}
示例8: publishAction
import burlap.mdp.core.action.Action; //导入方法依赖的package包/类
@Override
public int publishAction(Action a) {
PrimitiveMsg<String> msg =new PrimitiveMsg<String>(a.toString());
this.publish(msg);
return this.delayTime;
}