diff --git a/idaes/core/surrogate/alamopy.py b/idaes/core/surrogate/alamopy.py index ebed33d786..78106a8109 100644 --- a/idaes/core/surrogate/alamopy.py +++ b/idaes/core/surrogate/alamopy.py @@ -86,8 +86,8 @@ class Screener(Enum): "sinfcns", "cosfcns", "constant", - "grbfcns", - "rbfparam", + # "grbfcns", # TODO: deprecated + # "rbfparam", # TODO: deprecated "modeler", "builder", "backstepper", @@ -282,7 +282,7 @@ class AlamoTrainer(SurrogateTrainer): description="Include cosine basis functions if True.", ), ) - CONFIG.declare( + CONFIG.declare( # TODO: deprecated option "grbfcns", ConfigValue( default=None, @@ -290,7 +290,7 @@ class AlamoTrainer(SurrogateTrainer): description="Include Gaussian radial basis functions if True.", ), ) - CONFIG.declare( + CONFIG.declare( # TODO: deprecated option "rbfparam", ConfigValue( default=None, @@ -669,6 +669,15 @@ class AlamoTrainer(SurrogateTrainer): def __init__(self, **settings): super().__init__(**settings) + # TODO: Deprecation warnings for RBF options + if self.config.grbfcns is not None or self.config.rbfparam is not None: + raise ConfigurationError( + "Support for radial basis functions in the ALAMOpy wrapper have been " + "deprecated due to limitations in the current implementation. " + "Pull requests are welcome to address this, otherwise we recommend using " + "Pysmo which includes support for radial basis functions." + ) + self._temp_context = None self._almfile = None self._trcfile = None diff --git a/idaes/core/surrogate/tests/test_alamopy.py b/idaes/core/surrogate/tests/test_alamopy.py index 92c1246938..6cc6d3ebd2 100644 --- a/idaes/core/surrogate/tests/test_alamopy.py +++ b/idaes/core/surrogate/tests/test_alamopy.py @@ -71,6 +71,45 @@ def alamo_trainer(self): training_dataframe=data, ) + @pytest.mark.unit + def test_rbf_deprecation(self): + data = {"x1": [1, 2, 3, 4], "x2": [5, 6, 7, 8], "z1": [10, 20, 30, 40]} + data = pd.DataFrame(data) + + input_labels = ["x1", "x2"] + output_labels = ["z1"] + bnds = {"x1": (0, 5), "x2": (0, 10)} + + with pytest.raises( + ConfigurationError, + match="Support for radial basis functions in the ALAMOpy wrapper have been " + "deprecated due to limitations in the current implementation. " + "Pull requests are welcome to address this, otherwise we recommend using " + "Pysmo which includes support for radial basis functions.", + ): + AlamoTrainer( + input_labels=input_labels, + output_labels=output_labels, + input_bounds=bnds, + training_dataframe=data, + grbfcns=True, + ) + + with pytest.raises( + ConfigurationError, + match="Support for radial basis functions in the ALAMOpy wrapper have been " + "deprecated due to limitations in the current implementation. " + "Pull requests are welcome to address this, otherwise we recommend using " + "Pysmo which includes support for radial basis functions.", + ): + AlamoTrainer( + input_labels=input_labels, + output_labels=output_labels, + input_bounds=bnds, + training_dataframe=data, + rbfparam=1.0, + ) + @pytest.mark.unit def test_get_files(self, alamo_trainer): alamo_trainer.config.filename = "foo.alm" @@ -486,8 +525,6 @@ def test_writer_full_config(self, alamo_trainer): "sinfcns 1\n" "cosfcns 0\n" "constant 1\n" - "grbfcns 1\n" - "rbfparam 7.0\n" "modeler 3\n" "builder 1\n" "backstepper 0\n"