Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pokersource.enumerate
Class BeliefVector

    java.lang.Object
      org.pokersource.enumerate.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
`private java.util.HashMap` | `condHandProb` The belief probability (conditioned by dead cards) for each atomic starting hand.
`private long` | `deadCards` The bitmask of dead cards.
`private java.util.HashMap` | `groupProb` The belief probability (unconditioned by dead cards) of each hand group.
`private boolean` | `hasAbsolute`
`private boolean` | `hasRelative`
`private java.lang.String` | `myspec` Our string representation, from the constructor.
`private java.util.HashMap` | `uncondHandProb` The belief probability (unconditioned by dead cards) for each atomic starting hand.
`(package private) HandGroup` | `universalGroup` The universe of all possible hands.

Constructor Summary
`BeliefVector(java.lang.String spec)` Instantiate self from string respresentation.

Method Summary
`private void` | `addHandGroup(HandGroup group, double prob)`
`(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.
`private void` | `addRemaining(double prob)`
`(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.
`private void` | `computeConditionedHandProb()`
`private void` | `computeUnconditionedHandProb()`
`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.
`private double` | `totalAbsoluteProb()`
`private double` | `totalRelativeProb()`
`(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

### myspec

    private java.lang.String myspec

  Our string representation, from the constructor.

### 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.

### groupProb

    private java.util.HashMap groupProb

  The belief probability (unconditioned by dead cards) of each hand group. Hash key is HandGroup, value is Double. Positive value is the relative probability compared to uniform Bayesian prior (so, a value of +2 means hand from this group are twice as likely as would be expected from a uniform distribution over all possible hands); a negative value indicates an absolute probability (so -0.40 means that hands in this group account for 40% of the total probability). Values must be either all positive or all negative.

### deadCards

    private long deadCards

  The bitmask of dead cards. This conditions the probabilities returned by getBeliefProb().

### uncondHandProb

    private java.util.HashMap uncondHandProb

  The belief probability (unconditioned by dead cards) for each atomic starting hand. Updated as needed by computeUnconditionedHandProb().

### condHandProb

    private java.util.HashMap condHandProb

  The belief probability (conditioned by dead cards) for each atomic starting hand. Updated as needed by computeConditionedHandProb().

### hasRelative

    private boolean hasRelative

### hasAbsolute

    private boolean hasAbsolute

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.

### computeConditionedHandProb

    private void computeConditionedHandProb()

### totalRelativeProb

    private double totalRelativeProb()

### totalAbsoluteProb

    private double totalAbsoluteProb()

### computeUnconditionedHandProb

    private void computeUnconditionedHandProb()

### 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.

### addHandGroup

    private void addHandGroup(HandGroup group,
                              double prob)

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

### addRemaining

    private void addRemaining(double prob)

### 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD