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


Java SparseSampling.setValueForLeafNodes方法代码示例

本文整理汇总了Java中burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling.setValueForLeafNodes方法的典型用法代码示例。如果您正苦于以下问题:Java SparseSampling.setValueForLeafNodes方法的具体用法?Java SparseSampling.setValueForLeafNodes怎么用?Java SparseSampling.setValueForLeafNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling的用法示例。


在下文中一共展示了SparseSampling.setValueForLeafNodes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runIteration

import burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling; //导入方法依赖的package包/类
/**
 * Runs a single iteration of value iteration. Note that if the state samples have not been set, it will throw a runtime exception.
 * @return the maximum change in the value function.
 */
public double runIteration(){

	if(this.samples == null){
		throw new RuntimeException("FittedVI cannot run value iteration because the state samples have not been set. Use the setSamples method or the constructor to set them.");
	}

	SparseSampling ss = new SparseSampling(this.domain, this.rf, this.tf, this.gamma, this.hashingFactory, this.planningDepth, this.transitionSamples);
	ss.setValueForLeafNodes(this.leafNodeInit);
	ss.toggleDebugPrinting(false);

	List <SupervisedVFA.SupervisedVFAInstance> instances = new ArrayList<SupervisedVFA.SupervisedVFAInstance>(this.samples.size());
	List <Double> oldVs = new ArrayList<Double>(this.samples.size());
	for(State s : this.samples){
		oldVs.add(this.valueFunction.value(s));
		instances.add(new SupervisedVFA.SupervisedVFAInstance(s, QFunctionHelper.getOptimalValue(ss, s)));
	}

	this.valueFunction = this.valueFunctionTrainer.train(instances);

	double maxDiff = 0.;
	for(int i = 0; i < this.samples.size(); i++){
		double newV = this.valueFunction.value(this.samples.get(i));
		double diff = Math.abs(newV - oldVs.get(i));
		maxDiff = Math.max(maxDiff, diff);
	}

	return maxDiff;

}
 
开发者ID:f-leno,项目名称:DOO-Q_BRACIS2016,代码行数:34,代码来源:FittedVI.java

示例2: getQs

import burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling; //导入方法依赖的package包/类
@Override
public List<QValue> getQs(State s) {
	SparseSampling ss = new SparseSampling(this.domain, this.rf, this.tf, this.gamma, this.hashingFactory, this.controlDepth, this.transitionSamples);
	ss.setValueForLeafNodes(this.leafNodeInit);
	ss.toggleDebugPrinting(false);
	return ss.getQs(s);
}
 
开发者ID:f-leno,项目名称:DOO-Q_BRACIS2016,代码行数:8,代码来源:FittedVI.java

示例3: getQ

import burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling; //导入方法依赖的package包/类
@Override
public QValue getQ(State s, AbstractGroundedAction a) {
	SparseSampling ss = new SparseSampling(this.domain, this.rf, this.tf, this.gamma, this.hashingFactory, this.controlDepth, this.transitionSamples);
	ss.setValueForLeafNodes(this.leafNodeInit);
	ss.toggleDebugPrinting(false);
	return ss.getQ(s, a);
}
 
开发者ID:f-leno,项目名称:DOO-Q_BRACIS2016,代码行数:8,代码来源:FittedVI.java

示例4: runIteration

import burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling; //导入方法依赖的package包/类
/**
 * Runs a single iteration of value iteration. Note that if the state samples have not been set, it will throw a runtime exception.
 * @return the maximum change in the value function.
 */
public double runIteration(){

	if(this.samples == null){
		throw new RuntimeException("FittedVI cannot run value iteration because the state samples have not been set. Use the setSamples method or the constructor to set them.");
	}

	SparseSampling ss = new SparseSampling(this.domain, this.gamma, this.hashingFactory, this.planningDepth, this.transitionSamples);
	ss.setModel(this.model);
	ss.setValueForLeafNodes(this.leafNodeInit);
	ss.toggleDebugPrinting(false);

	List <SupervisedVFA.SupervisedVFAInstance> instances = new ArrayList<SupervisedVFA.SupervisedVFAInstance>(this.samples.size());
	List <Double> oldVs = new ArrayList<Double>(this.samples.size());
	for(State s : this.samples){
		oldVs.add(this.valueFunction.value(s));
		instances.add(new SupervisedVFA.SupervisedVFAInstance(s, Helper.maxQ(ss, s)));
	}

	this.valueFunction = this.valueFunctionTrainer.train(instances);

	double maxDiff = 0.;
	for(int i = 0; i < this.samples.size(); i++){
		double newV = this.valueFunction.value(this.samples.get(i));
		double diff = Math.abs(newV - oldVs.get(i));
		maxDiff = Math.max(maxDiff, diff);
	}

	return maxDiff;

}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:35,代码来源:FittedVI.java

示例5: qValues

import burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling; //导入方法依赖的package包/类
@Override
public List<QValue> qValues(State s) {
	SparseSampling ss = new SparseSampling(this.domain, this.gamma, this.hashingFactory, this.controlDepth, this.transitionSamples);
	ss.setModel(model);
	ss.setValueForLeafNodes(this.leafNodeInit);
	ss.toggleDebugPrinting(false);
	return ss.qValues(s);
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:9,代码来源:FittedVI.java

示例6: qValue

import burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling; //导入方法依赖的package包/类
@Override
public double qValue(State s, Action a) {
	SparseSampling ss = new SparseSampling(this.domain, this.gamma, this.hashingFactory, this.controlDepth, this.transitionSamples);
	ss.setModel(model);
	ss.setValueForLeafNodes(this.leafNodeInit);
	ss.toggleDebugPrinting(false);
	return ss.qValue(s, a);
}
 
开发者ID:jmacglashan,项目名称:burlap,代码行数:9,代码来源:FittedVI.java


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