From 8ae4b7c52fdc09f22ac87b0c64ffc4c55a439742 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Fri, 11 Oct 2024 22:10:46 +0200 Subject: [PATCH] Joint --- lib/src/InverseFORM.cxx | 8 ++++---- lib/src/SequentialMonteCarloRobustAlgorithm.cxx | 6 +++--- lib/src/SubsetInverseSampling.cxx | 4 ++-- lib/test/t_InverseFORM_sphere.cxx | 12 ++++++------ lib/test/t_InverseFORM_std.cxx | 4 ++-- lib/test/t_MeasureEvaluation_std.cxx | 4 ++-- python/test/sequential_mc.py | 2 +- python/test/t_InverseFORM_std.py | 2 +- python/test/t_MeasureEvaluation_std.py | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/src/InverseFORM.cxx b/lib/src/InverseFORM.cxx index e18a9d1..453cf2f 100755 --- a/lib/src/InverseFORM.cxx +++ b/lib/src/InverseFORM.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -237,11 +237,11 @@ Function InverseFORM::getG(const Scalar p) #if OPENTURNS_VERSION >= 102300 const JointDistribution * p_joint = dynamic_cast(distribution.getImplementation().get()); #else - const ComposedDistribution * p_joint = dynamic_cast(distribution.getImplementation().get()); + const JointDistribution * p_joint = dynamic_cast(distribution.getImplementation().get()); #endif if (p_joint) { - ComposedDistribution::DistributionCollection distributionCollection(p_joint->getDistributionCollection()); + JointDistribution::DistributionCollection distributionCollection(p_joint->getDistributionCollection()); for (UnsignedInteger i = 0; i < distributionCollection.getSize(); ++ i) { #if OPENTURNS_VERSION >= 102400 @@ -280,7 +280,7 @@ Function InverseFORM::getG(const Scalar p) ConditionalDistribution newConditional(p_conditional->getConditionedDistribution(), conditioning); #endif distributionCollection[i] = newConditional; - ComposedDistribution newDistribution(distributionCollection); + JointDistribution newDistribution(distributionCollection); antecedent = RandomVector(newDistribution); } // if p_conditional } // if conditional diff --git a/lib/src/SequentialMonteCarloRobustAlgorithm.cxx b/lib/src/SequentialMonteCarloRobustAlgorithm.cxx index 4ffea4b..24857f2 100644 --- a/lib/src/SequentialMonteCarloRobustAlgorithm.cxx +++ b/lib/src/SequentialMonteCarloRobustAlgorithm.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -143,10 +143,10 @@ void SequentialMonteCarloRobustAlgorithm::run() if (!getProblem().hasBounds()) throw InvalidArgumentException(HERE) << "Cannot perform multi-start without bounds"; - ComposedDistribution::DistributionCollection coll(dimension); + JointDistribution::DistributionCollection coll(dimension); for (UnsignedInteger j = 0; j < dimension; ++ j) coll[j] = Uniform(getProblem().getBounds().getLowerBound()[j], getProblem().getBounds().getUpperBound()[j]); - LHSExperiment initialExperiment(ComposedDistribution(coll), initialSearch_); + LHSExperiment initialExperiment(JointDistribution(coll), initialSearch_); initialStartingPoints_ = initialExperiment.generate(); MultiStart multiStart(solver, initialStartingPoints_); diff --git a/lib/src/SubsetInverseSampling.cxx b/lib/src/SubsetInverseSampling.cxx index af676b9..a948d67 100644 --- a/lib/src/SubsetInverseSampling.cxx +++ b/lib/src/SubsetInverseSampling.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -449,7 +449,7 @@ void SubsetInverseSampling::generatePoints(Scalar threshold) { UnsignedInteger maximumOuterSampling = getMaximumOuterSampling(); UnsignedInteger blockSize = getBlockSize(); - Distribution randomWalk(ComposedDistribution(ComposedDistribution::DistributionCollection(dimension_, Uniform(-0.5*proposalRange_, 0.5*proposalRange_)))); + Distribution randomWalk(JointDistribution(JointDistribution::DistributionCollection(dimension_, Uniform(-0.5*proposalRange_, 0.5*proposalRange_)))); UnsignedInteger N = currentPointSample_.getSize(); // total sample size UnsignedInteger Nc = conditionalProbability_ * N; //number of seeds (also = maximumOuterSampling*blockSize) diff --git a/lib/test/t_InverseFORM_sphere.cxx b/lib/test/t_InverseFORM_sphere.cxx index 0c7743a..5888a1e 100644 --- a/lib/test/t_InverseFORM_sphere.cxx +++ b/lib/test/t_InverseFORM_sphere.cxx @@ -24,10 +24,10 @@ int main() Dirac mulog_eDist(L0); mulog_eDist.setDescription(Description(1, "mulog_e")); - ComposedDistribution::DistributionCollection eColl; eColl.add(mulog_eDist); eColl.add(Dirac(0.1)); eColl.add(Dirac(0.)); - ComposedDistribution eParams(eColl); + JointDistribution::DistributionCollection eColl; eColl.add(mulog_eDist); eColl.add(Dirac(0.1)); eColl.add(Dirac(0.)); + JointDistribution eParams(eColl); - ComposedDistribution::DistributionCollection coll; + JointDistribution::DistributionCollection coll; coll.add(Beta(0.117284, 0.117284, 2.9, 3.1));//R #if OPENTURNS_VERSION >= 102400 DeconditionedDistribution eDist(LogNormal(L0, 0.1, 0.), eParams); @@ -36,7 +36,7 @@ int main() #endif coll.add(eDist);//e coll.add(WeibullMin(3.16471, 9.21097, 0.0));//p - ComposedDistribution myDistribution(coll); + JointDistribution myDistribution(coll); Point median(dim); for(UnsignedInteger i = 0; i < dim; ++ i) @@ -64,14 +64,14 @@ int main() // FORM must yield the same probability on the limit state with parameter set to the optimum eColl[0] = Dirac(result.getParameter()[0]); - eParams = ComposedDistribution(eColl); + eParams = JointDistribution(eColl); #if OPENTURNS_VERSION >= 102400 eDist = DeconditionedDistribution(LogNormal(result.getParameter()[0], 0.1, 0.0), eParams); #else eDist = ConditionalDistribution(LogNormal(result.getParameter()[0], 0.1, 0.0), eParams); #endif coll[1] = eDist; - myDistribution = ComposedDistribution(coll); + myDistribution = JointDistribution(coll); vect = RandomVector(myDistribution); parametric.setParameter(result.getParameter()); output = CompositeRandomVector(parametric, vect); diff --git a/lib/test/t_InverseFORM_std.cxx b/lib/test/t_InverseFORM_std.cxx index bfea93c..45c4192 100644 --- a/lib/test/t_InverseFORM_std.cxx +++ b/lib/test/t_InverseFORM_std.cxx @@ -21,13 +21,13 @@ int main() const SymbolicFunction function(Description({"E", "F", "L", "b", "h"}), Description({"F*L^3/(48.*E*b*h^3/12.)"})); ParametricFunction parametric(function, Indices({2}), Point({5.0})); - ComposedDistribution::DistributionCollection coll; + JointDistribution::DistributionCollection coll; coll.add(LogNormalMuSigmaOverMu(30000., 0.12, 0.).getDistribution());//E coll.add(LogNormalMuSigmaOverMu(0.1, 0.2, 0.).getDistribution());//F coll.add(LogNormalMuSigmaOverMu(0.2, 0.05, 0.).getDistribution());//b coll.add(LogNormalMuSigmaOverMu(0.4, 0.05, 0.).getDistribution());//h - const ComposedDistribution myDistribution(coll); + const JointDistribution myDistribution(coll); Point median(dim); for(UnsignedInteger i = 0; i < dim; ++ i) diff --git a/lib/test/t_MeasureEvaluation_std.cxx b/lib/test/t_MeasureEvaluation_std.cxx index 412bf1b..6823f74 100644 --- a/lib/test/t_MeasureEvaluation_std.cxx +++ b/lib/test/t_MeasureEvaluation_std.cxx @@ -72,8 +72,8 @@ int main() Collection measures; measures.add(MeanMeasure(f, thetaDist)); measures.add(VarianceMeasure(f, thetaDist)); - measures.add(WorstCaseMeasure(f, ComposedDistribution(Collection(2, Uniform(-1.0, 4.0))))); - measures.add(WorstCaseMeasure(f, ComposedDistribution(Collection(2, Uniform(-1.0, 4.0))), false)); + measures.add(WorstCaseMeasure(f, JointDistribution(Collection(2, Uniform(-1.0, 4.0))))); + measures.add(WorstCaseMeasure(f, JointDistribution(Collection(2, Uniform(-1.0, 4.0))), false)); measures.add(JointChanceMeasure(f, thetaDist, GreaterOrEqual(), 0.5)); measures.add(IndividualChanceMeasure(f, thetaDist, GreaterOrEqual(), Point(1, 0.5))); measures.add(MeanStandardDeviationTradeoffMeasure(f, thetaDist, Point(1, 0.8))); diff --git a/python/test/sequential_mc.py b/python/test/sequential_mc.py index d363f1f..66e2801 100644 --- a/python/test/sequential_mc.py +++ b/python/test/sequential_mc.py @@ -178,7 +178,7 @@ def solve(self): newPoint = self.solver_.getResult().getOptimalPoint() bestValue = self.solver_.getResult().getOptimalValue()[0] else: - startingPoints = ot.LHSExperiment(ot.ComposedDistribution( + startingPoints = ot.LHSExperiment(ot.JointDistribution( [ot.Uniform(self.bounds_.getLowerBound()[i], self.bounds_.getUpperBound()[i]) for i in range(self.bounds_.getDimension())]), self.initialSearch_).generate() bestValue = ot.SpecFunc.MaxScalar diff --git a/python/test/t_InverseFORM_std.py b/python/test/t_InverseFORM_std.py index 6d38abe..5da7426 100755 --- a/python/test/t_InverseFORM_std.py +++ b/python/test/t_InverseFORM_std.py @@ -16,7 +16,7 @@ coll.append(ot.LogNormalMuSigmaOverMu(0.2, 0.05, 0.).getDistribution()) # b coll.append(ot.LogNormalMuSigmaOverMu(0.4, 0.05, 0.).getDistribution()) # h -distribution = ot.ComposedDistribution(coll) +distribution = ot.JointDistribution(coll) x0 = [coll[i].computeQuantile(0.5)[0] for i in range(len(coll))] diff --git a/python/test/t_MeasureEvaluation_std.py b/python/test/t_MeasureEvaluation_std.py index d44c033..28a6f78 100755 --- a/python/test/t_MeasureEvaluation_std.py +++ b/python/test/t_MeasureEvaluation_std.py @@ -47,9 +47,9 @@ measures = [otrobopt.MeanMeasure(f, thetaDist), otrobopt.VarianceMeasure(f, thetaDist), otrobopt.WorstCaseMeasure( - f, ot.ComposedDistribution([ot.Uniform(-1.0, 4.0)] * 2)), + f, ot.JointDistribution([ot.Uniform(-1.0, 4.0)] * 2)), otrobopt.WorstCaseMeasure( - f, ot.ComposedDistribution( + f, ot.JointDistribution( [ot.Uniform(-1.0, 4.0)] * 2), False), otrobopt.JointChanceMeasure( f, thetaDist, ot.GreaterOrEqual(), 0.95),