Mercurial > hg > jslab
annotate src/samer/maths/opt/AbsXFConvergence.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
rev | line source |
---|---|
samer@0 | 1 /* |
samer@0 | 2 * Copyright (c) 2000, Samer Abdallah, King's College London. |
samer@0 | 3 * All rights reserved. |
samer@0 | 4 * |
samer@0 | 5 * This software is provided AS iS and WITHOUT ANY WARRANTY; |
samer@0 | 6 * without even the implied warranty of MERCHANTABILITY or |
samer@0 | 7 * FITNESS FOR A PARTICULAR PURPOSE. |
samer@0 | 8 */ |
samer@0 | 9 |
samer@0 | 10 package samer.maths.opt; |
samer@0 | 11 import samer.maths.*; |
samer@0 | 12 |
samer@0 | 13 |
samer@0 | 14 public class AbsXFConvergence |
samer@0 | 15 { |
samer@0 | 16 double XTOL=1e-7; // various tolerances |
samer@0 | 17 double FTOL=XTOL*XTOL; |
samer@0 | 18 |
samer@0 | 19 public void setXTolerance( double tolx) { XTOL=tolx; } |
samer@0 | 20 public void setFTolerance( double tolf) { FTOL=tolf; } |
samer@0 | 21 |
samer@0 | 22 public boolean isSatisfied(State S) |
samer@0 | 23 { |
samer@0 | 24 // small step taken |
samer@0 | 25 // this compares the actual step taken with |
samer@0 | 26 if (Math.abs(S.P1.f-S.P2.f)>FTOL) return false; |
samer@0 | 27 if (S.alpha*S.normh>XTOL) return false; |
samer@0 | 28 return true; |
samer@0 | 29 } |
samer@0 | 30 } |