Java Code Examples for burlap.mdp.core.oo.propositional.PropositionalFunction#allGroundingsFromList()
The following examples show how to use
burlap.mdp.core.oo.propositional.PropositionalFunction#allGroundingsFromList() .
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: CommandCheckProps.java From burlapcraft with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void processCommand(ICommandSender sender, String[] args) { MinecraftDomainGenerator mdg = new MinecraftDomainGenerator(); OOSADomain domain = mdg.generateDomain(); boolean printFalse = false; if(args.length > 0){ if(args[0].equals("+not")){ printFalse = true; } } State s = MinecraftStateGeneratorHelper.getCurrentState(BurlapCraft.currentDungeon); List<GroundedProp> gps = PropositionalFunction.allGroundingsFromList(domain.propFunctions(), (OOState)s); StringBuffer buf = new StringBuffer(); buf.append("\n"); for(GroundedProp gp : gps){ if(!gp.isTrue((OOState)s)){ if(printFalse) { buf.append("NOT "); buf.append(gp.toString()); buf.append("\n"); } } else{ buf.append(gp.toString()); buf.append("\n"); } } sender.addChatMessage(new ChatComponentText(buf.toString())); }
Example 2
Source File: ListPropFunctions.java From burlap with Apache License 2.0 | 4 votes |
@Override public int call(BurlapShell shell, String argString, Scanner is, PrintStream os) { Environment env = ((EnvironmentShell)shell).getEnv(); OptionSet oset = this.parser.parse(argString.split(" ")); if(oset.has("h")){ os.println("[s]\nCommand to list all true (or false) grounded propositional function for the current environment observation.\n" + "-f: list false grounded propositional functions, rather than true ones. " + "-n: list the name of all propositional functions, rather than grounded evaluations\n" + "-s: evaluate propositional functions on POMDP environment hidden state, rather than environment observation. Environment must extend SimulatedPOEnvironment"); return 0; } if(!(shell.getDomain() instanceof OODomain)){ os.println("cannot query propositional functions because the domain is not an OODomain"); return 0; } if(oset.has("n")){ for(PropositionalFunction pf : ((OODomain)shell.getDomain()).propFunctions()){ os.println(pf.getName()); } return 0; } State qs = env.currentObservation(); if(oset.has("s")){ if(!(env instanceof SimulatedPOEnvironment)){ os.println("Cannot query applicable actions with respect to POMDP hidden state, because the environment does not extend SimulatedPOEnvironment."); return 0; } qs = ((SimulatedPOEnvironment)env).getCurrentHiddenState(); } List<GroundedProp> gps = PropositionalFunction.allGroundingsFromList(((OODomain)shell.getDomain()).propFunctions(), (OOState)qs); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)qs) == !oset.has("f")){ os.println(gp.toString()); } } return 0; }