updates to target misfit

This commit is contained in:
Rowan Cockett
2015-06-05 15:50:00 -07:00
parent 06ba32f07d
commit 6d3d8d78b6
2 changed files with 19 additions and 0 deletions
+15
View File
@@ -144,6 +144,21 @@ class BetaSchedule(InversionDirective):
if self.debug: print 'BetaSchedule is cooling Beta. Iteration: %d' % self.opt.iter
self.invProb.beta /= self.coolingFactor
class TargetMisfit(InversionDirective):
@property
def target(self):
if getattr(self, '_target', None) is None:
self._target = self.survey.nD
return self._target
@target.setter
def target(self, val):
self._target = val
def endIter(self):
if self.invProb.phi_d < self.target:
self.opt.stopNextIteration = True
class _SaveEveryIteration(InversionDirective):
+4
View File
@@ -97,6 +97,8 @@ class Minimize(object):
tolG = 1e-1 #: Tolerance on gradient norm
eps = 1e-5 #: Small value
stopNextIteration = False #: Stops the optimization program nicely.
debug = False #: Print debugging information
debugLS = False #: Print debugging information for the line-search
@@ -186,6 +188,7 @@ class Minimize(object):
xt, caught = self.modifySearchDirectionBreak(p)
if not caught: return self.xc
self.doEndIteration(xt)
if self.stopNextIteration: break
self.printDone()
self.finish()
@@ -210,6 +213,7 @@ class Minimize(object):
self.iter = 0
self.iterLS = 0
self.stopNextIteration = False
x0 = self.projection(x0) # ensure that we start of feasible.
self.x0 = x0