geomProfile = otlhs.GeometricProfile(10.0, 0.999, 50000) c2 = otlhs.SpaceFillingC2() sa = otlhs.SimulatedAnnealingLHS(lhsDesign, geomProfile, c2) tic = time.time() result = sa.generate() toc = time.time() dt1 = toc - tic print ("time=%f" % dt1) print ("dimension=%d, size=%d,sa=%s" % (dimension, size, sa)) print str(result.getOptimalValue()) + " c2=" + str(result.getC2()) + " phiP=" + str( result.getPhiP() ) + " minDist=" + str(result.getMinDist()) # plot design fig = PyPlotDesign(result.getOptimalDesign(), bounds, 10, 10, plot_kwargs={"color": "blue", "marker": "o", "ms": 6}) plt.suptitle("LHS design of size=%d - Optimization of %s criterion using geometric SA" % (size, c2.getName())) fig.savefig("lhs_sa_geom_%d.png" % size) plt.close(fig) crit = result.drawHistoryCriterion() proba = result.drawHistoryProbability() temp = result.drawHistoryTemperature() pp = PdfPages("small_OTLHS.pdf") # Criterion fig = View(crit, plot_kwargs={"color": "blue"}).getFigure() fig.savefig("crit_sa_geom.png") pp.savefig(fig) plt.close(fig)
nSimu = 100 algo = otlhs.MonteCarloLHS(lhs, nSimu, space_filling) initialDesign = algo.generate() result = algo.getResult() print('initial design pre-computed. Performing SA optimization...') # Use of initial design algo = otlhs.SimulatedAnnealingLHS(initialDesign, distribution, temperatureProfile, space_filling) # Retrieve optimal design input_database = algo.generate() result = algo.getResult() print('initial design computed') fig = PyPlotDesign(input_database, bounds, 1, 1) fig.set_size_inches(fig.get_size_inches() * 2) plt.suptitle('Ishigami design') plt.savefig('design_ishigami.png') plt.close(fig) # Response of the model print('sampling size = ', N) output_database = ishigami_model(input_database) # Learning input/output # Usual chaos meta model enumerate_function = ot.HyperbolicAnisotropicEnumerateFunction(dimension) orthogonal_basis = ot.OrthogonalProductPolynomialFactory(dimension*[ot.LegendreFactory()], enumerate_function) basis_size = 100 # Initial chaos algorithm adaptive_strategy = ot.FixedStrategy(orthogonal_basis, basis_size)