from example_optimization import florisEval print( florisEval( **{ 'asv': 1, 'functions': 1, 'cv': [ -2.4120827810e-01, 4.2535457527e-01, -1.1014888289e-01, -2.2816890223e-01, 2.6956808674e-01, 3.0644245310e-01, 8.2766227014e-02, 1.0617743884e+00, 11.982801151e+00, 8.7694255619e+00 ] }))
#for i, bit in enumerate(results["obj_fn"].asv): # if bit: # active_set_vector += 1 << i # set a dictionary for passing to rosenbrock via Python kwargs rosen_params = {} rosen_params['cv'] = continuous_vars rosen_params['asv'] = [active_set_vector] rosen_params['functions'] = 1 # execute the rosenbrock analysis as a separate Python module #from rosenbrock import rosenbrock_list from example_optimization import florisEval if np.isinf(params['direction']): rosen_results = {'fns': [0, 0, 0]} else: rosen_results = florisEval(**rosen_params) # ---------------------------- # Return the results to Dakota # ---------------------------- # Insert functions from rosen into results # Results iterator provides an index, response name, and response for i, n, r in results: if r.asv.function: r.function = rosen_results['fns'][i] if r.asv.gradient: r.gradient = rosen_results['fnGrads'][i] if r.asv.hessian: r.hessian = rosen_results['fnHessians'][i]
import sys from example_optimization import florisEval import numpy as np yaw = np.genfromtxt('./%s.dat' % sys.argv[-1]) f = str((florisEval(**{ 'functions': -33, 'asv': 1e3, 'cv': np.array(yaw) }))['fns'][0]) outf = open('%s.det' % sys.argv[-1], 'w') outf.write(f) outf.close()