routing.maxprop
Class MeetingProbabilitySet

java.lang.Object
  extended by routing.maxprop.MeetingProbabilitySet

public class MeetingProbabilitySet
extends java.lang.Object

Class for storing and manipulating the meeting probabilities for the MaxProp router module.


Field Summary
static int INFINITE_SET_SIZE
           
 
Constructor Summary
MeetingProbabilitySet()
          Constructor.
MeetingProbabilitySet(double alpha, java.util.List<java.lang.Integer> initiallyKnownNodes)
          Constructor.
MeetingProbabilitySet(int maxSetSize, double alpha)
          Constructor.
 
Method Summary
 java.util.Map<java.lang.Integer,java.lang.Double> getAllProbs()
          Returns a reference to the probability map of this probability set
 double getLastUpdateTime()
          Returns the time when this probability set was last updated
 double getProbFor(java.lang.Integer index)
          Returns the current delivery probability value for the given node index
 MeetingProbabilitySet replicate()
          Returns a deep copy of the probability set
 void setAlpha(double alpha)
          Enables changing the alpha parameter dynamically
 java.lang.String toString()
          Returns a String presentation of the probabilities
 void updateMeetingProbFor(java.lang.Integer index)
          Updates meeting probability for the given node index.
 void updateMeetingProbFor(java.lang.Integer index, double iet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITE_SET_SIZE

public static final int INFINITE_SET_SIZE
See Also:
Constant Field Values
Constructor Detail

MeetingProbabilitySet

public MeetingProbabilitySet(int maxSetSize,
                             double alpha)
Constructor. Creates a probability set with empty node-probability mapping.

Parameters:
maxSetSize - Maximum size of the probability set; when the set is full, smallest values are dropped when new are added

MeetingProbabilitySet

public MeetingProbabilitySet()
Constructor. Creates a probability set with empty node-probability mapping and infinite set size


MeetingProbabilitySet

public MeetingProbabilitySet(double alpha,
                             java.util.List<java.lang.Integer> initiallyKnownNodes)
Constructor. Creates a probability set with equal probability for all the given node indexes.

Method Detail

updateMeetingProbFor

public void updateMeetingProbFor(java.lang.Integer index)
Updates meeting probability for the given node index.
 P(b) = P(b)_old + alpha
 Normalize{P}
I.e., The probability of the given node index is increased by one and then all the probabilities are normalized so that their sum equals to 1.

Parameters:
index - The node index to update the probability for

updateMeetingProbFor

public void updateMeetingProbFor(java.lang.Integer index,
                                 double iet)

getProbFor

public double getProbFor(java.lang.Integer index)
Returns the current delivery probability value for the given node index

Parameters:
index - The index of the node to look the P for
Returns:
the current delivery probability value

getAllProbs

public java.util.Map<java.lang.Integer,java.lang.Double> getAllProbs()
Returns a reference to the probability map of this probability set

Returns:
a reference to the probability map of this probability set

getLastUpdateTime

public double getLastUpdateTime()
Returns the time when this probability set was last updated

Returns:
the time when this probability set was last updated

setAlpha

public void setAlpha(double alpha)
Enables changing the alpha parameter dynamically


replicate

public MeetingProbabilitySet replicate()
Returns a deep copy of the probability set

Returns:
a deep copy of the probability set

toString

public java.lang.String toString()
Returns a String presentation of the probabilities

Overrides:
toString in class java.lang.Object
Returns:
a String presentation of the probabilities