public class EquilibriumPlayingSGAgent extends SGAgent
MaxMax
- assuming the other agent will choose actions that maximize your
reward. Different solution concepts can be used by providing a different BimatrixEquilibriumSolver
object in the constructor.Modifier and Type | Class and Description |
---|---|
protected class |
EquilibriumPlayingSGAgent.BimatrixTuple
A Bimatrix tuple.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Random |
rand
Random generator for selecting actions according to the solved solution
|
protected BimatrixEquilibriumSolver |
solver
The solution concept to be solved for the immediate rewards.
|
agentType, domain, internalRewardFunction, world, worldAgentName
Constructor and Description |
---|
EquilibriumPlayingSGAgent()
Initializes with the
MaxMax solution concept. |
EquilibriumPlayingSGAgent(BimatrixEquilibriumSolver solver)
Initializes with strategies formed usign the solution concept generated by the given solver.
|
Modifier and Type | Method and Description |
---|---|
protected EquilibriumPlayingSGAgent.BimatrixTuple |
constructBimatrix(State s,
java.util.List<GroundedSGAgentAction> myActions)
Constructs a bimatrix game from the possible joint rewards of the given state.
|
void |
gameStarting()
This method is called by the world when a new game is starting.
|
void |
gameTerminated()
This method is called by the world when a game has ended.
|
GroundedSGAgentAction |
getAction(State s)
This method is called by the world when it needs the agent to choose an action
|
protected SGAgent |
getOpponent()
Returns the
SGAgent object in the world for the opponent. |
void |
observeOutcome(State s,
JointAction jointAction,
java.util.Map<java.lang.String,java.lang.Double> jointReward,
State sprime,
boolean isTerminal)
This method is called by the world when every agent in the world has taken their action.
|
protected int |
sampleStrategy(double[] strategy)
Samples an action from a strategy, where a strategy is defined as probability distribution over actions.
|
getAgentName, getAgentType, getInternalRewardFunction, init, joinWorld, setInternalRewardFunction
protected BimatrixEquilibriumSolver solver
protected java.util.Random rand
public EquilibriumPlayingSGAgent()
MaxMax
solution concept.public EquilibriumPlayingSGAgent(BimatrixEquilibriumSolver solver)
solver
- the solver to use for a given solution concept.public void gameStarting()
SGAgent
gameStarting
in class SGAgent
public GroundedSGAgentAction getAction(State s)
SGAgent
public void observeOutcome(State s, JointAction jointAction, java.util.Map<java.lang.String,java.lang.Double> jointReward, State sprime, boolean isTerminal)
SGAgent
observeOutcome
in class SGAgent
s
- the state in which the last action of each agent was takenjointAction
- the joint action of all agents in the worldjointReward
- the joint reward of all agents in the worldsprime
- the next state to which the agent transitionedisTerminal
- whether the new state is a terminal statepublic void gameTerminated()
SGAgent
gameTerminated
in class SGAgent
protected EquilibriumPlayingSGAgent.BimatrixTuple constructBimatrix(State s, java.util.List<GroundedSGAgentAction> myActions)
s
- the state from which the joint rewards are basedmyActions
- the set of GroundedSGAgentAction
s the agent can taken in s.EquilibriumPlayingSGAgent.BimatrixTuple
for the joint reward function.protected int sampleStrategy(double[] strategy)
strategy
- a double array where strategy[i] is the probability of action i being selected