PokerSource Java API

org.pokersource.enum
Class BeliefVector

java.lang.Object
  extended by org.pokersource.enum.BeliefVector
Direct Known 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(java.lang.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(java.lang.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.
 java.lang.String toString()
          Generate string representation of self; the inverse of fromString().
 java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

universalGroup

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 Detail

BeliefVector

public BeliefVector(java.lang.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 Detail

fromString

public abstract void fromString(java.lang.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).


toString

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

Overrides:
toString in class java.lang.Object

toStringAtomic

public java.lang.String toStringAtomic()
Generate a string representation of self that gives probability details for all atomic hands, 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).


getHands

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


getBeliefProb

public double getBeliefProb(long hand)
Return the absolute probability that hand will occur, 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.


addHandGroupRelative

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()


addHandGroupAbsolute

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().


addRemainingRelative

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()


addRemainingAbsolute

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().


validate

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


PokerSource Java API

PokerSource Home Page - Learn how you can contribute!