99 "run_local_tao" ,
1010 "run_local_dfols" ,
1111 "run_local_ibcdfo_pounders" ,
12+ "run_local_ibcdfo_manifold_sampling" ,
1213 "run_local_scipy_opt" ,
1314 "run_external_localopt" ,
1415]
@@ -26,7 +27,7 @@ class APOSMMException(Exception):
2627 """Raised for any exception in APOSMM"""
2728
2829
29- optimizer_list = ["petsc" , "nlopt" , "dfols" , "scipy" , "ibcdfo " , "external" ]
30+ optimizer_list = ["petsc" , "nlopt" , "dfols" , "scipy" , "ibcdfo_pounders" , "ibcdfo_manifold_sampling " , "external" ]
3031optimizers = libensemble .gen_funcs .rc .aposmm_optimizers
3132
3233if optimizers is not None :
@@ -42,8 +43,10 @@ class APOSMMException(Exception):
4243 import nlopt # noqa: F401
4344 if "dfols" in optimizers :
4445 import dfols # noqa: F401
45- if "ibcdfo" in optimizers :
46- from ibcdfo import pounders # noqa: F401
46+ if "ibcdfo_pounders" in optimizers :
47+ from ibcdfo .pounders import pounders # noqa: F401
48+ if "ibcdfo_manifold_sampling" in optimizers :
49+ from ibcdfo .manifold_sampling import manifold_sampling_primal # noqa: F401
4750 if "scipy" in optimizers :
4851 from scipy import optimize as sp_opt # noqa: F401
4952 if "external_localopt" in optimizers :
@@ -79,6 +82,7 @@ class LocalOptInterfacer(object):
7982 - PETSc/TAO [``'pounders'``, ``'blmvm'``, ``'nm'``]
8083 - SciPy [``'scipy_Nelder-Mead'``, ``'scipy_COBYLA'``, ``'scipy_BFGS'``]
8184 - DFOLS [``'dfols'``]
85+ - IBCDFO [``'pounders'``, ``'manifold_sampling_primal'``]
8286 - External local optimizer [``'external_localopt'``] (which use files to pass/receive ``x/f`` values)
8387 """
8488
@@ -123,6 +127,8 @@ def __init__(self, user_specs, x0, f0, grad0=None):
123127 run_local_opt = run_local_dfols
124128 elif user_specs ["localopt_method" ] in ["ibcdfo_pounders" ]:
125129 run_local_opt = run_local_ibcdfo_pounders
130+ elif user_specs ["localopt_method" ] in ["ibcdfo_manifold_sampling" ]:
131+ run_local_opt = run_local_ibcdfo_manifold_sampling
126132 elif user_specs ["localopt_method" ] in ["external_localopt" ]:
127133 run_local_opt = run_external_localopt
128134 else :
@@ -417,6 +423,60 @@ def run_local_dfols(user_specs, comm_queue, x0, f0, child_can_read, parent_can_r
417423 finish_queue (x_opt , opt_flag , comm_queue , parent_can_read , user_specs )
418424
419425
426+ def run_local_ibcdfo_manifold_sampling (user_specs , comm_queue , x0 , f0 , child_can_read , parent_can_read ):
427+ """
428+ Runs a IBCDFO local optimization run starting at ``x0``, governed by the
429+ parameters in ``user_specs``.
430+
431+ Although IBCDFO methods can receive previous evaluations, few other methods
432+ support that, so APOSMM assumes the first point will be re-evaluated (but
433+ not be sent back to the manager).
434+ """
435+ n = len (x0 )
436+ # Define bound constraints (lower <= x <= upper)
437+ lb = np .zeros (n )
438+ ub = np .ones (n )
439+
440+ # Set random seed (for reproducibility)
441+ np .random .seed (0 )
442+
443+ # dist_to_bound = min(min(ub - x0), min(x0 - lb))
444+ # assert dist_to_bound > np.finfo(np.float64).eps, "The distance to the boundary is too small"
445+
446+ run_max_eval = user_specs .get ("run_max_eval" , 100 * (n + 1 ))
447+ # g_tol = 1e-8
448+ # delta_0 = 0.5 * dist_to_bound
449+ # m = len(f0)
450+ subprob_switch = "linprog"
451+
452+ [X , F , hF , xkin , flag ] = manifold_sampling_primal (
453+ user_specs ["hfun" ],
454+ lambda x : scipy_dfols_callback_fun (x , comm_queue , child_can_read , parent_can_read , user_specs ),
455+ x0 ,
456+ lb ,
457+ ub ,
458+ run_max_eval ,
459+ subprob_switch ,
460+ )
461+
462+ assert flag >= 0 or flag == - 6 , "IBCDFO errored"
463+
464+ x_opt = X [xkin ]
465+
466+ if flag > 0 :
467+ opt_flag = 1
468+ else :
469+ print (
470+ "[APOSMM] The IBCDFO run started from " + str (x0 ) + " stopped with an exit "
471+ "flag of " + str (flag ) + ". No point from this run will be "
472+ "ruled as a minimum! APOSMM may start a new run from some point "
473+ "in this run."
474+ )
475+ opt_flag = 0
476+
477+ finish_queue (x_opt , opt_flag , comm_queue , parent_can_read , user_specs )
478+
479+
420480def run_local_ibcdfo_pounders (user_specs , comm_queue , x0 , f0 , child_can_read , parent_can_read ):
421481 """
422482 Runs a IBCDFO local optimization run starting at ``x0``, governed by the
@@ -447,7 +507,7 @@ def run_local_ibcdfo_pounders(user_specs, comm_queue, x0, f0, child_can_read, pa
447507 else :
448508 Options = None
449509
450- [X , F , hF , flag , xkin ] = pounders . pounders (
510+ [X , F , hF , flag , xkin ] = pounders (
451511 lambda x : scipy_dfols_callback_fun (x , comm_queue , child_can_read , parent_can_read , user_specs ),
452512 x0 ,
453513 n ,
0 commit comments