p3j.simulation.assignments.exhaustive
Class ExhaustiveAssignmentGenerator

java.lang.Object
  extended by p3j.simulation.assignments.exhaustive.ExhaustiveAssignmentGenerator
All Implemented Interfaces:
IParamAssignmentGenerator

public class ExhaustiveAssignmentGenerator
extends Object
implements IParamAssignmentGenerator

Generator that analyses probabilities to select the most probable combinations first (and also avoid re-trying existing combinations). This leads to an exhaustive enumeration of all assignments, ordered by their probability. Created: August 21, 2008

Author:
Christina Bohk, Roland Ewald

Constructor Summary
ExhaustiveAssignmentGenerator()
           
 
Method Summary
 long assignmentsLeft()
          Retrieves number of possible parameter assignments that is left and can be generated by the assignment generator.
protected  double calcAssignmentProbability(List<Integer> indices)
          Calculates the assignment probability for a given list of assignment indices.
protected  long calculateNumOfCombinations(IProjectionModel proj)
          Calculates number of different combinations.
protected  long calculateNumOfSetCombinations(ProjectionModel proj)
          Calculates number of distinct sets.
 james.core.util.misc.Pair<Map<ParameterInstance,ParameterAssignment>,List<GeneratorError>> chooseParamAssignments(james.core.math.random.generators.IRandom random)
          This is the main execution method for PPPM simulators/analysers. mapping from each ParameterInstance defined in the ProjectionModel to one ParameterAssignment to be used in the calculation.
protected  Map<ParameterInstance,ParameterAssignment> createMapping(List<Integer> indices)
          Puts all assignments for the given index list into one map.
protected  Set<p3j.simulation.assignments.exhaustive.Assignment> getChildren(p3j.simulation.assignments.exhaustive.Assignment assignment)
          Retrieves all possible children for given SetTypeAssignment.
 ExhaustiveSimParameters getParameters()
          Gets the parameters.
 void init(IProjectionModel proj)
          Initializes generator with the projection setup.
protected  james.core.util.misc.Pair<Map<ParameterInstance,ParameterAssignment>,Double> nextAssignment()
          Generates next assignment.
protected  p3j.simulation.assignments.exhaustive.Assignment peek()
          Peeks for the next Settype assignment to choose.
 void setParameters(ExhaustiveSimParameters parameters)
          Sets the parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExhaustiveAssignmentGenerator

public ExhaustiveAssignmentGenerator()
Method Detail

init

public void init(IProjectionModel proj)
Description copied from interface: IParamAssignmentGenerator
Initializes generator with the projection setup.

Specified by:
init in interface IParamAssignmentGenerator
Parameters:
proj - the projection setup for which a valid (i.e., complete) parameter assignment shall be generated.

chooseParamAssignments

public james.core.util.misc.Pair<Map<ParameterInstance,ParameterAssignment>,List<GeneratorError>> chooseParamAssignments(james.core.math.random.generators.IRandom random)
Description copied from interface: IParamAssignmentGenerator
This is the main execution method for PPPM simulators/analysers. mapping from each ParameterInstance defined in the ProjectionModel to one ParameterAssignment to be used in the calculation. Additionally, this method retrieves all GeneratorError objects, which is the error log of the assignment generation process.

Specified by:
chooseParamAssignments in interface IParamAssignmentGenerator
Parameters:
random - the random number generator to be used when stochastic approaches are implemented
Returns:
tuple, first element is the mapping from each ParameterInstance defined in the ProjectionModel to one ParameterAssignment to be used, the second element is the error log

nextAssignment

protected james.core.util.misc.Pair<Map<ParameterInstance,ParameterAssignment>,Double> nextAssignment()
Generates next assignment.

Returns:
tuple (assignment, probability) containing the next most probable assignment and its corresponding probability, null if there is none left

peek

protected p3j.simulation.assignments.exhaustive.Assignment peek()
Peeks for the next Settype assignment to choose.

Returns:
the sets the type assignment

getChildren

protected Set<p3j.simulation.assignments.exhaustive.Assignment> getChildren(p3j.simulation.assignments.exhaustive.Assignment assignment)
Retrieves all possible children for given SetTypeAssignment.

Parameters:
assignment - the given assignment
Returns:
set containing all possible children

assignmentsLeft

public long assignmentsLeft()
Description copied from interface: IParamAssignmentGenerator
Retrieves number of possible parameter assignments that is left and can be generated by the assignment generator. If this returns 0, the execution will stop. Note that this is the minimal number, i.e. it may change dynamically over time and may even increase from one call to another.

Specified by:
assignmentsLeft in interface IParamAssignmentGenerator
Returns:
minimum number of assignments that can be generated

calculateNumOfCombinations

protected long calculateNumOfCombinations(IProjectionModel proj)
Calculates number of different combinations.

Parameters:
proj - the given projection setup
Returns:
the number of possible matrix assignments

calculateNumOfSetCombinations

protected long calculateNumOfSetCombinations(ProjectionModel proj)
Calculates number of distinct sets.

Parameters:
proj - the projection setup
Returns:
number of possible set combinations

calcAssignmentProbability

protected double calcAssignmentProbability(List<Integer> indices)
Calculates the assignment probability for a given list of assignment indices.

Parameters:
indices - list of assignment indices
Returns:
calculated probability

createMapping

protected Map<ParameterInstance,ParameterAssignment> createMapping(List<Integer> indices)
Puts all assignments for the given index list into one map.

Parameters:
indices - indices of Settype manager assignments
Returns:
complete parameter map

getParameters

public ExhaustiveSimParameters getParameters()
Gets the parameters.

Returns:
the parameters

setParameters

public void setParameters(ExhaustiveSimParameters parameters)
Sets the parameters.

Parameters:
parameters - the new parameters


Copyright © 2012. All Rights Reserved.