@@ -225,6 +225,117 @@ def objective(params):
225225# [end:optuna_tpe]
226226
227227
228+ # ============================================================================
229+ # Scipy Backend
230+ # ============================================================================
231+
232+ # [start:scipy_imports]
233+ from hyperactive .opt .scipy import (
234+ ScipyDifferentialEvolution , # Global: population-based
235+ ScipyDualAnnealing , # Global: simulated annealing variant
236+ ScipyBasinhopping , # Global: random perturbations + local search
237+ ScipySHGO , # Global: finds multiple local minima
238+ ScipyDirect , # Global: deterministic DIRECT algorithm
239+ ScipyNelderMead , # Local: simplex-based
240+ ScipyPowell , # Local: conjugate direction method
241+ )
242+ # [end:scipy_imports]
243+
244+
245+ # Scipy uses continuous search spaces (tuples instead of arrays)
246+ scipy_search_space = {
247+ "x" : (- 5.0 , 5.0 ),
248+ "y" : (- 5.0 , 5.0 ),
249+ }
250+
251+
252+ # [start:scipy_differential_evolution]
253+ from hyperactive .opt .scipy import ScipyDifferentialEvolution
254+
255+ optimizer = ScipyDifferentialEvolution (
256+ param_space = scipy_search_space ,
257+ n_iter = 100 ,
258+ experiment = objective ,
259+ strategy = "best1bin" ,
260+ random_state = 42 ,
261+ )
262+ # [end:scipy_differential_evolution]
263+
264+
265+ # [start:scipy_dual_annealing]
266+ from hyperactive .opt .scipy import ScipyDualAnnealing
267+
268+ optimizer = ScipyDualAnnealing (
269+ param_space = scipy_search_space ,
270+ n_iter = 100 ,
271+ experiment = objective ,
272+ random_state = 42 ,
273+ )
274+ # [end:scipy_dual_annealing]
275+
276+
277+ # [start:scipy_basinhopping]
278+ from hyperactive .opt .scipy import ScipyBasinhopping
279+
280+ optimizer = ScipyBasinhopping (
281+ param_space = scipy_search_space ,
282+ n_iter = 50 ,
283+ experiment = objective ,
284+ minimizer_method = "Nelder-Mead" ,
285+ random_state = 42 ,
286+ )
287+ # [end:scipy_basinhopping]
288+
289+
290+ # [start:scipy_shgo]
291+ from hyperactive .opt .scipy import ScipySHGO
292+
293+ optimizer = ScipySHGO (
294+ param_space = scipy_search_space ,
295+ n_iter = 3 ,
296+ experiment = objective ,
297+ n = 50 ,
298+ sampling_method = "simplicial" ,
299+ )
300+ # [end:scipy_shgo]
301+
302+
303+ # [start:scipy_direct]
304+ from hyperactive .opt .scipy import ScipyDirect
305+
306+ optimizer = ScipyDirect (
307+ param_space = scipy_search_space ,
308+ n_iter = 200 ,
309+ experiment = objective ,
310+ locally_biased = True ,
311+ )
312+ # [end:scipy_direct]
313+
314+
315+ # [start:scipy_nelder_mead]
316+ from hyperactive .opt .scipy import ScipyNelderMead
317+
318+ optimizer = ScipyNelderMead (
319+ param_space = scipy_search_space ,
320+ n_iter = 200 ,
321+ experiment = objective ,
322+ random_state = 42 ,
323+ )
324+ # [end:scipy_nelder_mead]
325+
326+
327+ # [start:scipy_powell]
328+ from hyperactive .opt .scipy import ScipyPowell
329+
330+ optimizer = ScipyPowell (
331+ param_space = scipy_search_space ,
332+ n_iter = 200 ,
333+ experiment = objective ,
334+ random_state = 42 ,
335+ )
336+ # [end:scipy_powell]
337+
338+
228339# ============================================================================
229340# Configuration Examples
230341# ============================================================================
0 commit comments