diff --git a/smt/applications/mfk.py b/smt/applications/mfk.py index bc01a4eac..9ae03a54c 100644 --- a/smt/applications/mfk.py +++ b/smt/applications/mfk.py @@ -9,7 +9,7 @@ """ from copy import deepcopy - +import warnings import numpy as np from scipy.linalg import solve_triangular from scipy import linalg @@ -983,7 +983,11 @@ def _check_param(self): raise ValueError( "MFKPLSK only works with a squared exponential kernel (until we prove the contrary)" ) - + if self.options["eval_noise"] or np.max(self.options["noise0"]) > 1e-12: + self.options["hyper_opt"] = "Cobyla" + warnings.warn( + "TNC not available yet for noise handling. Switching to Cobyla" + ) n_param = d if self.options["categorical_kernel"] is not None: diff --git a/smt/applications/mixed_integer.py b/smt/applications/mixed_integer.py index 29fdeb831..ab8a466f1 100644 --- a/smt/applications/mixed_integer.py +++ b/smt/applications/mixed_integer.py @@ -204,6 +204,11 @@ def __init__( + " is not supported. Please use MixedIntegerSurrogateModel instead." ) self.options["design_space"] = self._surrogate.design_space + if surrogate.options["hyper_opt"] == "TNC": + warnings.warn( + "TNC not available yet for mixed integer handling. Switching to Cobyla" + ) + self._surrogate.options["hyper_opt"] = "Cobyla" self._input_in_folded_space = input_in_folded_space @@ -340,6 +345,12 @@ def build_kriging_model(self, surrogate): Build MixedIntegerKrigingModel from given SMT surrogate model. """ surrogate.options["design_space"] = self._design_space + + if surrogate.options["hyper_opt"] == "TNC": + warnings.warn( + "TNC not available yet for mixed integer handling. Switching to Cobyla" + ) + surrogate.options["hyper_opt"] = "Cobyla" return MixedIntegerKrigingModel( surrogate=surrogate, diff --git a/smt/surrogate_models/krg_based.py b/smt/surrogate_models/krg_based.py index d3e481986..1c63a8229 100644 --- a/smt/surrogate_models/krg_based.py +++ b/smt/surrogate_models/krg_based.py @@ -2102,6 +2102,11 @@ def _check_param(self): "the length of theta0 (%s) should be equal to the number of dim (%s)." % (len(self.options["theta0"]), d) ) + if self.options["eval_noise"] or np.max(self.options["noise0"]) > 1e-12: + self.options["hyper_opt"] = "Cobyla" + warnings.warn( + "TNC not available yet for noise handling. Switching to Cobyla" + ) if self.options["use_het_noise"] and not self.options["eval_noise"]: if len(self.options["noise0"]) != self.nt: