Skip to content

Commit

Permalink
PointConditionalD: Revert ratio/unif search bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Nov 7, 2024
1 parent ae136d3 commit a79d975
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/etc/openturns.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
<DeconditionedDistribution-ContinuousDiscretizationMethod value_str="GaussProduct" />

<!-- OT::PointConditionalDistribution parameters -->
<PointConditionalDistribution-RatioUniformBoundsFactor value_float="3.0" />
<PointConditionalDistribution-CubaAlgorithm value_str="cuhre" />
<PointConditionalDistribution-OptimizationAlgorithm value_str="Cobyla" />
<PointConditionalDistribution-SmallDimension value_int="6" />
Expand Down
1 change: 1 addition & 0 deletions lib/src/Base/Common/ResourceMap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ void ResourceMap::loadDefaultConfiguration()
addAsString("DeconditionedDistribution-ContinuousDiscretizationMethod", "GaussProduct");

// PointConditionalDistribution parameters //
addAsScalar("PointConditionalDistribution-RatioUniformBoundsFactor", 3.0);
addAsString("PointConditionalDistribution-CubaAlgorithm", "cuhre");
addAsString("PointConditionalDistribution-OptimizationAlgorithm", "Cobyla");
addAsUnsignedInteger("PointConditionalDistribution-SmallDimension", 6);
Expand Down
13 changes: 10 additions & 3 deletions lib/src/Uncertainty/Distribution/PointConditionalDistribution.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ void PointConditionalDistribution::update()

// enable simplified path
useSimplifiedVersion_ = hasSimplifiedVersion(simplifiedVersion_);
LOGDEBUG(OSS() << "useSimplifiedVersion_=" << useSimplifiedVersion_);

// cache marginal for reuse
if (!useSimplifiedVersion_)
Expand All @@ -257,10 +258,12 @@ void PointConditionalDistribution::update()
const UnsignedInteger dimension = getDimension();
if (!useSimplifiedVersion_ && isContinuous() && (dimension <= ResourceMap::GetAsUnsignedInteger("PointConditionalDistribution-SmallDimension")))
{
const Interval bounds(getRange());
const Point stddev(getStandardDeviation());
const Point mean(getMean());
const Scalar factor = ResourceMap::GetAsScalar("PointConditionalDistribution-RatioUniformBoundsFactor");
const Interval bounds(getRange().intersect(Interval(mean - factor * stddev, mean + factor * stddev)));
const Point lb(bounds.getLowerBound());
const Point ub(bounds.getUpperBound());
const Point middle(0.5 * (lb + ub));

// First, the upper bound on U
const Function objectiveU(new PointConditionalDistributionUBoundEvaluation(*this, r_));
Expand All @@ -269,9 +272,10 @@ void PointConditionalDistribution::update()
problemU.setBounds(bounds);
OptimizationAlgorithm algo(OptimizationAlgorithm::GetByName(ResourceMap::GetAsString("PointConditionalDistribution-OptimizationAlgorithm")));
algo.setProblem(problemU);
algo.setStartingPoint(middle);
algo.setStartingPoint(mean);
algo.run();
supU_ = std::exp(algo.getResult().getOptimalValue()[0]);
LOGDEBUG(OSS() << "supU_=" << supU_);

// Second, the lower and upper bounds on V
const Function objectiveV(new PointConditionalDistributionVBoundEvaluation(*this, r_));
Expand All @@ -290,6 +294,7 @@ void PointConditionalDistribution::update()
algo.setStartingPoint(ub * 0.5);
algo.run();
supV_[i] = std::exp(algo.getResult().getOptimalValue()[0]);
LOGDEBUG(OSS() << "supV_[" << i << "]=" << supV_[i]);
}
if (lb[i] < 0.0)
{
Expand All @@ -298,6 +303,7 @@ void PointConditionalDistribution::update()
algo.setStartingPoint(lb * 0.5);
algo.run();
infV_[i] = -std::exp(algo.getResult().getOptimalValue()[0]);
LOGDEBUG(OSS() << "infV_[" << i << "]=" << infV_[i]);
}
}
}
Expand All @@ -312,6 +318,7 @@ void PointConditionalDistribution::update()
x.add(getRange().getLowerBound());
conditioningCDF_ = reorderedDistribution_.computeSequentialConditionalCDF(x);
conditioningCDF_.resize(conditioningIndices_.getSize());
LOGDEBUG(OSS() << "conditioningCDF_=" << conditioningCDF_);
}


Expand Down

0 comments on commit a79d975

Please sign in to comment.