uchicago.src.sim.network
Class UniformReinforcement

java.lang.Object
  extended by uchicago.src.sim.network.AbstractProbabilityRule
      extended by uchicago.src.sim.network.UniformReinforcement
All Implemented Interfaces:
ProbabilityRule

public class UniformReinforcement
extends AbstractProbabilityRule

A ProbabiltyRule that implements uniform reinforcement. The idea here is that this UniformReinforcement contains a vector of weights associated with a list of Objects. update(Object o) adds a specified amount to the weight of the specified object. The probablity of each object is that objects weight divided by the sum of all the weights.

Version:
$Revision: 1.7 $ $Date: 2004/11/03 19:51:01 $

Field Summary
 
Fields inherited from class uchicago.src.sim.network.AbstractProbabilityRule
sum, weightMap, weights
 
Constructor Summary
UniformReinforcement(java.util.List objs, float startWeight)
          Create this UniformReinforcement using the specified list of objects and the specified startWeight.
UniformReinforcement(java.util.List objs, float startWeight, float amtToUpdate)
          Create this UniformReinforcement using the specified list of nodes and the specified startWeight, and the specified amtToUpdate.
UniformReinforcement(java.util.List objs, float startWeight, java.lang.Object exclude)
          Create this UniformReinforcement using the specified list of objects and the specified startWeight, excluding the specified object.
UniformReinforcement(java.util.List objs, float startWeight, java.lang.Object exclude, float amtToUpdate)
          Create this UniformReinforcement using the specified list of nodes, excluding the specified object, the specified startWeight, and the specified amtToUpdate.
 
Method Summary
 double getProbability(java.lang.Object o)
          Gets the probability for the specified object.
 RangeMap makeProbabilityMap(RangeMap map)
          Recreate the probability map for the list of Objects contained by this AbstractProbabilityRule using the specified RangeMap.
 void setPastDiscount(float val)
           
 void update(java.lang.Object o)
          Adds the amount to update (either 1 or specified in the constructor) to the weight of the specified object.
 void update(java.lang.Object o, float amt)
          Performs an update using the specified object and specified amount.
 
Methods inherited from class uchicago.src.sim.network.AbstractProbabilityRule
addNode, addToNodeWeight, calcSum, getWeight, getWeightListIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniformReinforcement

public UniformReinforcement(java.util.List objs,
                            float startWeight)
Create this UniformReinforcement using the specified list of objects and the specified startWeight. The amount to update an objects weight defaults to one.

Parameters:
objs - the objects to calculate probabilities for.
startWeight - the initial weight for each object in the weight vector

UniformReinforcement

public UniformReinforcement(java.util.List objs,
                            float startWeight,
                            float amtToUpdate)
Create this UniformReinforcement using the specified list of nodes and the specified startWeight, and the specified amtToUpdate.

Parameters:
objs - the objects to calculate probabilities for.
startWeight - the initial weight for each object in the weight vector

UniformReinforcement

public UniformReinforcement(java.util.List objs,
                            float startWeight,
                            java.lang.Object exclude)
Create this UniformReinforcement using the specified list of objects and the specified startWeight, excluding the specified object. The amount to update an objects weight defaults to one.

Parameters:
objs - the objects to calculate probabilities for.
startWeight - the initial weight for each object in the weight vector
exclude - the object to exclude from the list of objects

UniformReinforcement

public UniformReinforcement(java.util.List objs,
                            float startWeight,
                            java.lang.Object exclude,
                            float amtToUpdate)
Create this UniformReinforcement using the specified list of nodes, excluding the specified object, the specified startWeight, and the specified amtToUpdate.

Parameters:
objs - the objects to calculate probabilities for.
startWeight - the initial weight for each object in the weight vector
exclude - the object to exclude from the list of objects
Method Detail

setPastDiscount

public void setPastDiscount(float val)

makeProbabilityMap

public RangeMap makeProbabilityMap(RangeMap map)
Description copied from class: AbstractProbabilityRule
Recreate the probability map for the list of Objects contained by this AbstractProbabilityRule using the specified RangeMap.

Specified by:
makeProbabilityMap in interface ProbabilityRule
Overrides:
makeProbabilityMap in class AbstractProbabilityRule

getProbability

public double getProbability(java.lang.Object o)
Gets the probability for the specified object. The probabilty is calculated by dividing the current weight for this object by the sum of all the weights.

Specified by:
getProbability in interface ProbabilityRule
Specified by:
getProbability in class AbstractProbabilityRule

update

public void update(java.lang.Object o)
Adds the amount to update (either 1 or specified in the constructor) to the weight of the specified object.

Specified by:
update in interface ProbabilityRule
Specified by:
update in class AbstractProbabilityRule

update

public void update(java.lang.Object o,
                   float amt)
Description copied from interface: ProbabilityRule
Performs an update using the specified object and specified amount. The semantics of update are defined by implementing classes.

Specified by:
update in interface ProbabilityRule
Specified by:
update in class AbstractProbabilityRule