<commit_before>package burlap.behavior.singleagent.learning.actorcritic.actor;

import burlap.behavior.learningrate.ConstantLR;
import burlap.behavior.learningrate.LearningRate;
import burlap.behavior.policy.EnumerablePolicy;
import burlap.behavior.policy.PolicyUtils;
import burlap.behavior.policy.support.ActionProb;
import burlap.behavior.singleagent.learning.actorcritic.Actor;
import burlap.datastructures.BoltzmannDistribution;
import burlap.mdp.core.action.Action;
import burlap.mdp.core.Domain;
import burlap.mdp.core.state.State;
import burlap.mdp.core.action.ActionType;
import burlap.mdp.core.action.ActionUtils;
import burlap.mdp.singleagent.SADomain;
import burlap.mdp.singleagent.environment.EnvironmentOutcome;
import burlap.statehashing.HashableState;
import burlap.statehashing.HashableStateFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * And Actor component whose policy is defined by a Boltzmann distribution over action preferences. This actor stores
 * state-action preferences tabularly and therefore requires a {@link burlap.statehashing.HashableStateFactory} to perform lookups.
 * @author <NAME>
 *
 */
public class BoltzmannActor implements Actor, EnumerablePolicy {

	/**
	 * The domain in which this agent will act
	 */
	protected Domain								domain;
	
	/**
	 * The actions the agent can perform
	 */
	protected List<ActionType> actionTypes;
	
	/**
	 * The hashing factory used to hash states and evaluate state equality
	 */
	protected HashableStateFactory hashingFactory;
	
	/**
	 * The learning rate used to update action preferences in response to critiques.
	 */
	protected LearningRate							learningRate;
	
	/**
	 * A map from (hashed) states to Policy nodes; the latter of which contains the action preferences
	 * for each applicable action in the state.
	 */
	protected Map<HashableState, PolicyNode>		preferences;
	
	
	/**
	 * Indicates whether the actions that this agent can perform are parameterized
	 */
	protected boolean								containsParameterizedActions = false;
	
	/**
	 * The total number of learning steps performed by this agent.
	 */
	protected int													totalNumberOfSteps = 0;
	
	
	
	/**
	 * 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) {<commit_msg>removed unnecessary data member used for earlier versions of Boltzmann Actor<commit_after>package burlap.behavior.singleagent.learning.actorcritic.actor;

import burlap.behavior.learningrate.ConstantLR;
import burlap.behavior.learningrate.LearningRate;
import burlap.behavior.policy.EnumerablePolicy;
import burlap.behavior.policy.PolicyUtils;
import burlap.behavior.policy.support.ActionProb;
import burlap.behavior.singleagent.learning.actorcritic.Actor;
import burlap.datastructures.BoltzmannDistribution;
import burlap.mdp.core.action.Action;
import burlap.mdp.core.Domain;
import burlap.mdp.core.state.State;
import burlap.mdp.core.action.ActionType;
import burlap.mdp.core.action.ActionUtils;
import burlap.mdp.singleagent.SADomain;
import burlap.mdp.singleagent.environment.EnvironmentOutcome;
import burlap.statehashing.HashableState;
import burlap.statehashing.HashableStateFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * And Actor component whose policy is defined by a Boltzmann distribution over action preferences. This actor stores
 * state-action preferences tabularly and therefore requires a {@link burlap.statehashing.HashableStateFactory} to perform lookups.
 * @author <NAME>
 *
 */
public class BoltzmannActor implements Actor, EnumerablePolicy {

	/**
	 * The domain in which this agent will act
	 */
	protected Domain								domain;
	
	/**
	 * The actions the agent can perform
	 */
	protected List<ActionType> actionTypes;
	
	/**
	 * The hashing factory used to hash states and evaluate state equality
	 */
	protected HashableStateFactory hashingFactory;
	
	/**
	 * The learning rate used to update action preferences in response to critiques.
	 */
	protected LearningRate							learningRate;
	
	/**
	 * A map from (hashed) states to Policy nodes; the latter of which contains the action preferences
	 * for each applicable action in the state.
	 */
	protected Map<HashableState, PolicyNode>		preferences;

	
	/**
	 * The total number of learning steps performed by this agent.
	 */
	protected int													totalNumberOfSteps = 0;
	
	
	
	/**
	 * 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) {
{'fraction_non_alphanumeric': 0.0732842186894145, 'fraction_numerical': 0.00038774718883288094, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6991883', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1351, 'n_words': 461}