Java Code Examples for burlap.mdp.singleagent.SADomain#setModel()

The following examples show how to use burlap.mdp.singleagent.SADomain#setModel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExampleGridWorld.java    From burlap_examples with MIT License 6 votes vote down vote up
@Override
public SADomain generateDomain() {

	SADomain domain = new SADomain();


	domain.addActionTypes(
			new UniversalActionType(ACTION_NORTH),
			new UniversalActionType(ACTION_SOUTH),
			new UniversalActionType(ACTION_EAST),
			new UniversalActionType(ACTION_WEST));

	GridWorldStateModel smodel = new GridWorldStateModel();
	RewardFunction rf = new ExampleRF(this.goalx, this.goaly);
	TerminalFunction tf = new ExampleTF(this.goalx, this.goaly);

	domain.setModel(new FactoredModel(smodel, rf, tf));

	return domain;
}
 
Example 2
Source File: InvertedPendulum.java    From burlap with Apache License 2.0 5 votes vote down vote up
@Override
public SADomain generateDomain() {
	
	SADomain domain = new SADomain();


	IPPhysicsParams cphys = this.physParams.copy();
	IPModel smodel = new IPModel(cphys);

	RewardFunction rf = this.rf;
	TerminalFunction tf = this.tf;

	if(rf == null){
		rf = new InvertedPendulumRewardFunction();
	}
	if(tf == null){
		tf = new InvertedPendulumTerminalFunction();
	}

	FactoredModel model = new FactoredModel(smodel, rf ,tf);
	domain.setModel(model);

	domain.addActionType(new UniversalActionType(ACTION_LEFT))
			.addActionType(new UniversalActionType(ACTION_RIGHT))
			.addActionType(new UniversalActionType(ACTION_NO_FORCE));

	
	return domain;
}
 
Example 3
Source File: MountainCar.java    From burlap with Apache License 2.0 4 votes vote down vote up
@Override
public SADomain generateDomain() {
	
	SADomain domain = new SADomain();


	MCModel smodel = new MCModel(this.physParams.copy());
	if(tf == null){
		tf = new ClassicMCTF(physParams.xmax);
	}
	if(rf == null){
		rf = new GoalBasedRF(tf, 100, 0);
	}

	FactoredModel model = new FactoredModel(smodel, rf, tf);

	domain.setModel(model);

	domain.addActionType(new UniversalActionType(ACTION_FORWARD))
			.addActionType(new UniversalActionType(ACTION_BACKWARDS))
			.addActionType(new UniversalActionType(ACTION_COAST));

	
	
	return domain;
}
 
Example 4
Source File: GraphDefinedDomain.java    From burlap with Apache License 2.0 4 votes vote down vote up
@Override
public SADomain generateDomain() {
	
	SADomain domain = new SADomain();

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

	GraphStateModel stateModel = new GraphStateModel(ctd);
	FactoredModel model = new FactoredModel(stateModel, rf, tf);

	domain.setModel(model);

	for(int i = 0; i < this.maxActions; i++){
		domain.addActionType(new GraphActionType(i, ctd));
	}
	
	
	return domain;
}
 
Example 5
Source File: BeliefMDPGenerator.java    From burlap with Apache License 2.0 3 votes vote down vote up
@Override
public SADomain generateDomain() {
	
	SADomain domain = new SADomain();


	for(ActionType mdpActionType : this.podomain.getActionTypes()){
		domain.addActionType(mdpActionType);
	}

	domain.setModel(new BeliefModel(podomain));
	
	return domain;
}
 
Example 6
Source File: CartPoleDomain.java    From burlap with Apache License 2.0 3 votes vote down vote up
@Override
public SADomain generateDomain() {
	
	SADomain domain = new SADomain();

	CPPhysicsParams cphys = this.physParams.copy();

	RewardFunction rf = this.rf;
	TerminalFunction tf = this.tf;

	if(rf == null){
		rf = new CartPoleRewardFunction();
	}
	if(tf == null){
		tf = new CartPoleTerminalFunction();
	}

	FullStateModel smodel = cphys.useCorrectModel ? new CPClassicModel(cphys) : new CPClassicModel(cphys);

	FactoredModel model = new FactoredModel(smodel, rf, tf);
	domain.setModel(model);


	domain.addActionType(new UniversalActionType(ACTION_LEFT))
			.addActionType(new UniversalActionType(ACTION_RIGHT));


	return domain;
}