Java Code Examples for burlap.mdp.core.oo.propositional.PropositionalFunction#allGroundings()
The following examples show how to use
burlap.mdp.core.oo.propositional.PropositionalFunction#allGroundings() .
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: GameSequenceVisualizer.java From burlap with Apache License 2.0 | 6 votes |
private void updatePropTextArea(State s){ if(!(domain instanceof OODomain) || !(s instanceof OOState)){ return ; } StringBuilder buf = new StringBuilder(); List <PropositionalFunction> props = ((OODomain)domain).propFunctions(); for(PropositionalFunction pf : props){ List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ buf.append(gp.toString()).append("\n"); } } } propViewer.setText(buf.toString()); }
Example 2
Source File: PFFeatures.java From burlap with Apache License 2.0 | 6 votes |
@Override public double[] features(State s) { List<Double> featureValueList = new LinkedList<Double>(); for(PropositionalFunction pf : this.pfsToUse){ //List<GroundedProp> gps = s.getAllGroundedPropsFor(pf); List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ featureValueList.add(1.); } else{ featureValueList.add(0.); } } } double [] fv = new double[featureValueList.size()]; int i = 0; for(double f : featureValueList){ fv[i] = f; i++; } return fv; }
Example 3
Source File: EpisodeSequenceVisualizer.java From burlap with Apache License 2.0 | 6 votes |
protected void updatePropTextArea(State s){ if(!(domain instanceof OODomain) || !(s instanceof OOState)){ return ; } StringBuilder buf = new StringBuilder(); List <PropositionalFunction> props = ((OODomain)domain).propFunctions(); for(PropositionalFunction pf : props){ //List<GroundedProp> gps = s.getAllGroundedPropsFor(pf); List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ buf.append(gp.toString()).append("\n"); } } } propViewer.setText(buf.toString()); }
Example 4
Source File: VisualWorldObserver.java From burlap with Apache License 2.0 | 6 votes |
private void updatePropTextArea(State s){ if(!(domain instanceof OODomain) || !(s instanceof OOState)){ return ; } StringBuilder buf = new StringBuilder(); List <PropositionalFunction> props = ((OODomain)domain).propFunctions(); for(PropositionalFunction pf : props){ //List<GroundedProp> gps = s.getAllGroundedPropsFor(pf); List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ buf.append(gp.toString()).append("\n"); } } } propViewer.setText(buf.toString()); }
Example 5
Source File: VisualActionObserver.java From burlap with Apache License 2.0 | 6 votes |
private void updatePropTextArea(State s){ if(domain == null || !(s instanceof OOState)){ return ; } StringBuilder buf = new StringBuilder(); List <PropositionalFunction> props = ((OODomain)domain).propFunctions(); for(PropositionalFunction pf : props){ List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ buf.append(gp.toString()).append("\n"); } } } propViewer.setText(buf.toString()); }
Example 6
Source File: VisualExplorer.java From burlap with Apache License 2.0 | 6 votes |
/** * Updates the propositional function evaluation text display for the given state. * @param s the input state on which propositional functions are to be evaluated. */ protected void updatePropTextArea(State s){ if(!(domain instanceof OODomain) || !(s instanceof OOState)){ return ; } StringBuilder buf = new StringBuilder(); List <PropositionalFunction> props = ((OODomain)domain).propFunctions(); for(PropositionalFunction pf : props){ List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ buf.append(gp.toString()).append("\n"); } } } propViewer.setText(buf.toString()); }
Example 7
Source File: SGVisualExplorer.java From burlap with Apache License 2.0 | 6 votes |
protected void updatePropTextArea(State s){ if(!(domain instanceof OODomain) || !(s instanceof OOState)){ return; } StringBuilder buf = new StringBuilder(); List <PropositionalFunction> props = ((OODomain)domain).propFunctions(); for(PropositionalFunction pf : props){ List<GroundedProp> gps = pf.allGroundings((OOState)s); for(GroundedProp gp : gps){ if(gp.isTrue((OOState)s)){ buf.append(gp.toString()).append("\n"); } } } propViewer.setText(buf.toString()); }
Example 8
Source File: TestGridWorld.java From burlap with Apache License 2.0 | 5 votes |
public void assertPFs(State s, boolean[] expectedValues) { OOState os = (OOState)s; PropositionalFunction atLocation = domain.propFunction(GridWorldDomain.PF_AT_LOCATION); List<GroundedProp> gpAt = atLocation.allGroundings(os); Assert.assertEquals(1, gpAt.size()); Assert.assertEquals(expectedValues[0], gpAt.get(0).isTrue((OOState)s)); PropositionalFunction pfWallNorth = domain.propFunction(GridWorldDomain.PF_WALL_NORTH); List<GroundedProp> gpWallNorth = pfWallNorth.allGroundings(os); Assert.assertEquals(1, gpWallNorth.size()); Assert.assertEquals(expectedValues[1], gpWallNorth.get(0).isTrue((OOState)s)); PropositionalFunction pfWallSouth = domain.propFunction(GridWorldDomain.PF_WALL_SOUTH); List<GroundedProp> gpWallSouth = pfWallSouth.allGroundings(os); Assert.assertEquals(1, gpWallSouth.size()); Assert.assertEquals(expectedValues[2], gpWallSouth.get(0).isTrue((OOState)s)); PropositionalFunction pfWallEast = domain.propFunction(GridWorldDomain.PF_WALL_EAST); List<GroundedProp> gpWallEast = pfWallEast.allGroundings(os); Assert.assertEquals(1, gpWallEast.size()); Assert.assertEquals(expectedValues[3], gpWallEast.get(0).isTrue((OOState)s)); PropositionalFunction pfWallWest = domain.propFunction(GridWorldDomain.PF_WALL_WEST); List<GroundedProp> gpWallWest = pfWallWest.allGroundings(os); Assert.assertEquals(1, gpWallWest.size()); Assert.assertEquals(expectedValues[4], gpWallWest.get(0).isTrue((OOState)s)); }