Skip to content

Commit

Permalink
Merge 6d03908 into d978ccd
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Saves committed Feb 15, 2024
2 parents d978ccd + 6d03908 commit ad738ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 6 additions & 2 deletions smt/applications/mfk.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

from copy import deepcopy

import warnings
import numpy as np
from scipy.linalg import solve_triangular
from scipy import linalg
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions smt/applications/mixed_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions smt/surrogate_models/krg_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ad738ec

Please sign in to comment.