public class EquilibriumPlayingSGAgent extends SGAgentBase
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 int |
agentNum |
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 |
---|---|
Action |
action(State s)
This method is called by the world when it needs the agent to choose an action
|
protected EquilibriumPlayingSGAgent.BimatrixTuple |
constructBimatrix(State s,
java.util.List<Action> myActions)
Constructs a bimatrix game from the possible joint rewards of the given state.
|
void |
gameStarting(World w,
int agentNum)
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.
|
protected SGAgent |
getOpponent()
Returns the
SGAgent object in the world for the opponent. |
void |
observeOutcome(State s,
JointAction jointAction,
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 |
opponentNum() |
protected int |
sampleStrategy(double[] strategy)
Samples an action from a strategy, where a strategy is defined as probability distribution over actions.
|
agentName, agentType, getInternalRewardFunction, init, init, setAgentDetails, setInternalRewardFunction
protected BimatrixEquilibriumSolver solver
protected java.util.Random rand
protected int agentNum
public EquilibriumPlayingSGAgent()
MaxMax
solution concept.public EquilibriumPlayingSGAgent(BimatrixEquilibriumSolver solver)
solver
- the solver to use for a given solution concept.public void gameStarting(World w, int agentNum)
SGAgent
w
- the world in which the game is startingagentNum
- the agent number of the agent in the worldpublic Action action(State s)
SGAgent
s
- the current state of the worldpublic void observeOutcome(State s, JointAction jointAction, double[] jointReward, State sprime, boolean isTerminal)
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
protected EquilibriumPlayingSGAgent.BimatrixTuple constructBimatrix(State s, java.util.List<Action> myActions)
s
- the state from which the joint rewards are basedmyActions
- the set of Action
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 selectedprotected SGAgent getOpponent()
SGAgent
object in the world for the opponent.SGAgent
object in the world for the opponent.protected int opponentNum()