本文整理汇总了Java中burlap.mdp.singleagent.SADomain.getActionTypes方法的典型用法代码示例。如果您正苦于以下问题:Java SADomain.getActionTypes方法的具体用法?Java SADomain.getActionTypes怎么用?Java SADomain.getActionTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类burlap.mdp.singleagent.SADomain
的用法示例。
在下文中一共展示了SADomain.getActionTypes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StationaryRandomDistributionPolicy
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
/**
* Constructor initializes the policy, doesn't compute anything here.
* @param domain Domain object for which we need to plan
*/
private StationaryRandomDistributionPolicy(SADomain domain) {
this.stateActionMapping = new HashMap<HashableState, Action>();
this.stateActionDistributionMapping = new HashMap<HashableState, List<ActionProb>>();
this.actionTypes = domain.getActionTypes();
this.rando = new Random();
this.hashFactory = new SimpleHashableStateFactory(true);
}
示例2: BoltzmannActor
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
/**
* Initializes the Actor
* @param domain the domain in which the agent will act
* @param hashingFactory the state hashing factory to use for state hashing and equality checks
* @param learningRate the learning rate that affects how quickly the agent adjusts its action preferences.
*/
public BoltzmannActor(SADomain domain, HashableStateFactory hashingFactory, double learningRate) {
this.domain = domain;
this.actionTypes = new ArrayList<ActionType>(domain.getActionTypes());
this.hashingFactory = hashingFactory;
this.learningRate = new ConstantLR(learningRate);
this.preferences = new HashMap<HashableState, BoltzmannActor.PolicyNode>();
}
示例3: getReachableHashedStates
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
/**
* Returns the set of {@link 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.
* @return the set of {@link State} objects that are reachable from a source state.
*/
public static Set <HashableState> getReachableHashedStates(State from, SADomain inDomain, HashableStateFactory usingHashFactory){
if(!(inDomain.getModel() instanceof FullModel)){
throw new RuntimeException( "State reachablity requires a domain with a FullModel, but one is not provided");
}
FullModel model = (FullModel)inDomain.getModel();
Set<HashableState> hashedStates = new HashSet<HashableState>();
HashableState shi = usingHashFactory.hashState(from);
List <ActionType> actionTypes = inDomain.getActionTypes();
int nGenerated = 0;
LinkedList <HashableState> openList = new LinkedList<HashableState>();
openList.offer(shi);
hashedStates.add(shi);
long firstTime = System.currentTimeMillis();
long lastTime = firstTime;
while(!openList.isEmpty()){
HashableState sh = openList.poll();
List<Action> gas = ActionUtils.allApplicableActionsForTypes(actionTypes, sh.s());
for(Action ga : gas){
List <TransitionProb> tps = model.transitions(sh.s(), ga);
nGenerated += tps.size();
for(TransitionProb tp : tps){
HashableState nsh = usingHashFactory.hashState(tp.eo.op);
if (hashedStates.add(nsh) && !tp.eo.terminated) {
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;
}
示例4: getReachableHashedStates
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
public Set <HashableState> getReachableHashedStates(State from, SADomain inDomain, HashableStateFactory usingHashFactory){
Set<HashableState> hashedStates = new HashSet<HashableState>();
HashableState shi = usingHashFactory.hashState(from);
List <ActionType> actionTypes = inDomain.getActionTypes();
LinkedList <HashableState> openList = new LinkedList<HashableState>();
openList.offer(shi);
hashedStates.add(shi);
while(!openList.isEmpty()){
HashableState sh = openList.poll();
List<Action> gas = ActionUtils.allApplicableActionsForTypes(actionTypes, sh.s());
for(Action ga : gas){
List <TransitionProb> tps = ((FullModel)inDomain.getModel()).transitions(sh.s(), ga);
for(TransitionProb tp : tps){
HashableState nsh = usingHashFactory.hashState(tp.eo.op);
for (HashableState hashedState : hashedStates) {
boolean sameObject = (hashedState == nsh);
boolean valueEquals = (hashedState.equals(nsh));
boolean hashEquals = (hashedState.hashCode() == nsh.hashCode());
if (sameObject || valueEquals) {
assert(hashEquals); // Same state, hashes need to be equal
}
if (!hashEquals) {
assert(!sameObject && !valueEquals);
}
}
if(!hashedStates.contains(nsh)){
openList.offer(nsh);
hashedStates.add(nsh);
}
}
}
}
return hashedStates;
}
示例5: PotentialShapedRMax
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
/**
* Initializes for a tabular model, VI valueFunction, and standard RMax paradigm
* @param domain the real world domain
* @param gamma the discount factor
* @param hashingFactory the hashing factory to use for VI and the tabular model
* @param maxReward the maximum possible reward
* @param nConfident the number of observations required for the model to be confident in a transition
* @param maxVIDelta the maximum change in value function for VI to terminate
* @param maxVIPasses the maximum number of VI iterations per replan.
*/
public PotentialShapedRMax(SADomain domain, double gamma, HashableStateFactory hashingFactory, double maxReward, int nConfident,
double maxVIDelta, int maxVIPasses){
this.solverInit(domain, gamma, hashingFactory);
this.model = new RMaxModel(new TabularModel(domain, hashingFactory, nConfident),
new RMaxPotential(maxReward, gamma), gamma, domain.getActionTypes());
this.modelPlanner = new VIModelLearningPlanner(domain, this.model, gamma, hashingFactory, maxVIDelta, maxVIPasses);
}
示例6: RandomPolicy
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
/**
* Initializes by copying all the primitive actions references defined for the domain into an internal action
* list for this policy.
* @param domain the domain containing all the primitive actions.
*/
public RandomPolicy(SADomain domain){
this.actionTypes = new ArrayList<ActionType>(domain.getActionTypes());
}
示例7: SARSCollector
import burlap.mdp.singleagent.SADomain; //导入方法依赖的package包/类
/**
* Initializes the collector's action set using the actions that are part of the domain.
* @param domain the domain containing the actions to use
*/
public SARSCollector(SADomain domain){
this.actionTypes = domain.getActionTypes();
}