- Timestamp:
- 06/04/13 19:54:18 (3 years ago)
- Location:
- branches/UQ/math/examples
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UQ/math/examples/MPI2_surrogate_diam_batchgrid.py
r676 r677 119 119 120 120 #construct cost function and run optimizer 121 #subdiameter, func_evals = optimize(cost.name,lb,ub) #XXX: no init_condition122 121 results = Pool(nnodes).map(optimize, cn,lb,ub,nb) 123 122 #print "results = %s" % results -
branches/UQ/math/examples/MPI_surrogate_diam_batchgrid.py
r676 r677 1 1 #!/usr/bin/env python 2 2 3 def func_pickle(func, suffix='.pik', dir='.'):4 """ standard pickle.dump of function to a NamedTemporaryFile """5 from dill.temp import dump6 return dump(func, suffix=suffix, dir=dir)7 8 3 from mystic.math.grid import gridpts 9 10 4 11 5 ####################################################################### … … 78 72 maxfun = 1e+6 79 73 convergence_tol = 1e-4 80 81 def func_unpickle(filename):82 """ standard pickle.load of function from a File """83 import dill as pickle84 return pickle.load(open(filename,'r'))85 74 86 75 #stepmon = VerboseMonitor(100) … … 98 87 99 88 tol = convergence_tol 100 cost = func_unpickle(cost) #XXX: regenerate cost function from file101 89 solver.Solve(cost, termination=NCOG(tol)) 102 90 … … 164 152 #construct cost function and run optimizer 165 153 cost = costFactory(i) 166 cost = func_pickle(cost) #XXX: allows an import to __globals__ 167 subdiameter, func_evals = optimize(cost.name,lb,ub) #XXX: no init_condition 154 subdiameter, func_evals = optimize(cost,lb,ub) #XXX: no init_condition 168 155 169 156 function_evaluations.append(func_evals) -
branches/UQ/math/examples/MPI_surrogate_diam_scatter.py
r676 r677 1 1 #!/usr/bin/env python 2 2 3 def func_pickle(func, suffix='.pik', dir='.'):4 """ standard pickle.dump of function to a NamedTemporaryFile """5 from dill.temp import dump6 return dump(func, suffix=suffix, dir=dir)7 8 3 from mystic.math.grid import samplepts 9 10 4 11 5 ####################################################################### … … 78 72 maxfun = 1e+6 79 73 convergence_tol = 1e-4 80 81 def func_unpickle(filename):82 """ standard pickle.load of function from a File """83 import dill as pickle84 return pickle.load(open(filename,'r'))85 74 86 75 #stepmon = VerboseMonitor(100) … … 98 87 99 88 tol = convergence_tol 100 cost = func_unpickle(cost) #XXX: regenerate cost function from file101 89 solver.Solve(cost, termination=NCOG(tol)) 102 90 … … 156 144 #construct cost function and run optimizer 157 145 cost = costFactory(i) 158 cost = func_pickle(cost) #XXX: allows an import to __globals__ 159 subdiameter, func_evals = optimize(cost.name,lb,ub) #XXX: no init_condition 146 subdiameter, func_evals = optimize(cost,lb,ub) #XXX: no init_condition 160 147 161 148 function_evaluations.append(func_evals) -
branches/UQ/math/examples/MSUB_surrogate_diam_batchgrid.py
r676 r677 1 1 #!/usr/bin/env python 2 2 3 def func_pickle(func, suffix='.pik', dir='.'):4 """ standard pickle.dump of function to a NamedTemporaryFile """5 from dill.temp import dump6 return dump(func, suffix=suffix, dir=dir)7 8 3 from mystic.math.grid import gridpts 9 10 4 11 5 ####################################################################### … … 78 72 from mystic.termination import NormalizedChangeOverGeneration as NCOG 79 73 from mystic.monitors import VerboseMonitor, Monitor 80 from mystic.tools import getch81 74 82 75 maxiter = 1000 83 76 maxfun = 1e+6 84 77 convergence_tol = 1e-4 85 86 def func_unpickle(filename):87 """ standard pickle.load of function from a File """88 import dill as pickle89 return pickle.load(open(filename,'r'))90 78 91 79 #stepmon = VerboseMonitor(100) … … 103 91 104 92 tol = convergence_tol 105 cost = func_unpickle(cost) #XXX: regenerate cost function from file106 93 solver.Solve(cost, termination=NCOG(tol)) 107 94 … … 170 157 #construct cost function and run optimizer 171 158 cost = costFactory(i) 172 cost = func_pickle(cost) #XXX: allows an import to __globals__ 173 subdiameter, func_evals = optimize(cost.name,lb,ub) #XXX: no init_condition 159 subdiameter, func_evals = optimize(cost,lb,ub) #XXX: no init_condition 174 160 175 161 function_evaluations.append(func_evals) -
branches/UQ/math/examples/QSUB2_surrogate_diam_batchgrid.py
r676 r677 119 119 120 120 #construct cost function and run optimizer 121 #subdiameter, func_evals = optimize(cost.name,lb,ub) #XXX: no init_condition122 121 results = Pool(nnodes).map(optimize, cn,lb,ub,nb) 123 122 #print "results = %s" % results -
branches/UQ/math/examples/QSUB_surrogate_diam_batchgrid.py
r676 r677 1 1 #!/usr/bin/env python 2 2 3 def func_pickle(func, suffix='.pik', dir='.'):4 """ standard pickle.dump of function to a NamedTemporaryFile """5 from dill.temp import dump6 return dump(func, suffix=suffix, dir=dir)7 8 3 from mystic.math.grid import gridpts 9 10 4 11 5 ####################################################################### … … 82 76 maxfun = 1e+6 83 77 convergence_tol = 1e-4 84 85 def func_unpickle(filename):86 """ standard pickle.load of function from a File """87 import dill as pickle88 return pickle.load(open(filename,'r'))89 78 90 79 #stepmon = VerboseMonitor(100) … … 102 91 103 92 tol = convergence_tol 104 cost = func_unpickle(cost) #XXX: regenerate cost function from file105 93 solver.Solve(cost, termination=NCOG(tol)) 106 94 … … 169 157 #construct cost function and run optimizer 170 158 cost = costFactory(i) 171 cost = func_pickle(cost) #XXX: allows an import to __globals__ 172 subdiameter, func_evals = optimize(cost.name,lb,ub) #XXX: no init_condition 159 subdiameter, func_evals = optimize(cost,lb,ub) #XXX: no init_condition 173 160 174 161 function_evaluations.append(func_evals)
Note: See TracChangeset
for help on using the changeset viewer.