diff --git a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java index 4e6f276..175a7b8 100644 --- a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java +++ b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java @@ -28,6 +28,7 @@ import tools.mdsd.probdist.api.entity.Value; import tools.mdsd.probdist.api.factory.IProbabilityDistributionFactory; import tools.mdsd.probdist.api.factory.ProbabilityCalculator; +import tools.mdsd.probdist.api.random.ISeedProvider; import tools.mdsd.probdist.distributionfunction.Domain; import tools.mdsd.probdist.distributionfunction.ProbabilityDistribution; import tools.mdsd.probdist.distributiontype.ProbabilityDistributionSkeleton; @@ -161,7 +162,7 @@ public Double probability(List> inputs) { } @Override - public void init(int seed) { + public void init(ISeedProvider seedProvider) { if (initialized) { return; } @@ -170,7 +171,7 @@ public void init(int seed) { for (LocalProbabilisticNetwork eachLocal : groundNetwork.getLocalProbabilisticModels()) { for (GroundRandomVariable eachVariable : eachLocal.getGroundRandomVariables()) { ProbabilityDistributionFunction pdf = probModelHandler.getPDF(eachVariable); - pdf.init(seed); + pdf.init(seedProvider); } } } diff --git a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java index 363c580..6405f5d 100644 --- a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java +++ b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java @@ -31,6 +31,7 @@ import tools.mdsd.probdist.api.entity.ProbabilityDistributionFunction; import tools.mdsd.probdist.api.entity.Value; import tools.mdsd.probdist.api.factory.IProbabilityDistributionFactory; +import tools.mdsd.probdist.api.random.ISeedProvider; import tools.mdsd.probdist.distributionfunction.Domain; import tools.mdsd.probdist.distributionfunction.ProbabilityDistribution; import tools.mdsd.probdist.distributiontype.ProbabilityDistributionSkeleton; @@ -213,20 +214,20 @@ public Double probability(Trajectory value) { } @Override - public void init(int seed) { + public void init(ISeedProvider seedProvider) { if (initialized) { throw new RuntimeException("already initialized"); } initialized = true; - initialDistribution.init(seed); + initialDistribution.init(seedProvider); for (InterTimeSliceInduction each : dynBehaviourQuery.getInterTimeSliceInductions()) { ConditionableProbabilityDistribution localCPD = probHandler.getCPD(each.getAppliedGroundVariable()); - localCPD.init(seed); + localCPD.init(seedProvider); } for (IntraTimeSliceInduction each : dynBehaviourQuery.getIntraTimeSliceInductions()) { ConditionableProbabilityDistribution localCPD = getCPDFromInitial(each, conditionals); - localCPD.init(seed); + localCPD.init(seedProvider); } } diff --git a/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java b/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java index 8b07de4..02105dd 100644 --- a/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java +++ b/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java @@ -15,6 +15,7 @@ import tools.mdsd.probdist.api.factory.ProbabilityDistributionFactory; import tools.mdsd.probdist.api.parser.DefaultParameterParser; import tools.mdsd.probdist.api.parser.ParameterParser; +import tools.mdsd.probdist.api.random.NoSeedProvider; import tools.mdsd.probdist.distributiontype.ProbabilityDistributionRepository; public class BayesianModelTest { @@ -40,7 +41,7 @@ public static void setUpModels() { IProbabilityDistributionRepositoryLookup probDistRepoLookup = new ProbabilityDistributionRepositoryLookup( distTypes); - defaultProbabilityDistributionFactory = new ProbabilityDistributionFactory(); + defaultProbabilityDistributionFactory = new ProbabilityDistributionFactory(new NoSeedProvider()); IProbabilityDistributionRegistry probabilityDistributionRegistry = defaultProbabilityDistributionFactory; ParameterParser parameterParser = new DefaultParameterParser(); probabilityDistributionRegistry