Skip to content

Commit

Permalink
Undoing the effects of answering Steve's question. Imports must be at…
Browse files Browse the repository at this point in the history
… the top
  • Loading branch information
jmlarson1 committed Nov 2, 2018
1 parent 820299b commit ffa6ad8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions libensemble/gen_funcs/aposmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

from math import log, gamma, pi, sqrt

from petsc4py import PETSc
import nlopt

def aposmm_logic(H,persis_info,gen_specs,_):
"""
APOSMM coordinates multiple local optimization runs, starting from points
Expand Down Expand Up @@ -153,11 +156,6 @@ def aposmm_logic(H,persis_info,gen_specs,_):
"""

if gen_specs['localopt_method'] in ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NELDERMEAD', 'LD_MMA']:
import nlopt
elif gen_specs['localopt_method'] in ['pounders']:
from petsc4py import PETSc

n, n_s, c_flag, O, r_k, mu, nu = initialize_APOSMM(H, gen_specs)

# np.savez('H'+str(len(H)),H=H,gen_specs=gen_specs,persis_info=persis_info)
Expand Down Expand Up @@ -532,7 +530,6 @@ def set_up_and_run_nlopt(Run_H, gen_specs):
Declares the appropriate syntax for our special objective function to read
through Run_H, sets the parameters and starting points for the run.
"""
import nlopt

assert 'xtol_rel' or 'xtol_abs' or 'ftol_rel' or 'ftol_abs' in gen_specs, "NLopt can cycle if xtol_rel, xtol_abs, ftol_rel, or ftol_abs are not set"

Expand Down Expand Up @@ -590,8 +587,6 @@ def set_up_and_run_tao(Run_H, gen_specs):
Declares the appropriate syntax for our special objective function to read
through Run_H, sets the parameters and starting points for the run.
"""
from petsc4py import PETSc

tao_comm = MPI.COMM_SELF
n = len(gen_specs['ub'])
m = len(Run_H['fvec'][0])
Expand Down

0 comments on commit ffa6ad8

Please sign in to comment.