Search in sources :

Example 1 with BoolDistBernoulli

use of desmoj.core.dist.BoolDistBernoulli in project scylla by bptlab.

the class InclusiveGatewayDistributionConversionPlugin method convertToDesmoJDistributions.

@SuppressWarnings("unchecked")
@Override
public Map<Integer, Object> convertToDesmoJDistributions(ProcessSimulationComponents pSimComponents) {
    Map<Integer, Object> branchingDistributionsInclusive = new HashMap<Integer, Object>();
    SimulationConfiguration simulationConfiguration = pSimComponents.getSimulationConfiguration();
    Map<Integer, BranchingBehavior> branchingBehaviors = (Map<Integer, BranchingBehavior>) simulationConfiguration.getExtensionValue(getName(), "branchingBehaviors");
    Long randomSeed = simulationConfiguration.getRandomSeed();
    ProcessModel processModel = pSimComponents.getProcessModel();
    SimulationModel model = pSimComponents.getModel();
    boolean showInReport = model.reportIsOn();
    boolean showInTrace = model.traceIsOn();
    for (Integer nodeId : branchingBehaviors.keySet()) {
        BranchingBehavior branchingBehavior = branchingBehaviors.get(nodeId);
        Map<Integer, Double> branchingProbabilities = branchingBehavior.getBranchingProbabilities();
        String name = processModel.getModelScopeId() + "_" + nodeId.toString();
        Map<Integer, BoolDistBernoulli> inclusiveDistributions = new HashMap<Integer, BoolDistBernoulli>();
        for (Integer nextNodeId : branchingProbabilities.keySet()) {
            Double probability = branchingProbabilities.get(nextNodeId);
            BoolDistBernoulli desmojDist = new BoolDistBernoulli(model, name, probability, showInReport, showInTrace);
            desmojDist.setSeed(randomSeed);
            inclusiveDistributions.put(nextNodeId, desmojDist);
        }
        branchingDistributionsInclusive.put(nodeId, inclusiveDistributions);
    }
    return branchingDistributionsInclusive;
}
Also used : ProcessModel(de.hpi.bpt.scylla.model.process.ProcessModel) BoolDistBernoulli(desmoj.core.dist.BoolDistBernoulli) HashMap(java.util.HashMap) BranchingBehavior(de.hpi.bpt.scylla.model.configuration.BranchingBehavior) SimulationConfiguration(de.hpi.bpt.scylla.model.configuration.SimulationConfiguration) Map(java.util.Map) HashMap(java.util.HashMap) SimulationModel(de.hpi.bpt.scylla.simulation.SimulationModel)

Aggregations

BranchingBehavior (de.hpi.bpt.scylla.model.configuration.BranchingBehavior)1 SimulationConfiguration (de.hpi.bpt.scylla.model.configuration.SimulationConfiguration)1 ProcessModel (de.hpi.bpt.scylla.model.process.ProcessModel)1 SimulationModel (de.hpi.bpt.scylla.simulation.SimulationModel)1 BoolDistBernoulli (desmoj.core.dist.BoolDistBernoulli)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1