Changeset 158


Ignore:
Timestamp:
08/02/09 14:40:15 (7 years ago)
Author:
altafang
Message:

Adding simulated annealing solver andsome fixes to snobfit

Location:
branches/alta/mystic-0.1a2
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alta/mystic-0.1a2/mystic/snobfit_solver.py

    r155 r158  
    1 # Snobfit optimization (branch and bound) adapted to the Mystic framework 
    2  
    31""" 
    42Solvers 
     
    6866from mystic.softConstraint import SoftConstraint, SoftConstraints 
    6967 
    70 # ----------------------------------------------------------------- 
    71  
    72 # Mystic imports 
     68# Import Mystic tools 
    7369from mystic.tools import Null, wrap_function, unpair 
    7470from mystic.tools import wrap_bounds 
     
    264260        # code below here pushes output to scipy.optimize interface 
    265261        fval = self.bestEnergy 
    266         warnflag = 0 
    267262 
    268263        if fcalls[0] >= self._maxfun: 
    269             warnflag = 1 
    270264            if disp: 
    271265                print "Warning: Maximum number of function evaluations has "\ 
    272266                      "been exceeded." 
    273267        elif i >= self._maxiter: 
    274             warnflag = 2 
    275268            if disp: 
    276269                print "Warning: Maximum number of iterations has been exceeded" 
  • branches/alta/mystic-0.1a2/mystic/termination.py

    r151 r158  
    8585    return _ 
    8686 
     87def AnnealTermination(feps=1e-6): 
     88    """Terminate if abs((population-x0)/x0) < feps""" 
     89    def _(inst): 
     90         sim = inst.population 
     91         return all(abs((sim-sim[0])/sim[0]) < feps) 
     92    return _ 
     93 
    8794# end of file 
Note: See TracChangeset for help on using the changeset viewer.