Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 00A248714 for ; Wed, 10 Aug 2011 02:46:28 +0000 (UTC) Received: (qmail 27197 invoked by uid 500); 10 Aug 2011 02:46:27 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 26782 invoked by uid 500); 10 Aug 2011 02:46:24 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 26771 invoked by uid 99); 10 Aug 2011 02:46:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2011 02:46:22 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebastien.brisard@gmail.com designates 209.85.220.171 as permitted sender) Received: from [209.85.220.171] (HELO mail-vx0-f171.google.com) (209.85.220.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2011 02:46:16 +0000 Received: by vxh13 with SMTP id 13so558179vxh.30 for ; Tue, 09 Aug 2011 19:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=DxqHlKpiUfx77kqmdQB/oMz/Zynxny9DA2oxms0q96o=; b=e6YLp7XJ009s4uyvwcP05t6XFcffTCCmi9RLQ5JUJT16x4cHHwkeE43AGoetYY/RPn TaoVWKt8oLx/2UpVaSbrQVQKYq0GskGwevHSCh2JmaLUh3Vb3DIOZBf5LmZ5PM+nEiyU 5fa5sr3oUidUgOfmOAu/niEFfCsTmM+S+p30E= MIME-Version: 1.0 Received: by 10.52.68.231 with SMTP id z7mr8246676vdt.86.1312944355434; Tue, 09 Aug 2011 19:45:55 -0700 (PDT) Sender: sebastien.brisard@gmail.com Received: by 10.220.180.198 with HTTP; Tue, 9 Aug 2011 19:45:55 -0700 (PDT) In-Reply-To: <4E40ED67.6030103@gmail.com> References: <4E40536A.5030408@gmail.com> <4E40ED67.6030103@gmail.com> Date: Wed, 10 Aug 2011 04:45:55 +0200 X-Google-Sender-Auth: 1vtKNfu7V6S1JNcQrKBXe56lDNg Message-ID: Subject: Re: [math] Testing for convergence in iterative algorithms From: =?ISO-8859-1?Q?S=E9bastien_Brisard?= To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > > The tricky bit here is a) how to encapsulate state in a generic way > that has enough substance to it to be actually useful and b) > similarly how to do the same for convergence. =A0I am probably too > influenced by the topological connotation of the latter term which > makes it seem basically different to me from what we have in the GA, > where we are not really trying to engineer convergence of a sequence > in any topological space. =A0But it could be they can rightly be seen > as the same and Population in the GA should be a sublcass of > whatever we end up calling iterative algorithm state. > > Another tricky bit is that in some of the examples you gave, history > as well as current state must be available to the StoppingCondition > - so just passing it current state is not enough. =A0 It might > actually be better for the StoppingCondition to be what you are > calling a monitor - an event listener that can subscribe to the > events carrying the information that it needs. > > As I said on the other thread, I think in any case a generic event > framework to support the "monitoring" requirement would be a good > thing to develop. > > Phil Hi, this takes us back to a discussion we had on JIRA: is a stopping criterion a kind of monitor? Gilles argued that the two concepts should be distinguished, and a default stopping criterion should be hard coded in the iterative algorithm itself. I agree with that view, since the default stopping criterion would then be highly optimized. As for some stopping criteria requiring more than one state (e.g state at times t and t-1), don't you think it should be the responsibility of the convergence checker itself to store previous values of the state. Let me explain myself. I might want to design a special stopping criterion wich would work as follows: - take the last say three states of the iterative algorithm: x[n], x[n-1], x[n-2], - extrapolate a "converged" state, based on these values y[n] =3D extrapolate(x[n], x[n-1], x[n-2]) - check for convergence of the extrapolated values abs(y[n]-y[n-1]) <=3D = eps ? As you see, each call to the checker would require the last *three* states. This is endless! So I think the convergence checker itself should store the previous states as needed. This way, we could have a generic ConvergenceChecker public interface ConvergenceChecker{ public boolean hasConverged(State s); } What do you think of this design? On a more tentative side, here is what an IterativeAlgorithm could look like public interface IterativeAlgorithm{ public boolean isIterating(); public int getIteration(); public State getState(); public int getMaximumNumberOfIterations(); } As you can see, I haven't dared to try to put Observers/Listeners into that... BTW, GSL might be worth looking into in order to see what design they chose. I'll look into it. Sebastien --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org