burlap.behavior.stochasticgames.agents.twoplayer.singlestage.equilibriumplayer

## Class BimatrixEquilibriumSolver

• java.lang.Object
• burlap.behavior.stochasticgames.agents.twoplayer.singlestage.equilibriumplayer.BimatrixEquilibriumSolver
• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `doubleEpislon`
The epislon difference used to test for double equality.
`protected double[][]` `lastColPlayerPayoff`
The last cached column player payoff matrix
`protected double[]` `lastColsStrategy`
The last cached column player strategy
`protected double[][]` `lastRowPlayerPayoff`
The last cached row player payoff matrix
`protected double[]` `lastRowStrategy`
The last cached row player strategy
• ### Constructor Summary

Constructors
Constructor and Description
`BimatrixEquilibriumSolver()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`protected boolean` ```bimatrixEqualsLast(double[][] rowPayoff, double[][] colPayoff)```
Tests whether the inputed bimatrix is equal to the last bimatrix cached by the `solve(double[][], double[][])` method.
`abstract double[]` ```computeColStrategy(double[][] rowPayoff, double[][] colPayoff)```
Computes and returns the column player strategy for the given bimatrix game.
`abstract double[]` ```computeRowStrategy(double[][] rowPayoff, double[][] colPayoff)```
Computes and returns the row player strategy for the given bimatrix game.
`protected static boolean` ```doubleEquality(double a, double b)```
Returns true if |a - b| < `doubleEpislon`; false otherwise.
`double[]` `getLastComputedColStrategy()`
Returns the last column player strategy computed by the `solve(double[][], double[][])` method.
`double[]` `getLastComputedRowStrategy()`
Returns the last row player strategy computed by the `solve(double[][], double[][])` method.
`void` ```solve(double[][] rowPayoff, double[][] colPayoff)```
Solves and caches the solution for the given bimatrix.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### doubleEpislon

`public static final double doubleEpislon`
The epislon difference used to test for double equality.
See Also:
Constant Field Values
• #### lastRowStrategy

`protected double[] lastRowStrategy`
The last cached row player strategy
• #### lastColsStrategy

`protected double[] lastColsStrategy`
The last cached column player strategy
• #### lastRowPlayerPayoff

`protected double[][] lastRowPlayerPayoff`
The last cached row player payoff matrix
• #### lastColPlayerPayoff

`protected double[][] lastColPlayerPayoff`
The last cached column player payoff matrix
• ### Constructor Detail

• #### BimatrixEquilibriumSolver

`public BimatrixEquilibriumSolver()`
• ### Method Detail

• #### solve

```public void solve(double[][] rowPayoff,
double[][] colPayoff)```
Solves and caches the solution for the given bimatrix. If the given bimatrix is the same as the last bimatrix solved by this object (if there was one), then nothing is computed and the same solution is returned.
Parameters:
`rowPayoff` - the row player payoff matrix
`colPayoff` - the column player payoff matrix
• #### getLastComputedRowStrategy

`public double[] getLastComputedRowStrategy()`
Returns the last row player strategy computed by the `solve(double[][], double[][])` method. The strategy is represented as a double array where a[i] is the probability of action i being selected.
Returns:
the last row player strategy.
• #### getLastComputedColStrategy

`public double[] getLastComputedColStrategy()`
Returns the last column player strategy computed by the `solve(double[][], double[][])` method. The strategy is represented as a double array where a[i] is the probability of action i being selected.
Returns:
the last column player strategy.
• #### computeRowStrategy

```public abstract double[] computeRowStrategy(double[][] rowPayoff,
double[][] colPayoff)```
Computes and returns the row player strategy for the given bimatrix game. The strategy is represented as a double array where a[i] is the probability of action i being selected.
Parameters:
`rowPayoff` - the row player payoffs.
`colPayoff` - the column player payoffs.
Returns:
the row player strategy.
• #### computeColStrategy

```public abstract double[] computeColStrategy(double[][] rowPayoff,
double[][] colPayoff)```
Computes and returns the column player strategy for the given bimatrix game. The strategy is represented as a double array where a[i] is the probability of action i being selected.
Parameters:
`rowPayoff` - the row player payoffs.
`colPayoff` - the column player payoffs.
Returns:
the column player strategy.
• #### bimatrixEqualsLast

```protected boolean bimatrixEqualsLast(double[][] rowPayoff,
double[][] colPayoff)```
Tests whether the inputed bimatrix is equal to the last bimatrix cached by the `solve(double[][], double[][])` method. If there have been no previous calls to the `solve(double[][], double[][])` method and therefore no cached bimatrix, then this method returns false. If the input bimatrix as a different dimensionality that the cached matrix, this method returns false. If any row or column player payoffs for the input bimatrix are different than cached bimatrix this method returns false. Otherwise this method returns true. Equality between two double values is tested with an epsilon difference where value a and b are evaluated as equal if |a - b| < `doubleEpislon`.
Parameters:
`rowPayoff` - the row player payoffs.
`colPayoff` - the column player payoffs.
Returns:
true if the input bimatrix is equal to the last cached bimatrix; false otherwise.
• #### doubleEquality

```protected static boolean doubleEquality(double a,
double b)```
Returns true if |a - b| < `doubleEpislon`; false otherwise.
Parameters:
`a` - first input
`b` - second input
Returns:
true if |a - b| < `doubleEpislon`; false otherwise.