Changeset 762 for mystic


Ignore:
Timestamp:
10/06/14 14:39:52 (20 months ago)
Author:
mmckerns
Message:

enable disp and callback in ensemble solvers, better disp behavior for oneliners

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mystic/mystic/ensemble.py

    r761 r762  
    8585        # process and activate input settings 
    8686        settings = self._process_inputs(kwds) 
    87         disp=0 
     87        disp = settings.get('disp', False) 
     88        echo = settings.get('callback', None) #XXX: every iteration every run 
    8889#       for key in settings: 
    8990#           exec "%s = settings['%s']" % (key,key) 
     
    141142 
    142143        # generate the local_optimize function 
    143         def local_optimize(solver, x0, rank=None, disp=verbose): 
     144        def local_optimize(solver, x0, rank=None, disp=verbose, callback=echo): 
    144145            solver.id = rank 
    145146            solver.SetInitialPoints(x0) 
     
    147148                solver.SetStrictRanges(min=solver._strictMin, \ 
    148149                                       max=solver._strictMax) # or lower,upper ? 
    149             solver.Solve(cost, disp=disp) 
     150            solver.Solve(cost, disp=disp, callback=callback) 
    150151            return solver 
    151152 
     
    249250        # process and activate input settings 
    250251        settings = self._process_inputs(kwds) 
    251         disp=0 
     252        disp = settings.get('disp', False) 
     253        echo = settings.get('callback', None) #XXX: every iteration every run 
    252254#       for key in settings: 
    253255#           exec "%s = settings['%s']" % (key,key) 
     
    298300 
    299301        # generate the local_optimize function 
    300         def local_optimize(solver, x0, rank=None, disp=verbose): 
     302        def local_optimize(solver, x0, rank=None, disp=verbose, callback=echo): 
    301303            solver.id = rank 
    302304            solver.SetInitialPoints(x0) 
     
    304306                solver.SetStrictRanges(min=solver._strictMin, \ 
    305307                                       max=solver._strictMax) # or lower,upper ? 
    306             solver.Solve(cost, disp=disp) 
     308            solver.Solve(cost, disp=disp, callback=callback) 
    307309            return solver 
    308310 
     
    467469 
    468470    # code below here pushes output to scipy.optimize.fmin interface 
    469     msg = solver.CheckTermination(disp=disp, info=True) 
     471    msg = solver.CheckTermination(disp=False, info=True) 
    470472 
    471473    x = solver.bestSolution 
     
    598600 
    599601    # code below here pushes output to scipy.optimize.fmin interface 
    600     msg = solver.CheckTermination(disp=disp, info=True) 
     602    msg = solver.CheckTermination(disp=False, info=True) 
    601603 
    602604    x = solver.bestSolution 
Note: See TracChangeset for help on using the changeset viewer.