samer@0: /* samer@0: * Copyright (c) 2000, Samer Abdallah, King's College London. samer@0: * All rights reserved. samer@0: * samer@0: * This software is provided AS iS and WITHOUT ANY WARRANTY; samer@0: * without even the implied warranty of MERCHANTABILITY or samer@0: * FITNESS FOR A PARTICULAR PURPOSE. samer@0: */ samer@0: samer@0: package samer.maths.opt; samer@0: import samer.maths.*; samer@0: samer@0: samer@0: public class AbsXFConvergence samer@0: { samer@0: double XTOL=1e-7; // various tolerances samer@0: double FTOL=XTOL*XTOL; samer@0: samer@0: public void setXTolerance( double tolx) { XTOL=tolx; } samer@0: public void setFTolerance( double tolf) { FTOL=tolf; } samer@0: samer@0: public boolean isSatisfied(State S) samer@0: { samer@0: // small step taken samer@0: // this compares the actual step taken with samer@0: if (Math.abs(S.P1.f-S.P2.f)>FTOL) return false; samer@0: if (S.alpha*S.normh>XTOL) return false; samer@0: return true; samer@0: } samer@0: }