All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.probability.mdp.impl.LookupPolicy Maven / Gradle / Ivy

Go to download

AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.

The newest version!
package aima.core.probability.mdp.impl;

import java.util.HashMap;
import java.util.Map;

import aima.core.agent.Action;
import aima.core.probability.mdp.Policy;

/**
 * Default implementation of the Policy interface using an underlying Map to
 * look up an action associated with a state.
 * 
 * @param 
 *            the state type.
 * @param 
 *            the action type.
 * 
 * @author Ciaran O'Reilly
 */
public class LookupPolicy implements Policy {
	private Map policy = new HashMap();

	public LookupPolicy(Map aPolicy) {
		policy.putAll(aPolicy);
	}

	//
	// START-Policy
	@Override
	public A action(S s) {
		return policy.get(s);
	}

	// END-Policy
	//
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy