Package microsim.alignment.multiple
Class LogitScalingAlignment<T>
- java.lang.Object
-
- microsim.alignment.multiple.AbstractMultiProbabilityAlignment<T>
-
- microsim.alignment.multiple.LogitScalingAlignment<T>
-
- Type Parameters:
T
-
public class LogitScalingAlignment<T> extends AbstractMultiProbabilityAlignment<T>
Logit Scaling alignment (as introduced by P. Stephensen in International Journal of Microsimulation (2016) 9(3) 89-102), for the general case of 'A' choices. For use with weighted agents (where the weight of an agent corresponds to the number of individuals it represents, use the LogitScalingWeightedAlignment instead.- Author:
- Ross Richardson
-
-
Constructor Summary
Constructors Constructor Description LogitScalingAlignment()
-
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, AlignmentMultiProbabilityClosure<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, AlignmentMultiProbabilityClosure<T> closure, double[] targetShare, int maxNumberIterations, double precision, boolean enableWarnings)
Aligns a sub-population of objects using Logit Scaling alignment.
-
-
-
Method Detail
-
align
public void align(java.util.Collection<T> agents, org.apache.commons.collections4.Predicate<T> filter, AlignmentMultiProbabilityClosure<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(ListagentList, Predicate filter, AlignmentProbabilityClosure closure, double targetShare, int maxNumberIterations, double precision, boolean enableWarnings) - Specified by:
align
in classAbstractMultiProbabilityAlignment<T>
- Parameters:
agents
- - list of agents to potentially apply alignment to (will be filtered by the 'filter' Predicate class)filter
- - filters the agentList so that only the relevant sub-population of agents is sampledclosure
- - 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, AlignmentMultiProbabilityClosure<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)filter
- - filters the agentList so that only the relevant sub-population of agents is sampledclosure
- - 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 equalmaxNumberIterations
- - 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 largest accepted difference between two iterations of the average (mean) aligned probability. When the average aligned probability iteration has converged to a value 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 true 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.
-
-