p3j.simulation.assignments.exhaustive
Class SetManager

java.lang.Object
  extended by p3j.simulation.assignments.exhaustive.SetManager

public class SetManager
extends Object

Manages all Set objects for a certain SetType. It is responsible to create new parameter assignments for all ParameterInstance objects hat are covered by the SetType of its Set. The assignments should have a *decreasing* probability, new assignments can be triggered by calling nextAssignment(), the current assignment can be retrieved with getCurrentMapping(). Basically, the set manager conducts a breadth-first search, guided by the probabilities of the index tuples. Created: August 22, 2008

Author:
Christina Bohk, Roland Ewald

Constructor Summary
SetManager(Set s, SetType setType)
          Default constructor.
 
Method Summary
protected  double calcSetAssignmentProbability()
          Calculate probability that current set and the most probable assignment are chosen.
protected  double getCurrentAssignmentProb()
          Gets the current assignment probability.
protected  Map<ParameterInstance,ParameterAssignment> getCurrentMapping()
          Creates mapping from all ParameterInstance objects covered by the SetType of the managed Set to the currently selected ParameterAssignment instances.
protected  double getNextAssignmentProb()
          Get probability of next assignment combination.
protected  boolean nextAssignment()
          Increments a single index to goto the next-probable combination of sets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetManager

public SetManager(Set s,
                  SetType setType)
Default constructor.

Parameters:
s - the set to be managed
setType - the type of the set
Method Detail

calcSetAssignmentProbability

protected double calcSetAssignmentProbability()
Calculate probability that current set and the most probable assignment are chosen.

Returns:
the probability of the set, multiplied with the probability of the currently most probable assignment combination, -1 if there is no assignment left

nextAssignment

protected final boolean nextAssignment()
Increments a single index to goto the next-probable combination of sets.

Returns:
true, if new assignment could be selected, otherwise false

getNextAssignmentProb

protected double getNextAssignmentProb()
Get probability of next assignment combination.

Returns:
probability of next assignment combination

getCurrentAssignmentProb

protected double getCurrentAssignmentProb()
Gets the current assignment probability.

Returns:
the current assignment probability

getCurrentMapping

protected Map<ParameterInstance,ParameterAssignment> getCurrentMapping()
Creates mapping from all ParameterInstance objects covered by the SetType of the managed Set to the currently selected ParameterAssignment instances.

Returns:
the mapping instance -> assignment


Copyright © 2012. All Rights Reserved.