Java Code Examples for burlap.mdp.core.state.State#variableKeys()
The following examples show how to use
burlap.mdp.core.state.State#variableKeys() .
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: NormalizedVariableFeatures.java From burlap with Apache License 2.0 | 6 votes |
@Override public double[] features(State s) { double [] vals = new double[domains.size()]; int i = 0; List<Object> keys = s.variableKeys(); for(Object key : keys){ VariableDomain vd = this.domains.get(key); if(vd == null){ continue; } double d = ((Number)s.get(key)).doubleValue(); double norm = vd.norm(d); vals[i] = norm; i++; } return vals; }
Example 2
Source File: IDSimpleHashableState.java From burlap with Apache License 2.0 | 6 votes |
protected boolean flatStatesEqual(State s1, State s2){ if(s1 == s2){ return true; } List<Object> keys1 = s1.variableKeys(); List<Object> keys2 = s2.variableKeys(); if(keys1.size() != keys2.size()){ return false; } for(Object key : keys1){ Object v1 = s1.get(key); Object v2 = s2.get(key); if(!this.valuesEqual(key, v1, v2)){ return false; } } return true; }
Example 3
Source File: IISimpleHashableState.java From burlap with Apache License 2.0 | 6 votes |
protected boolean flatStatesEqual(State s1, State s2){ if(s1 == s2){ return true; } List<Object> keys1 = s1.variableKeys(); List<Object> keys2 = s2.variableKeys(); if(keys1.size() != keys2.size()){ return false; } for(Object key : keys1){ Object v1 = s1.get(key); Object v2 = s2.get(key); if(!this.valuesEqual(key, v1, v2)){ return false; } } return true; }
Example 4
Source File: IDSimpleHashableState.java From burlap with Apache License 2.0 | 5 votes |
protected int computeFlatHashCode(State s){ HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(17, 31); List<Object> keys = s.variableKeys(); for(Object key : keys){ Object value = s.get(key); this.appendHashCodeForValue(hashCodeBuilder, key, value); } return hashCodeBuilder.toHashCode(); }
Example 5
Source File: IISimpleHashableState.java From burlap with Apache License 2.0 | 5 votes |
protected int computeFlatHashCode(State s){ HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(17, 31); List<Object> keys = s.variableKeys(); for(Object key : keys){ Object value = s.get(key); this.appendHashCodeForValue(hashCodeBuilder, key, value); } return hashCodeBuilder.toHashCode(); }