当前位置: 首页>>代码示例>>Java>>正文


Java Action.toString方法代码示例

本文整理汇总了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());
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:19,代码来源:DifferentiableSparseSampling.java

示例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.");
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:19,代码来源:SparseSampling.java

示例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");
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:24,代码来源:UCT.java

示例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;
}
 
开发者ID:h2r,项目名称:burlap_rosbridge,代码行数:32,代码来源:AbstractRosEnvironment.java

示例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;
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:37,代码来源:TabularModel.java

示例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());
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:15,代码来源:BWModel.java

示例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;
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:28,代码来源:FrostbiteModel.java

示例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;
}
 
开发者ID:h2r,项目名称:burlap_rosbridge,代码行数:7,代码来源:ActionStringPublisher.java


注:本文中的burlap.mdp.core.action.Action.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。