@@ -58,9 +58,12 @@ class AbstractFacade:
5858 ----------
5959 scenario : Scenario
6060 The scenario object, holding all environmental information.
61- target_function : Callable | str | AbstractRunner
61+ target_function : Callable | str | AbstractRunner | None, defaults to None
6262 This function is called internally to judge a trial's performance. If a string is passed,
6363 it is assumed to be a script. In this case, ``TargetFunctionScriptRunner`` is used to run the script.
64+ In the rare case that only ``ask`` and ``tell`` and not ``optimize`` is used to optimize
65+ the hyperparameters, the target_function argument can be None, because SMAC no longer is
66+ charge of the evaluation of the configuration and thus does not need to know about it.
6467 model : AbstractModel | None, defaults to None
6568 The surrogate model.
6669 acquisition_function : AbstractAcquisitionFunction | None, defaults to None
@@ -105,8 +108,8 @@ class AbstractFacade:
105108 def __init__ (
106109 self ,
107110 scenario : Scenario ,
108- target_function : Callable | str | AbstractRunner ,
109111 * ,
112+ target_function : Callable | str | AbstractRunner | None = None ,
110113 model : AbstractModel | None = None ,
111114 acquisition_function : AbstractAcquisitionFunction | None = None ,
112115 acquisition_maximizer : AbstractAcquisitionMaximizer | None = None ,
@@ -175,8 +178,10 @@ def __init__(
175178 self ._overwrite = overwrite
176179
177180 # Prepare the algorithm executer
178- runner : AbstractRunner
179- if isinstance (target_function , AbstractRunner ):
181+ runner : AbstractRunner | None
182+ if isinstance (target_function , AbstractRunner ) or target_function is None :
183+ # in case the target_function is None (e.g. we purely use ask & tell)
184+ # we let smbo.optimize raise an error
180185 runner = target_function
181186 elif isinstance (target_function , str ):
182187 runner = TargetFunctionScriptRunner (
@@ -192,7 +197,7 @@ def __init__(
192197 )
193198
194199 # In case of multiple jobs, we need to wrap the runner again using DaskParallelRunner
195- if (n_workers := scenario .n_workers ) > 1 or dask_client is not None :
200+ if (( n_workers := scenario .n_workers ) > 1 or dask_client is not None ) and runner is not None :
196201 if dask_client is not None and n_workers > 1 :
197202 logger .warning (
198203 "Provided `dask_client`. Ignore `scenario.n_workers`, directly set `n_workers` in `dask_client`."
@@ -261,7 +266,7 @@ def meta(self) -> dict[str, Any]:
261266
262267 meta = {
263268 "facade" : {"name" : self .__class__ .__name__ },
264- "runner" : self ._runner .meta ,
269+ "runner" : self ._runner .meta if self . _runner is not None else None ,
265270 "model" : self ._model .meta ,
266271 "acquisition_maximizer" : self ._acquisition_maximizer .meta ,
267272 "acquisition_function" : self ._acquisition_function .meta ,
0 commit comments