Changeset 1052
- Timestamp:
- 06/23/08 08:38:00 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openopt/scikits/openopt/__init__.py
r1045 r1052 5 5 6 6 from oo import LP, NLP, NSP, MILP, QP, NLSP, LSP, GLP, LLSP, MMP 7 from Kernel.Function import _f, _c, _h 7 8 from info import __version__ 8 9 #__all__ = filter(lambda s:not s.startswith('_'),dir()) trunk/openopt/scikits/openopt/solvers/UkrOpt/ralg_oo.py
r1049 r1052 1 from numpy import diag, ones, inf, any, copy, zeros, dot, where, all, tile, sum, nan, isfinite, float64 1 from numpy import diag, ones, inf, any, copy, zeros, dot, where, all, tile, sum, nan, isfinite, float64, isnan 2 2 from numpy.linalg import norm 3 3 from scikits.openopt.Kernel.BaseAlg import * … … 117 117 break 118 118 119 iterPoint = newPoint119 iterPoint, optimIterPoint = newPoint, oldPoint 120 120 x = iterPoint.x 121 121 … … 140 140 141 141 if PrevPoint.betterThan(newPoint) or newPoint.f() > PrevPoint.f() or abs(newPoint.f() - iterPoint.f()) < 15 * p.ftol or p.norm(newPoint.x - iterPoint.x) < 15 * p.xtol: 142 iterPoint, hs = PrevPoint, hs_prev142 iterPoint, optimIterPoint, hs = PrevPoint, p.point(PrevPoint.x), hs_prev 143 143 break 144 144 … … 151 151 152 152 x = iterPoint.x.copy() 153 fk, xk, rk = iterPoint.f(), x.copy(), iterPoint.mr()154 153 155 154 if ls <= 0: hs *= q1 … … 202 201 #hs = max(p.norm(xPrevIter - x), hsmin) 203 202 204 p.iterfcn( xk, fk, rk)203 p.iterfcn(iterPoint) 205 204 206 205 s2 = 0 … … 224 223 225 224 if p.istop: 225 p.iterfcn(optimIterPoint) 226 226 return 227 227 … … 236 236 237 237 def __getRalgDirection__(self, point): 238 # TODO: what if df and/or dmr has some NaNs? 238 239 maxRes = point.mr() 239 240 if maxRes > point.p.contol: … … 245 246 else: 246 247 d = point.df() 248 if any(isnan(d)) and maxRes>0: # comparison to 0, not contol 249 d = point.dmr() 247 250 return d 248 251
