11"""
22 Code description:
3- for a 1-D example problem
4- randomly sample training points
5- define a Kriging-based Gaussian-process (smt backend)
6- trained on said data
7- define an LCB acquisition function (not smt backend)
8- plot the acquisition function and determine
9- the minimizer so as to test some of the infastructure
10- from BOAlgorithm
11-
3+ for a 2D example LpNormProblem
4+ 1) randomly sample training points
5+ 2) define a Kriging-based Gaussian-process (smt backend)
6+ trained on said data
7+ 3) determine the minimizer via BOAlgorithm
128"""
139
1410import numpy as np
1511import matplotlib .pyplot as plt
1612import warnings
1713warnings .filterwarnings ("ignore" )
18- from lp_problem import LpProblem
14+ from LpNormProblem import LpNormProblem
1915from hiopbbpy .surrogate_modeling import smtKRG
20- from hiopbbpy .opt import LCBacquisition
2116from hiopbbpy .opt import BOAlgorithm
2217
2318
2419### parameters
25- n_samples = 5 # number of the samples
20+ n_samples = 5 # number of the initial samples to train GP
2621theta = 1.e-2 # hyperparameter for GP kernel
2722
28- nx = 1 # dimension of the problem
29- xlimits = np .array ([[- 1. ,1. ]])
30- nx = 2
31- xlimits = np .array ([[- 5 , 5 ], [- 5 , 5 ]])
23+ nx = 2 # dimension of the problem
24+ xlimits = np .array ([[- 5 , 5 ], [- 5 , 5 ]]) # bounds on optimization variable
3225
33- problem = LpProblem (nx , xlimits )
26+ problem = LpNormProblem (nx , xlimits )
3427print (problem .name , " problem" )
3528
3629### initial training set
4740
4841# Retrieve optimal point
4942x_opt , y_opt = bo .getOptimalPoint ()
50- print (f"Optimal x: { x_opt } , Optimal y: { y_opt } " )
0 commit comments