edu.princeton.repeatedgames.rgsolve.games
Class ScaledGame

java.lang.Object
  extended by edu.princeton.repeatedgames.rgsolve.games.Game
      extended by edu.princeton.repeatedgames.rgsolve.games.ScaledGame
All Implemented Interfaces:
java.io.Serializable

public class ScaledGame
extends Game
implements java.io.Serializable

This class scales the payoffs of a Game object linearly, according to the function newPayoff(player) = payoff(player) * slope[player] + offset[player]

See Also:
Serialized Form

Field Summary
 Game game
          The base game
private  double[] offset
          intercept of payoff scaling
private static long serialVersionUID
          Serialization ID
private  double[] slope
          slope of payoff scaling
 
Fields inherited from class edu.princeton.repeatedgames.rgsolve.games.Game
description, extension
 
Constructor Summary
ScaledGame(Game game)
           
ScaledGame(Game game, double[] slope, double[] offset)
           
 
Method Summary
static ScaledGame getNormalizedGame(Game game, double min, double max)
          Normalizes the range of payoffs to each player to the range [min, max]
static ScaledGame getOffsetGame(Game game, double[] offset)
          Offsets the payoffs to each player by the amount offset[player]
 double payoff1(int a1, int a2)
          payoff to player 1
 double payoff2(int a1, int a2)
          payoff to player 2
 void setOffset(double[] offset)
          Offsets this game by offset
 
Methods inherited from class edu.princeton.repeatedgames.rgsolve.games.Game
actionUsable, copyUsableActions, delta, m, m1, m2, payoff, payoff, setActionUsable, setDescription, setDiscount, usableActionsDefined
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serialization ID

See Also:
Constant Field Values

game

public Game game
The base game


slope

private double[] slope
slope of payoff scaling


offset

private double[] offset
intercept of payoff scaling

Constructor Detail

ScaledGame

public ScaledGame(Game game)

ScaledGame

public ScaledGame(Game game,
                  double[] slope,
                  double[] offset)
Method Detail

setOffset

public void setOffset(double[] offset)
Offsets this game by offset

Parameters:
offset - a 2-array of offsets for each player

getNormalizedGame

public static ScaledGame getNormalizedGame(Game game,
                                           double min,
                                           double max)
Normalizes the range of payoffs to each player to the range [min, max]

Parameters:
game - a Game
min -
max -
Returns:
the normalized game

getOffsetGame

public static ScaledGame getOffsetGame(Game game,
                                       double[] offset)
Offsets the payoffs to each player by the amount offset[player]

Parameters:
game - a Game
offset - a 2-array of offsets for each player
Returns:
the offset game

payoff1

public double payoff1(int a1,
                      int a2)
Description copied from class: Game
payoff to player 1

Specified by:
payoff1 in class Game
Parameters:
a1 - player 1 action
a2 - player 2 action
Returns:
the payoff to player 1

payoff2

public double payoff2(int a1,
                      int a2)
Description copied from class: Game
payoff to player 2

Specified by:
payoff2 in class Game
Parameters:
a1 - player 1 action
a2 - player 2 action
Returns:
the payoff to player 2