p3j.simulation.assignments.random
Class RandomParamAssignmentGenerator

java.lang.Object
  extended by p3j.simulation.assignments.random.RandomParamAssignmentGenerator
All Implemented Interfaces:
IParamAssignmentGenerator

public class RandomParamAssignmentGenerator
extends Object
implements IParamAssignmentGenerator

Simple parameter assignment generator that just employs random sampling. Created: August 17, 2008

Author:
Christina Bohk, Roland Ewald

Constructor Summary
RandomParamAssignmentGenerator()
           
 
Method Summary
 long assignmentsLeft()
          The number of assignments is practically unlimited in all realistic situations.
 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.
 Map<ParameterInstance,ParameterAssignment> chooseParameterAssignmentsRandomly(Set set, RandomNumberChecks rnc, james.core.math.random.generators.IRandom rand, List<GeneratorError> errorLog)
          Executes second level of Monte-Carlo simulation.
 Set chooseSetRandomly(SetType setType, RandomNumberChecks rnc, james.core.math.random.generators.IRandom rand, List<GeneratorError> errorLog)
          Chooses a set randomly.
 void init(IProjectionModel proj)
          Initializes generator with the projection setup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomParamAssignmentGenerator

public RandomParamAssignmentGenerator()
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

chooseSetRandomly

public Set chooseSetRandomly(SetType setType,
                             RandomNumberChecks rnc,
                             james.core.math.random.generators.IRandom rand,
                             List<GeneratorError> errorLog)
Chooses a set randomly.

Parameters:
setType - the Settype from which to choose a set at random
rnc - the RandomNumberChecks instance for validity checks
rand - the random number generator
errorLog - the errors that might occur due erroneous specification of scenario (to be filled, see RandomNumberChecks)
Returns:
a randomly chosen set

chooseParameterAssignmentsRandomly

public Map<ParameterInstance,ParameterAssignment> chooseParameterAssignmentsRandomly(Set set,
                                                                                     RandomNumberChecks rnc,
                                                                                     james.core.math.random.generators.IRandom rand,
                                                                                     List<GeneratorError> errorLog)
Executes second level of Monte-Carlo simulation. For each ParameterInstance, one ParameterAssignment is chosen.

Parameters:
set - the set from which the mapping should be chosen
rnc - the checker for probability validity
rand - the randomiser to be used
errorLog - the error log
Returns:
maps that gives one assignment for each instance defined by the SetType

assignmentsLeft

public long assignmentsLeft()
The number of assignments is practically unlimited in all realistic situations. TODO: Retrieve calculation of exact number

Specified by:
assignmentsLeft in interface IParamAssignmentGenerator
Returns:
Long.MAX_VALUE


Copyright © 2012. All Rights Reserved.