當前位置: 首頁>>代碼示例>>Java>>正文


Java SADomain類代碼示例

本文整理匯總了Java中burlap.oomdp.singleagent.SADomain的典型用法代碼示例。如果您正苦於以下問題:Java SADomain類的具體用法?Java SADomain怎麽用?Java SADomain使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SADomain類屬於burlap.oomdp.singleagent包,在下文中一共展示了SADomain類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateDomain

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
@Override
public Domain generateDomain() {

	SADomain domainWrapper = new SADomain();

	for(Attribute a : srcDomain.getAttributes()){
		domainWrapper.addAttribute(a);
	}

	for(ObjectClass c : srcDomain.getObjectClasses()){
		domainWrapper.addObjectClass(c);
	}

	for(PropositionalFunction pf : srcDomain.getPropFunctions()){
		domainWrapper.addPropositionalFunction(pf);
	}

	for(SGAgentAction sa : useableActions){
		new SAActionWrapper(sa, domainWrapper);
	}


	return domainWrapper;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:25,代碼來源:SGToSADomain.java

示例2: generateDomain

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
@Override
public Domain generateDomain() {
	
	SADomain domain = new SADomain();
	
	//add attributes
	Attribute xatt = new Attribute(domain, ATTX, Attribute.AttributeType.REAL);
	xatt.setLims(physParams.xmin, physParams.xmax);
	
	Attribute vatt = new Attribute(domain, ATTV, Attribute.AttributeType.REAL);
	vatt.setLims(physParams.vmin, physParams.vmax);
	
	//add classes
	ObjectClass agentClass = new ObjectClass(domain, CLASSAGENT);
	agentClass.addAttribute(xatt);
	agentClass.addAttribute(vatt);
	
	MCPhysicsParams cphys = this.physParams.copy();

	new MovementAction(ACTIONFORWARD, domain, 1, cphys);
	new MovementAction(ACTIONBACKWARDS, domain, -1, cphys);
	new MovementAction(ACTIONCOAST, domain, 0, cphys);
	
	
	return domain;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:27,代碼來源:MountainCar.java

示例3: generateDomain

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
@Override
public Domain generateDomain() {
	
	this.tabDomain = new SADomain();
	
	Attribute att = new Attribute(this.tabDomain, ATTSTATE, AttributeType.INT);
	att.setLims(0, this.enumerator.numStatesEnumerated()-1);
	
	ObjectClass oc = new ObjectClass(this.tabDomain, CLASSSTATE);
	oc.addAttribute(att);
	
	for(Action srcAction : this.inputDomain.getActions()){
		new ActionWrapper(tabDomain, srcAction);
	}
	
	return tabDomain;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:18,代碼來源:TabulatedDomainWrapper.java

示例4: performReachabilityFrom

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
public void performReachabilityFrom(State seedState){

		Set<HashableState> hashedStates = StateReachability.getReachableHashedStates(seedState, (SADomain) this.domain, this.hashingFactory);

		//initialize the value function for all states
		for(HashableState hs : hashedStates){
			if(!this.valueFunction.containsKey(hs)){
				this.valueFunction.put(hs, this.vinit.value(hs.s));
			}
		}

	}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:13,代碼來源:VITutorial.java

示例5: findReachableStatesAndEnumerate

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
/**
 * Finds all states that are reachable from an input state and enumerates them
 * @param from the state from which all reachable states should be searched
 */
public void findReachableStatesAndEnumerate(State from){
	Set<HashableState> reachable = StateReachability.getReachableHashedStates(from, (SADomain)this.domain, this.hashingFactory);
	for(HashableState sh : reachable){
		this.getEnumeratedID(sh);
	}
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:11,代碼來源:StateEnumerator.java

示例6: getReachableStates

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
/**
 * Returns the list of {@link burlap.oomdp.core.states.State} objects that are reachable from a source state.
 * @param from the source state
 * @param inDomain the domain of the state
 * @param usingHashFactory the state hashing factory to use for indexing states and testing equality.
 * @param tf a terminal function that prevents expansion from terminal states.
 * @return the list of {@link burlap.oomdp.core.states.State} objects that are reachable from a source state.
 */
public static List <State> getReachableStates(State from, SADomain inDomain, HashableStateFactory usingHashFactory, TerminalFunction tf){
	Set <HashableState> hashedStates = getReachableHashedStates(from, inDomain, usingHashFactory, tf);
	List <State> states = new ArrayList<State>(hashedStates.size());
	for(HashableState sh : hashedStates){
		states.add(sh.s);
	}
	
	return states;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:18,代碼來源:StateReachability.java

示例7: BeliefSparseSampling

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
/**
 * Initializes the planner.
 * @param domain the POMDP domain
 * @param rf the POMDP reward function
 * @param discount the discount factor
 * @param hashingFactory the Belief MDP {@link burlap.oomdp.statehashing.HashableStateFactory} that {@link burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling} will use.
 * @param h the height of the {@link burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling} tree.
 * @param c the number of samples {@link burlap.behavior.singleagent.planning.stochastic.sparsesampling.SparseSampling} will use. Set to -1 to use the full BeliefMDP transition dynamics.
 */
public BeliefSparseSampling(PODomain domain, RewardFunction rf, double discount, HashableStateFactory hashingFactory, int h, int c){

	this.solverInit(domain, rf, null, discount, hashingFactory);
	BeliefMDPGenerator bdgen = new BeliefMDPGenerator(domain);
	this.beliefMDP = (SADomain)bdgen.generateDomain();
	this.beliefRF = new BeliefMDPGenerator.BeliefRF(domain, rf);
	
	this.mdpPlanner = new SparseSampling(this.beliefMDP, this.beliefRF, new NullTermination(), discount, hashingFactory, h, Math.max(1, c));
	if(c < 1){
		this.mdpPlanner.setComputeExactValueFunction(true);
	}
	
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:23,代碼來源:BeliefSparseSampling.java

示例8: visualizeValueFunction

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
public static void visualizeValueFunction(QComputablePlanner planner, Policy p, State initialState, Domain domain, StateHashFactory hashingFactory) {

        List<State> allStates = StateReachability.getReachableStates(initialState,
                (SADomain) domain, hashingFactory);
        LandmarkColorBlendInterpolation rb = new LandmarkColorBlendInterpolation();
        rb.addNextLandMark(0., Color.RED);
        rb.addNextLandMark(1., Color.BLUE);

        StateValuePainter2D svp = new StateValuePainter2D(rb);
        svp.setValueStringRenderingFormat(8, Color.WHITE, 2, 0.0f, 0.8f);
        svp.setXYAttByObjectClass(GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTX,
                GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTY);

        PolicyGlyphPainter2D spp = new PolicyGlyphPainter2D();
        spp.setXYAttByObjectClass(GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTX,
                GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTY);
        spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONNORTH, new ArrowActionGlyph(0));
        spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONSOUTH, new ArrowActionGlyph(1));
        spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONEAST, new ArrowActionGlyph(2));
        spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONWEST, new ArrowActionGlyph(3));
        spp.setRenderStyle(PolicyGlyphPainter2D.PolicyGlyphRenderStyle.DISTSCALED);

        ValueFunctionVisualizerGUI gui = new ValueFunctionVisualizerGUI(allStates, svp, planner);
        gui.setSpp(spp);
        gui.setPolicy(p);
        gui.setBgColor(Color.GRAY);
        gui.initGUI();
    }
 
開發者ID:PhilippeMorere,項目名稱:DeepRL,代碼行數:29,代碼來源:Corridor.java

示例9: generateDomain

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
@Override
public Domain generateDomain() {

	SADomain domain = new SADomain();

	Attribute xatt = new Attribute(domain, ATTX,
			Attribute.AttributeType.INT);
	xatt.setLims(0, mapx);

	Attribute yatt = new Attribute(domain, ATTY,
			Attribute.AttributeType.INT);
	yatt.setLims(0, mapy);

	ObjectClass agentClass = new ObjectClass(domain, CLASSAGENT);
	agentClass.addAttribute(xatt);
	agentClass.addAttribute(yatt);

	ObjectClass locationClass = new ObjectClass(domain, CLASSLOCATION);
	locationClass.addAttribute(xatt);
	locationClass.addAttribute(yatt);

	new Movement(ACTIONNORTH, domain, 0, map);
	new Movement(ACTIONSOUTH, domain, 1, map);
	new Movement(ACTIONEAST, domain, 2, map);
	new Movement(ACTIONWEST, domain, 3, map);

	new AtLocation(domain);

	return domain;
}
 
開發者ID:juanjose49,項目名稱:omscs-cs7641-machine-learning-assignment-4,代碼行數:31,代碼來源:BasicGridWorld.java

示例10: simpleValueFunctionVis

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
public void simpleValueFunctionVis(ValueFunction valueFunction, Policy p, 
		State initialState, Domain domain, HashableStateFactory hashingFactory, String title){

	List<State> allStates = StateReachability.getReachableStates(initialState,
			(SADomain)domain, hashingFactory);
	ValueFunctionVisualizerGUI gui = GridWorldDomain.getGridWorldValueFunctionVisualization(
			allStates, valueFunction, p);
	gui.setTitle(title);
	gui.initGUI();

}
 
開發者ID:juanjose49,項目名稱:omscs-cs7641-machine-learning-assignment-4,代碼行數:12,代碼來源:AnalysisRunner.java

示例11: manualValueFunctionVis

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
public void manualValueFunctionVis(ValueFunction valueFunction, Policy p){

		List<State> allStates = StateReachability.getReachableStates(initialState, (SADomain)domain, hashingFactory);

		//define color function
		LandmarkColorBlendInterpolation rb = new LandmarkColorBlendInterpolation();
		rb.addNextLandMark(0., Color.RED);
		rb.addNextLandMark(1., Color.BLUE);

		//define a 2D painter of state values, specifying which attributes correspond to the x and y coordinates of the canvas
		StateValuePainter2D svp = new StateValuePainter2D(rb);
		svp.setXYAttByObjectClass(GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTX,
				GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTY);


		//create our ValueFunctionVisualizer that paints for all states
		//using the ValueFunction source and the state value painter we defined
		ValueFunctionVisualizerGUI gui = new ValueFunctionVisualizerGUI(allStates, svp, valueFunction);

		//define a policy painter that uses arrow glyphs for each of the grid world actions
		PolicyGlyphPainter2D spp = new PolicyGlyphPainter2D();
		spp.setXYAttByObjectClass(GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTX,
				GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTY);
		spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONNORTH, new ArrowActionGlyph(0));
		spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONSOUTH, new ArrowActionGlyph(1));
		spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONEAST, new ArrowActionGlyph(2));
		spp.setActionNameGlyphPainter(GridWorldDomain.ACTIONWEST, new ArrowActionGlyph(3));
		spp.setRenderStyle(PolicyGlyphPainter2D.PolicyGlyphRenderStyle.DISTSCALED);


		//add our policy renderer to it
		gui.setSpp(spp);
		gui.setPolicy(p);

		//set the background color for places where states are not rendered to grey
		gui.setBgColor(Color.GRAY);

		//start it
		gui.initGUI();



	}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:44,代碼來源:BasicBehavior.java

示例12: getReachableHashedStates

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
/**
 * Returns the set of {@link burlap.oomdp.core.states.State} objects that are reachable from a source state.
 * @param from the source state
 * @param inDomain the domain of the state
 * @param usingHashFactory the state hashing factory to use for indexing states and testing equality.
 * @param tf a terminal function that prevents expansion from terminal states.
 * @return the set of {@link burlap.oomdp.core.states.State} objects that are reachable from a source state.
 */
public static Set <HashableState> getReachableHashedStates(State from, SADomain inDomain, HashableStateFactory usingHashFactory, TerminalFunction tf){
	
	Set<HashableState> hashedStates = new HashSet<HashableState>();
	HashableState shi = usingHashFactory.hashState(from);
	List <Action> actions = inDomain.getActions();
	int nGenerated = 0;
	
	LinkedList <HashableState> openList = new LinkedList<HashableState>();
	openList.offer(shi);
	hashedStates.add(shi);
	long firstTime = System.currentTimeMillis();
	long lastTime = firstTime;
	while(openList.size() > 0){
		HashableState sh = openList.poll();
		if(tf.isTerminal(sh.s)){
			continue; //don't expand
		}
		
		List<GroundedAction> gas = Action.getAllApplicableGroundedActionsFromActionList(actions, sh.s);
		for(GroundedAction ga : gas){
			List <TransitionProbability> tps = ga.getTransitions(sh.s);
			nGenerated += tps.size();
			for(TransitionProbability tp : tps){
				HashableState nsh = usingHashFactory.hashState(tp.s);
				
				if (hashedStates.add(nsh)) {
					openList.offer(nsh);
				}
			}
		}
		
		long currentTime = System.currentTimeMillis();
		if (currentTime - 1000 >= lastTime) {
			DPrint.cl(debugID, "Num generated: " + (nGenerated) + " Unique: " + (hashedStates.size()) + 
					" time: " + ((double)currentTime - firstTime)/1000.0);				
			lastTime = currentTime;
		}
	}
	
	DPrint.cl(debugID, "Num generated: " + nGenerated + "; num unique: " + hashedStates.size());
	
	return hashedStates;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:52,代碼來源:StateReachability.java

示例13: RandomStartStateGenerator

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
/**
 * Will discover the reachable states from which to randomly select. Reachable states found using a {@link burlap.oomdp.statehashing.SimpleHashableStateFactory} with identifier dependence.
 * @param domain the domain from which states will be drawn.
 * @param seedState the seed state from which the reachable states will be found.
 */
public RandomStartStateGenerator(SADomain domain, State seedState) {
	HashableStateFactory hashFactory = new SimpleHashableStateFactory(false);
	this.reachableStates = StateReachability.getReachableStates(seedState, domain, hashFactory);
	this.random = new Random();
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:11,代碼來源:RandomStartStateGenerator.java

示例14: generateDomain

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
@Override
public Domain generateDomain() {
	
	Domain domain = new SADomain();
	
	//Creates a new Attribute object
	Attribute xatt = new Attribute(domain, ATTX, Attribute.AttributeType.INT);
	xatt.setLims(0, this.width-1);
	
	Attribute yatt = new Attribute(domain, ATTY, Attribute.AttributeType.INT);
	yatt.setLims(0., this.height-1);
	
	Attribute ltatt = new Attribute(domain, ATTLOCTYPE, Attribute.AttributeType.DISC);
	ltatt.setDiscValuesForRange(0, numLocationTypes-1, 1);
	
	
	ObjectClass agentClass = new ObjectClass(domain, CLASSAGENT);
	agentClass.addAttribute(xatt);
	agentClass.addAttribute(yatt);
	
	ObjectClass locationClass = new ObjectClass(domain, CLASSLOCATION);
	locationClass.addAttribute(xatt);
	locationClass.addAttribute(yatt);
	locationClass.addAttribute(ltatt);

	int [][] cmap = this.getMap();

	new MovementAction(ACTIONNORTH, domain, this.transitionDynamics[0], cmap);
	new MovementAction(ACTIONSOUTH, domain, this.transitionDynamics[1], cmap);
	new MovementAction(ACTIONEAST, domain, this.transitionDynamics[2], cmap);
	new MovementAction(ACTIONWEST, domain, this.transitionDynamics[3], cmap);
	
	
	new AtLocationPF(PFATLOCATION, domain, new String[]{CLASSAGENT, CLASSLOCATION});
	
	new WallToPF(PFWALLNORTH, domain, new String[]{CLASSAGENT}, 0);
	new WallToPF(PFWALLSOUTH, domain, new String[]{CLASSAGENT}, 1);
	new WallToPF(PFWALLEAST, domain, new String[]{CLASSAGENT}, 2);
	new WallToPF(PFWALLWEST, domain, new String[]{CLASSAGENT}, 3);
	
	return domain;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:43,代碼來源:GridWorldDomain.java

示例15: generateDomain

import burlap.oomdp.singleagent.SADomain; //導入依賴的package包/類
@Override
public Domain generateDomain() {
	
	Domain domain = new SADomain();
	
	Attribute na = new Attribute(domain, ATTNODE, Attribute.AttributeType.DISC);
	na.setDiscValuesForRange(0, this.numNodes-1, 1);
	
	ObjectClass aclass = new ObjectClass(domain, CLASSAGENT);
	aclass.addAttribute(na);

	Map<Integer, Map<Integer, Set<NodeTransitionProbability>>> ctd = this.copyTransitionDynamics();

	for(int i = 0; i < this.maxActions; i++){
		new GraphAction(domain, i, ctd);
	}
	
	
	return domain;
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:21,代碼來源:GraphDefinedDomain.java


注:本文中的burlap.oomdp.singleagent.SADomain類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。