Skip to content

Commit

Permalink
Joint
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Oct 11, 2024
1 parent 91dc4d9 commit 8ae4b7c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions lib/src/InverseFORM.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <openturns/Normal.hxx>
#include <openturns/StandardEvent.hxx>
#include <openturns/LinearFunction.hxx>
#include <openturns/ComposedDistribution.hxx>
#include <openturns/JointDistribution.hxx>
#include <openturns/CompositeRandomVector.hxx>
#include <openturns/ThresholdEvent.hxx>
#include <openturns/ComposedFunction.hxx>
Expand Down Expand Up @@ -237,11 +237,11 @@ Function InverseFORM::getG(const Scalar p)
#if OPENTURNS_VERSION >= 102300
const JointDistribution * p_joint = dynamic_cast<JointDistribution *>(distribution.getImplementation().get());
#else
const ComposedDistribution * p_joint = dynamic_cast<ComposedDistribution *>(distribution.getImplementation().get());
const JointDistribution * p_joint = dynamic_cast<JointDistribution *>(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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/src/SequentialMonteCarloRobustAlgorithm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <openturns/PersistentObjectFactory.hxx>
#include <openturns/FixedExperiment.hxx>
#include <openturns/IdentityFunction.hxx>
#include <openturns/ComposedDistribution.hxx>
#include <openturns/JointDistribution.hxx>
#include <openturns/LHSExperiment.hxx>
#include <openturns/SpecFunc.hxx>
#include <openturns/Uniform.hxx>
Expand Down Expand Up @@ -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_);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/SubsetInverseSampling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <openturns/KernelSmoothing.hxx>
#include <openturns/Normal.hxx>
#include <openturns/ChiSquare.hxx>
#include <openturns/ComposedDistribution.hxx>
#include <openturns/JointDistribution.hxx>
#include <openturns/SpecFunc.hxx>
#include <openturns/DistFunc.hxx>
#include <openturns/Uniform.hxx>
Expand Down Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions lib/test/t_InverseFORM_sphere.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/test/t_InverseFORM_std.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/test/t_MeasureEvaluation_std.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ int main()
Collection <MeasureEvaluation> measures;
measures.add(MeanMeasure(f, thetaDist));
measures.add(VarianceMeasure(f, thetaDist));
measures.add(WorstCaseMeasure(f, ComposedDistribution(Collection<Distribution>(2, Uniform(-1.0, 4.0)))));
measures.add(WorstCaseMeasure(f, ComposedDistribution(Collection<Distribution>(2, Uniform(-1.0, 4.0))), false));
measures.add(WorstCaseMeasure(f, JointDistribution(Collection<Distribution>(2, Uniform(-1.0, 4.0)))));
measures.add(WorstCaseMeasure(f, JointDistribution(Collection<Distribution>(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)));
Expand Down
2 changes: 1 addition & 1 deletion python/test/sequential_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/test/t_InverseFORM_std.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))]

Expand Down
4 changes: 2 additions & 2 deletions python/test/t_MeasureEvaluation_std.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 8ae4b7c

Please sign in to comment.