Changeset 228


Ignore:
Timestamp:
05/13/10 20:02:01 (6 years ago)
Author:
mmckerns
Message:

essentially killed off mpimystic branch, moved to "branches" directory
moved mpimystic/examples to mystic/examples

Files:
5 deleted
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/mpimystic/examples/Make.mm

    r224 r228  
    2424#EXPORT_PYTHON_MODULES = \ 
    2525EXPORT_BINS = \ 
    26     ezmap_desolve.py \ 
    27     ezmap_desolve_rosen.py \ 
    28     chebyshev8.py \ 
    29     chebyshev8b.py \ 
    30     rosen.py \ 
    3126 
    3227 
  • mystic/examples/Make.mm

    r133 r228  
    4040    example11.py \ 
    4141    example12.py \ 
     42    ezmap_desolve.py \ 
     43    ezmap_desolve_rosen.py \ 
    4244    forward_model.py \ 
    4345#   gplot_test_ffit.py \ 
    4446##  metropolis.py \ 
    4547    mpl_corana.py \ 
     48    raw_chebyshev8.py \ 
     49    raw_chebyshev8b.py \ 
     50    raw_rosen.py \ 
    4651    rosetta_parabola.py \ 
    4752    rosetta_mogi.py \ 
  • mystic/examples/ezmap_desolve.py

    r224 r228  
    11#!/usr/bin/env python 
     2#Adapted from parallel_desolve.py by mmckerns@caltech.edu 
    23 
    3 """ 
    4 Adapted from parallel_desolve.py by mmckerns@caltech.edu 
     4__doc__ = """ 
     5# Tests MPI version of Storn and Price's Polynomial 'Fitting' Problem. 
     6#  
     7# Exact answer: Chebyshev Polynomial of the first kind. T8(x) 
     8   
     9# Reference: 
     10# 
     11# [1] Storn, R. and Price, K. Differential Evolution - A Simple and Efficient 
     12# Heuristic for Global Optimization over Continuous Spaces. Journal of Global 
     13# Optimization 11: 341-359, 1997. 
    514 
    6 Tests MPI version of Storn and Price's Polynomial 'Fitting' Problem. 
    7  
    8 Exact answer: Chebyshev Polynomial of the first kind. T8(x) 
    9  
    10 Reference: 
    11  
    12 [1] Storn, R. and Price, K. Differential Evolution - A Simple and Efficient 
    13 Heuristic for Global Optimization over Continuous Spaces. Journal of Global 
    14 Optimization 11: 341-359, 1997. 
     15# To run in parallel:  (must install 'pyina') 
     16mpipython.exe ezmap_desolve.py 
    1517""" 
    1618 
    17 import pyina.launchers as launchers 
     19try: 
     20  import pyina.launchers as launchers 
     21  from pyina.launchers import mpirun_launcher 
     22  from pyina.mappers import equalportion_mapper 
     23  from pyina.ez_map import ez_map2 as ez_map 
     24except: 
     25  print __doc__ 
    1826 
    19 doc = __doc__ + """ 
    2027 
    21 %(launchers)s 
    22 """ % { 'file' : __file__, 'launchers' : launchers.getstr({'file':__file__, 'timelimit':'00:05'}) } 
    23  
    24 from mystic.differential_evolution import DifferentialEvolutionSolver2 as DESolve 
    25 from mpimystic.differential_evolution_ezmap import ezDESolver as pDESolve 
    26 from pyina.launchers import mpirun_launcher 
    27 from pyina.mappers import equalportion_mapper 
     28from mystic.differential_evolution import DifferentialEvolutionSolver2 
    2829from mystic.termination import ChangeOverGeneration, VTR 
    2930from mystic.strategy import Best1Exp 
     
    3132from mystic.models.poly import poly1d 
    3233 
    33 from chebyshev8 import chebyshev8cost as ChebyshevCost          # no globals 
    34 #from chebyshev8b import chebyshev8cost as ChebyshevCost        # use globals 
     34from raw_chebyshev8 import chebyshev8cost as ChebyshevCost      # no globals 
     35#from raw_chebyshev8b import chebyshev8cost as ChebyshevCost    # use globals 
    3536#from mystic.models.poly import chebyshev8cost as ChebyshevCost # no helper 
    3637 
     
    4445 
    4546if __name__=='__main__': 
    46     import pyina 
    47     pyina.ensure_mpi(doc) 
    48  
    4947    def print_solution(func): 
    5048        print poly1d(func) 
     
    5654    random_seed(seed) 
    5755    print "first sequential..." 
    58     solver = DESolve(ND,NP)  #XXX: sequential DESolver 
     56    solver = DifferentialEvolutionSolver2(ND,NP)  #XXX: sequential 
    5957    solver.SetRandomInitialPoints(min=[-100.0]*ND, max=[100.0]*ND) 
    6058    solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
     
    6866    random_seed(seed) 
    6967    print "\n and now parallel..." 
    70     solver = pDESolve(ND,NP)  #XXX: parallel DESolver 
    71     solver.SetMapper(equalportion_mapper) 
    72     solver.SetLauncher(mpirun_launcher, NNODES) 
    73     solver.SetRandomInitialPoints(min=[-100.0]*ND, max=[100.0]*ND) 
    74     solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
    75     solver.Solve(ChebyshevCost, VTR(0.01), strategy=Best1Exp, \ 
    76                  StepMonitor=psow, CrossProbability=1.0, ScalingFactor=0.9, \ 
    77                  disp=1) 
     68    solver2 = DifferentialEvolutionSolver2(ND,NP)  #XXX: parallel 
     69    solver2.SetMapper(ez_map, equalportion_mapper) 
     70    solver2.SetLauncher(mpirun_launcher, NNODES) 
     71    solver2.SetRandomInitialPoints(min=[-100.0]*ND, max=[100.0]*ND) 
     72    solver2.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
     73    solver2.Solve(ChebyshevCost, VTR(0.01), strategy=Best1Exp, \ 
     74                  StepMonitor=psow, CrossProbability=1.0, ScalingFactor=0.9, \ 
     75                  disp=1) 
    7876    print "" 
    79     print_solution( solver.Solution() ) 
     77    print_solution( solver2.Solution() ) 
    8078    #''' 
    8179 
  • mystic/examples/ezmap_desolve_rosen.py

    r224 r228  
    11#!/usr/bin/env python 
     2#Adapted from parallel_desolve.py by mmckerns@caltech.edu 
    23 
    3 """ 
    4 Adapted from parallel_desolve.py by mmckerns@caltech.edu 
     4__doc__ = """ 
     5# Tests MPI version of Storn and Price's Polynomial 'Fitting' Problem. 
     6#  
     7# Exact answer: [1,1,1] 
     8   
     9# Reference: 
     10# 
     11# [1] Storn, R. and Price, K. Differential Evolution - A Simple and Efficient 
     12# Heuristic for Global Optimization over Continuous Spaces. Journal of Global 
     13# Optimization 11: 341-359, 1997. 
    514 
    6 Tests MPI version of Storn and Price's Polynomial 'Fitting' Problem. 
    7  
    8 Exact answer: [1,1,1] 
    9  
    10 Reference: 
    11  
    12 [1] Storn, R. and Price, K. Differential Evolution - A Simple and Efficient 
    13 Heuristic for Global Optimization over Continuous Spaces. Journal of Global 
    14 Optimization 11: 341-359, 1997. 
     15# To run in parallel:  (must install 'pyina') 
     16mpipython.exe ezmap_desolve_rosen.py 
    1517""" 
    1618 
    17 import pyina.launchers as launchers 
     19try: 
     20  import pyina.launchers as launchers 
     21  from pyina.launchers import mpirun_launcher 
     22  from pyina.mappers import equalportion_mapper 
     23  from pyina.ez_map import ez_map2 as ez_map 
     24except: 
     25  print __doc__ 
    1826 
    19 doc = __doc__ + """ 
    2027 
    21 %(launchers)s 
    22 """ % { 'file' : __file__, 'launchers' : launchers.getstr({'file':__file__, 'timelimit':'00:05'}) } 
    23  
    24 from mystic.differential_evolution import DifferentialEvolutionSolver2 as DESolve 
    25 from mpimystic.differential_evolution_ezmap import ezDESolver as pDESolve 
    26 from pyina.launchers import mpirun_launcher 
    27 from pyina.mappers import equalportion_mapper 
     28from mystic.differential_evolution import DifferentialEvolutionSolver2 
    2829from mystic.termination import ChangeOverGeneration, VTR 
    2930from mystic.strategy import Best1Exp 
    3031from mystic.tools import VerboseSow, random_seed 
    3132 
    32 #from rosen import rosen as myCost         # ez_map needs a helper function 
     33#from raw_rosen import rosen as myCost     # ez_map needs a helper function 
    3334from mystic.models import rosen as myCost  # ez_map2 doesn't require help 
    3435 
     
    4546 
    4647if __name__=='__main__': 
    47     import pyina 
    48     pyina.ensure_mpi(doc) 
    49  
    5048    def print_solution(func): 
    5149        print func 
     
    5755    random_seed(seed) 
    5856    print "first sequential..." 
    59     solver = DESolve(ND,NP)  #XXX: sequential DESolver 
     57    solver = DifferentialEvolutionSolver2(ND,NP)  #XXX: sequential 
    6058    solver.SetRandomInitialPoints(min=[-100.0]*ND, max=[100.0]*ND) 
    6159    solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
     
    6866    random_seed(seed) 
    6967    print "\n and now parallel..." 
    70     solver = pDESolve(ND,NP)  #XXX: parallel DESolver 
    71     solver.SetMapper(equalportion_mapper) 
    72     solver.SetLauncher(mpirun_launcher, NNODES) 
    73     solver.SetRandomInitialPoints(min=[-100.0]*ND, max=[100.0]*ND) 
    74     solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
    75     solver.Solve(myCost, VTR(TOL), strategy=Best1Exp, \ 
     68    solver2 = DifferentialEvolutionSolver2(ND,NP)  #XXX: parallel 
     69    solver2.SetMapper(ez_map, equalportion_mapper) 
     70    solver2.SetLauncher(mpirun_launcher, NNODES) 
     71    solver2.SetRandomInitialPoints(min=[-100.0]*ND, max=[100.0]*ND) 
     72    solver2.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
     73    solver2.Solve(myCost, VTR(TOL), strategy=Best1Exp, \ 
    7674                StepMonitor=psow, CrossProbability=CROSS, ScalingFactor=SCALE, \ 
    7775                disp=1) 
    7876    print "" 
    79     print_solution( solver.Solution() ) 
     77    print_solution( solver2.Solution() ) 
    8078 
    8179# end of file 
Note: See TracChangeset for help on using the changeset viewer.