org.pokersource.enum

Class BeliefVector

Known Direct Subclasses:
HoldemBeliefVector

public abstract class BeliefVector
extends java.lang.Object

Represents subjective beliefs about the possible hands held by a player. Maintains a mapping from each hand to its probability of occurrence.
Author:
Michael Maurer <mjmaurer@yahoo.com>

Field Summary

(package private) HandGroup
universalGroup
The universe of all possible hands.

Constructor Summary

BeliefVector(String spec)
Instantiate self from string respresentation.

Method Summary

(package private) void
addHandGroupAbsolute(HandGroup group, double absoluteProb)
During construction, add a new hand group with its absolute probability of occurrence.
(package private) void
addHandGroupRelative(HandGroup group, double relativeProb)
During construction, add a new hand group with its probability of occurrence relative to the Bayesian probability.
(package private) void
addRemainingAbsolute(double absoluteProb)
During construction, add each hand not yet added with the given absolute probability of occurrence of the entire set of such hands.
(package private) void
addRemainingRelative(double relativeProb)
During construction, add each hand not yet added with its probability of occurrence relative to its Bayesian probability.
abstract void
fromString(String spec)
Instantiate self from string respresentation.
double
getBeliefProb(long hand)
Return the absolute probability that hand will occur, conditioned on the dead cards.
long[]
getHands()
Return an array of bitmasks representing hands with nonzero probability of occurring (conditioned on the dead cards).
int
numHands()
Returns the number of atomic hands with nonzero probability of occurring (conditioned on the dead cards).
void
setDeadCards(long cards)
Set the "dead cards", cards that are known not to be available.
String
toString()
Generate string representation of self; the inverse of fromString().
String
toStringAtomic()
Generate a string representation of self that gives probability details for all atomic hands, conditioned on the dead cards.
(package private) void
validate()
After construction, subclasses should call this for a sanity check.

Field Details

universalGroup

(package private)  HandGroup universalGroup
The universe of all possible hands. Should be set in the subclass' constructor. Used by addRemaining() to know which hands haven't yet been added.

Constructor Details

BeliefVector

public BeliefVector(String spec)
Instantiate self from string respresentation. Meant to be called from subclass's constructor. The subclass constructor should then parse the string spec and populate groupProb and deadCards.

Method Details

addHandGroupAbsolute

(package private)  void addHandGroupAbsolute(HandGroup group,
                                             double absoluteProb)
During construction, add a new hand group with its absolute probability of occurrence. The sum of absolute probabilities over groups should be 1. Meant to be called by subclass's fromString().

addHandGroupRelative

(package private)  void addHandGroupRelative(HandGroup group,
                                             double relativeProb)
During construction, add a new hand group with its probability of occurrence relative to the Bayesian probability. Meant to be called by subclass's fromString()

addRemainingAbsolute

(package private)  void addRemainingAbsolute(double absoluteProb)
During construction, add each hand not yet added with the given absolute probability of occurrence of the entire set of such hands. The sum of absolute probabilities over groups should be 1. Meant to be called by subclass's fromString().

addRemainingRelative

(package private)  void addRemainingRelative(double relativeProb)
During construction, add each hand not yet added with its probability of occurrence relative to its Bayesian probability. Meant to be called by subclass's fromString()

fromString

public abstract void fromString(String spec)
Instantiate self from string respresentation. This method must be implemented by all subclasses. Also, subclass constructors should call super(spec) and then fromString(spec).

getBeliefProb

public double getBeliefProb(long hand)
Return the absolute probability that hand will occur, conditioned on the dead cards.

getHands

public long[] getHands()
Return an array of bitmasks representing hands with nonzero probability of occurring (conditioned on the dead cards).

numHands

public int numHands()
Returns the number of atomic hands with nonzero probability of occurring (conditioned on the dead cards).

setDeadCards

public void setDeadCards(long cards)
Set the "dead cards", cards that are known not to be available. This sets the probability to zero of any hand including any of these cards increases the probabilities of the other hands in proportion.

toString

public String toString()
Generate string representation of self; the inverse of fromString().

toStringAtomic

public String toStringAtomic()
Generate a string representation of self that gives probability details for all atomic hands, conditioned on the dead cards.

validate

(package private)  void validate()
After construction, subclasses should call this for a sanity check.

PokerSource Home Page - Learn how you can contribute!