Changeset 795


Ignore:
Timestamp:
06/15/15 05:24:13 (11 months ago)
Author:
mmckerns
Message:

fix: Finalize for fmin_powell should call cost unless solver is live

Location:
mystic/mystic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mystic/mystic/abstract_solver.py

    r794 r795  
    112112        """ 
    113113        NP = kwds['npop'] if 'npop' in kwds else 1 
    114        #self._max = kwds['max'] if 'max' in kwds else False 
    115114 
    116115        self.nDim             = dim 
     
    653652        # check if need to 'wrap' or can return the stored cost 
    654653        if cost in [None, _raw, _cost] and ExtraArgs in [None, _args] \ 
    655           and self._live: 
     654           and self._live: 
    656655            return _cost 
    657656        # 'wrap' the 'new' cost function with _decorate 
  • mystic/mystic/differential_evolution.py

    r794 r795  
    730730    if handler: solver.enable_signal_handler() 
    731731    #TODO: allow sigint_callbacks for all minimal interfaces ? 
    732     solver.Solve(cost,termination=termination,strategy=strategy,\ 
     732    solver.Solve(cost, termination=termination, strategy=strategy, \ 
    733733                #sigint_callback=other_callback,\ 
    734                  CrossProbability=cross,ScalingFactor=scale,\ 
    735                  ExtraArgs=args,callback=callback) 
     734                 CrossProbability=cross, ScalingFactor=scale, \ 
     735                 ExtraArgs=args, callback=callback) 
    736736    solution = solver.Solution() 
    737737 
  • mystic/mystic/scipy_optimize.py

    r794 r795  
    416416 
    417417    if handler: solver.enable_signal_handler() 
    418     solver.Solve(cost,termination=termination,\ 
     418    solver.Solve(cost, termination=termination, \ 
    419419                 disp=disp, ExtraArgs=args, callback=callback) 
    420420    solution = solver.Solution() 
     
    605605    def Finalize(self, **kwds): 
    606606        """cleanup upon exiting the main optimization loop""" 
    607         if self.energy_history != None: 
     607        if self.energy_history and self._live: 
    608608            self.energy_history = None # resync with 'best' energy 
    609609            self._stepmon(self.bestSolution, self.bestEnergy, self.id) 
     
    757757 
    758758    if handler: solver.enable_signal_handler() 
    759     solver.Solve(cost,termination=termination,\ 
     759    solver.Solve(cost, termination=termination, \ 
    760760                 xtol=xtol, ExtraArgs=args, callback=callback, \ 
    761761                 disp=disp, direc=direc)   #XXX: last two lines use **kwds 
Note: See TracChangeset for help on using the changeset viewer.