Mix/max search using optimizationΒΆ

In this example we are going to evaluate the min and max values of the output variable of interest in a domain using an optimization algorithm.

[1]:
from __future__ import print_function
import openturns as ot
import math as m
[2]:
# Create the marginal distributions of the parameters
dist_E = ot.Beta(0.93, 2.27, 2.8e7, 4.8e7)
dist_F = ot.LogNormalMuSigma(30000, 9000, 15000).getDistribution()
dist_L = ot.Uniform(250, 260)
dist_I = ot.Beta(2.5, 1.5, 3.1e2, 4.5e2)
marginals = [dist_E, dist_F, dist_L, dist_I]
distribution = ot.ComposedDistribution(marginals)
[3]:
# Define bounds
lowerBound = [marginal.computeQuantile(0.1)[0] for marginal in marginals]
upperBound = [marginal.computeQuantile(0.9)[0] for marginal in marginals]
bounds = ot.Interval(lowerBound, upperBound)
[4]:
# Create the model
model = ot.SymbolicFunction(['E', 'F', 'L', 'I'], ['F*L^3/(3*E*I)'])
[5]:
# Define the problems
minProblem = ot.OptimizationProblem(model)
minProblem.setBounds(bounds)

maxProblem = ot.OptimizationProblem(model)
maxProblem.setBounds(bounds)
maxProblem.setMinimization(False)
[6]:
# Create a solver
solver = ot.TNC()
solver.setStartingPoint(distribution.getMean())
[7]:
# Solve the problems
solver.setProblem(minProblem)
solver.run()
minResult = solver.getResult()
print('min: y=', minResult.getOptimalValue(), 'with x=', minResult.getOptimalPoint())

solver.setProblem(maxProblem)
solver.run()
maxResult = solver.getResult()
print('max: y=', maxResult.getOptimalValue(), 'with x=', maxResult.getOptimalPoint())
min: y= [6.37642] with x= [4.04419e+07,21319.7,251,435.785]
max: y= [23.4246] with x= [2.87477e+07,41178.7,259,354.141]