Class MultiplicativeScalingAlignment<T>

java.lang.Object
microsim.alignment.probability.MultiplicativeScalingAlignment<T>
Type Parameters:
T - A class usually representing an agent.
All Implemented Interfaces:
AlignmentUtils<T>

public class MultiplicativeScalingAlignment<T> extends Object implements AlignmentUtils<T>
A class for multiplicative scaling alignment method. All probabilities are extracted from the collection agents using provided filter. Further steps involve calculation of the ration between the desired transition rate and the actual transition to be used as a scaling factor for probabilities.
See Also:
  • Constructor Details

    • MultiplicativeScalingAlignment

      public MultiplicativeScalingAlignment()
  • Method Details

    • align

      public double @NonNull [] align(@NonNull @NonNull Collection<T> agents, @Nullable @Nullable org.apache.commons.collections4.Predicate<T> filter, @NonNull @NonNull AlignmentProbabilityClosure<T> closure, double targetProbability)
      The main alignment method. It involves scaling the existing probabilities by multiplying by a factor. Its value is the target probability divided by the sum of all initial probabilities. The resulting values then are compared to a random number from the (0, 1) range to decide if the transition happens.
      Parameters:
      agents - An unfiltered collection of agents.
      filter - A logical filter for agents, can be null.
      closure - A closure to handle probabilities of agents.
      targetProbability - The target probability value.
      Returns:
      The corrected set of outcomes.
      Throws:
      NullPointerException - when agents, or closure, or both are null.