Changeset 103


Ignore:
Timestamp:
02/20/09 16:40:19 (7 years ago)
Author:
mmckerns
Message:

added solver for scipy's fmin_powell (added scipy dependency too = BAD);
corrected output from disp,retall,full_output options to be identical to scipy's

Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • DEV_NOTES

    r99 r103  
    11= THINGS TO RESOLVE = 
    22mystic/examples*/*py: 
    3  - convert scipy.optimize.fmin to mystic.scipy_optimize.fmin 
     3 - convert from scipy.optimize.fmin to mystic.scipy_optimize.fmin 
     4 - convert from scipy.optimize.fmin_powell to mystic.scipy_optimize.fmin_powell 
    45*/*/*py: 
    56 - move "circle" to mystic.models, and move more of "mogi" to mystic.models 
     7mystic/mystic/fmin_powell.py: 
     8 - derive an AbstractSolver class for all solvers to inherit from 
     9 - add scipy solver "Brent", to _remove_ the scipy dependency (*) 
     10 - migrate all contents into scipy_optimize.py 
     11 - clean up & edit inline documentation 
     12 - better way to deal with callback, direc, maxfun, maxiter (?) 
     13mystic/mystic/scipy_optimize.py: 
     14 - add the "__all__" scipy trick 
     15mystic/mystic/differential_evolution.py: 
     16 - add ability to choose initial point 
     17 - use wrap_bounds instead of existing method (?) 
    618 
    719 
  • mystic/examples/Make.mm

    r97 r103  
    4242    test_rosenbrock.py \ 
    4343    test_rosenbrock2.py \ 
     44    test_rosenbrock3.py \ 
    4445#   sam_rosenbrock.py \ 
    4546    cg_rosenbrock.py \ 
  • mystic/examples/test_rosenbrock2.py

    r102 r103  
    2424    print "===================" 
    2525    start = time.time() 
    26     from mystic.tools import VerboseSow 
    27     stepmon = VerboseSow(10) 
     26    from mystic.tools import Sow #VerboseSow 
     27    stepmon = Sow() #VerboseSow(10) 
    2828    from mystic.termination import CandidateRelativeTolerance as CRT 
    2929 
     30   #from scipy.optimize import fmin 
    3031    from mystic.scipy_optimize import fmin, NelderMeadSimplexSolver 
    3132   #print fmin(rosen,x0,retall=0,full_output=0) 
     
    3435    solver.SetStrictRanges(min,max) 
    3536    solver.enable_signal_handler() 
    36     solver.Solve(rosen,termination=CRT(xtol=1e-5),StepMonitor=stepmon) 
     37    solver.Solve(rosen,termination=CRT(xtol=4e-5),StepMonitor=stepmon,disp=1) 
    3738    print solver.Solution() 
    3839 
  • mystic/mystic/Make.mm

    r98 r103  
    2929    differential_evolution.py \ 
    3030    scipy_optimize.py \ 
     31    fmin_powell.py \ 
    3132    termination.py \ 
    3233    strategy.py \ 
  • mystic/mystic/__init__.py

    r98 r103  
    1616# solvers 
    1717import differential_evolution, scipy_optimize 
     18import fmin_powell #FIXME: move to scipy_optimize after remove scipy dependency 
    1819 
    1920# strategies, termination conditions 
  • mystic/mystic/scipy_optimize.py

    r102 r103  
    244244        if maxfun is None: 
    245245            maxfun = N * 200 
     246        self._maxiter = maxiter #XXX: better to just copy the code? 
     247        self._maxfun = maxfun   #XXX: better to just copy the code? 
    246248 
    247249        rho = 1; chi = 2; psi = 0.5; sigma = 0.5; 
     
    402404 
    403405    # code below here pushes output to scipy.optimize.fmin interface 
    404     x = list(solver.bestSolution) 
     406   #x = list(solver.bestSolution) 
     407    x = solver.bestSolution 
    405408    fval = solver.bestEnergy 
    406409    warnflag = 0 
     
    409412    allvecs = [] 
    410413    for i in range(iterations): 
    411         allvecs.append(list(stepmon.x[i][0])) 
    412  
    413     if fcalls >= maxfun: 
     414       #allvecs.append(list(stepmon.x[i][0])) 
     415        allvecs.append(stepmon.x[i][0]) 
     416 
     417    if fcalls >= solver._maxfun: 
    414418        warnflag = 1 
    415     elif iterations >= maxiter: 
     419    elif iterations >= solver._maxiter: 
    416420        warnflag = 2 
    417421 
Note: See TracChangeset for help on using the changeset viewer.