Class LogitScalingBinaryWeightedAlignment<T extends Weight>

  • Type Parameters:
    T -

    public class LogitScalingBinaryWeightedAlignment<T extends Weight>
    extends AbstractProbabilityAlignment<T>
    Logit Scaling alignment (as introduced by P. Stephensen in International Journal of Microsimulation (2016) 9(3) 89-102), but for agents with binary choices rather than the general case of 'A' choices and agents who implement the Weight interface, so that the weight of each agent represents the number of individuals it represents. For use with multiple choices, use the LogitScalingWeightedAlignment class instead. If the agents do not implement the Weight interface, use the LogitScalingBinaryAlignment class instead.
    Author:
    Ross Richardson
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void align​(java.util.Collection<T> agents, org.apache.commons.collections4.Predicate<T> filter, AlignmentProbabilityClosure<T> closure, double targetShare)
      Aligns a sub-population of objects using Logit Scaling alignment.
      void align​(java.util.Collection<T> agents, org.apache.commons.collections4.Predicate<T> filter, AlignmentProbabilityClosure<T> closure, double targetShare, int maxNumberIterations, double precision, boolean enableWarnings)
      Aligns a sub-population of objects using Logit Scaling alignment.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogitScalingBinaryWeightedAlignment

        public LogitScalingBinaryWeightedAlignment()
    • Method Detail

      • align

        public void align​(java.util.Collection<T> agents,
                          org.apache.commons.collections4.Predicate<T> filter,
                          AlignmentProbabilityClosure<T> closure,
                          double targetShare)
        Aligns a sub-population of objects using Logit Scaling alignment. This method sets the default maximum number of iterations as 100, which should be much more than enough for most purposes (based on information in the original paper). This method also assumes a default precision of 1.e-5 and enables warnings to be sent to the System.out if the alignment target is not successfully reached. If it is desired to use a different maximum number of iterations or allowed error precison, or to turn off warnings, please use the method: align(List agentList, Predicate filter, AlignmentProbabilityClosure closure, double targetShare, int maxNumberIterations, double precision, boolean enableWarnings)
        Specified by:
        align in class AbstractProbabilityAlignment<T extends Weight>
        Parameters:
        agents - - list of agents to potentially apply alignment to (will be filtered by the 'filter' Predicate class); the agent class must implement the Weight interface by providing a getWeight() method. In the case of the alignment algorithm, getWeight() must return a positive value.
        filter - - filters the agentList so that only the relevant sub-population of agents is sampled
        closure - - AlignmentProbabilityClosure that specifies how to define the (unaligned) probability of the agent and how to implement the result of the aligned probability.
        targetShare - - the target share of the relevant sub-population (specified as a proportion of the filtered population) for which the mean of the aligned probabilities (defined by the AlignmentProbabilityClosure) must equal
      • align

        public void align​(java.util.Collection<T> agents,
                          org.apache.commons.collections4.Predicate<T> filter,
                          AlignmentProbabilityClosure<T> closure,
                          double targetShare,
                          int maxNumberIterations,
                          double precision,
                          boolean enableWarnings)
        Aligns a sub-population of objects using Logit Scaling alignment.
        Parameters:
        agents - - list of agents to potentially apply alignment to (will be filtered by the 'filter' Predicate class); the agent class must implement the Weight interface by providing a getWeight() method. In the case of the alignment algorithm, getWeight() must return a positive value.
        filter - - filters the agentList so that only the relevant sub-population of agents is sampled
        closure - - AlignmentProbabilityClosure that specifies how to define the (unaligned) probability of the agent and how to implement the result of the aligned probability.
        targetShare - - the target share of the relevant sub-population (specified as a proportion of the filtered population) for which the mean of the aligned probabilities (defined by the AlignmentProbabilityClosure) must equal
        maxNumberIterations - - The maximum number of iterations of the aligned probabilities before termination. The probabilities derived will be used as aligned probabilities, although if the maximum number of iterations is reached, it is possible that the mean of the probabilities has not converged to the alignment targetShare.
        precision - - The allowed error between the mean of the alignment probabilities and the targetShare. When the mean of the probabilities has converged to the targetShare within this precision, the algorithm will stop iterating (assuming the number of iterations has not exceeded the maxNumberIterations parameter) and the resultant probabilities should be considered the aligned probabilities.
        enableWarnings - - If set to true, warnings will be sent to the System.out if the alignment has not converged within the desired precision. If set to false, warnings will not be sent to the System.out.