Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 10524 invoked from network); 22 Nov 2009 22:04:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Nov 2009 22:04:25 -0000 Received: (qmail 9510 invoked by uid 500); 22 Nov 2009 22:04:24 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 9382 invoked by uid 500); 22 Nov 2009 22:04: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 9372 invoked by uid 99); 22 Nov 2009 22:04:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Nov 2009 22:04:24 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of phil.steitz@gmail.com designates 209.85.210.189 as permitted sender) Received: from [209.85.210.189] (HELO mail-yx0-f189.google.com) (209.85.210.189) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Nov 2009 22:04:14 +0000 Received: by yxe27 with SMTP id 27so4590347yxe.10 for ; Sun, 22 Nov 2009 14:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=JEH3FReq86yqYSgC7DtSsU1TrbH/oCfURs24bUaQjts=; b=tT9VrLxoSJOd1dxCRjwfp/eCT6qz+uESuVkdopGrk2LE0TbjXfDwr6hack+UrQwKhx B4+MyyLLmO3FKe5fYt5JC5Pb5YM19m5he+0W758YjZAiuKtnhf58VEWDaQmefvtiycDv R4vgQoJYqMLh8/paIubmDp+OTfOQZSuGc4iYI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Q22ll70xqkrEr/SiR/4rVtIeePY1ziaFpxp40U2/ZmeQJQ5a9pkNvCIux8/GL4g2Eq bwCvjCX9ud/jGWhJMI7mEvhuI8kOTdk13ZMBC+9ugB+NAFHin38uL8C/nr2kD/ziTNlk /QCB5RkP8OkABeo9ZfRZ/HwUH9pWc9CFfuOnw= Received: by 10.91.126.10 with SMTP id d10mr5675729agn.70.1258927433225; Sun, 22 Nov 2009 14:03:53 -0800 (PST) Received: from phil-steitzs-macbook-pro.local (ip98-167-196-155.ph.ph.cox.net [98.167.196.155]) by mx.google.com with ESMTPS id 36sm1626232yxh.13.2009.11.22.14.03.51 (version=SSLv3 cipher=RC4-MD5); Sun, 22 Nov 2009 14:03:52 -0800 (PST) Message-ID: <4B09B546.3060604@gmail.com> Date: Sun, 22 Nov 2009 17:03:50 -0500 From: Phil Steitz User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Commons Developers List Subject: Re: svn commit: r883132 - in /commons/proper/math/trunk: pom.xml src/main/java/org/apache/commons/math/genetics/GeneticAlgorithm.java src/site/xdoc/changes.xml References: <20091122195055.1E4B5238898B@eris.apache.org> <25aac9fc0911221226n5611159lb0fea8e63139ba8a@mail.gmail.com> In-Reply-To: <25aac9fc0911221226n5611159lb0fea8e63139ba8a@mail.gmail.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org sebb wrote: > On 22/11/2009, psteitz@apache.org wrote: >> Author: psteitz >> Date: Sun Nov 22 19:50:54 2009 >> New Revision: 883132 >> >> URL: http://svn.apache.org/viewvc?rev=883132&view=rev >> Log: >> Added generationsEvolved property to GeneticAlgorithm to track the number >> of generations evolved by the evolve() method before reaching the StoppingCondition. >> JIRA: MATH-315 >> Reported and patched by Mikkel Meyer Andersen >> >> Modified: >> commons/proper/math/trunk/pom.xml >> commons/proper/math/trunk/src/main/java/org/apache/commons/math/genetics/GeneticAlgorithm.java >> commons/proper/math/trunk/src/site/xdoc/changes.xml >> >> Modified: commons/proper/math/trunk/pom.xml >> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/pom.xml?rev=883132&r1=883131&r2=883132&view=diff >> ============================================================================== >> --- commons/proper/math/trunk/pom.xml (original) >> +++ commons/proper/math/trunk/pom.xml Sun Nov 22 19:50:54 2009 >> @@ -103,6 +103,9 @@ >> C. Scott Ananian >> >> >> + Mikkel Meyer Andersen >> + >> + >> Mark Anderson >> >> >> >> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/genetics/GeneticAlgorithm.java >> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/genetics/GeneticAlgorithm.java?rev=883132&r1=883131&r2=883132&view=diff >> ============================================================================== >> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/genetics/GeneticAlgorithm.java (original) >> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/genetics/GeneticAlgorithm.java Sun Nov 22 19:50:54 2009 >> @@ -34,7 +34,6 @@ >> * Use {@link #setRandomGenerator(RandomGenerator)} to supply an alternative >> * to the default JDK-provided PRNG. >> */ >> - //@GuardedBy("this") > > Why was the comment dropped? Thought it was cruft. OK to add it back, I guess. Phil > >> private static RandomGenerator randomGenerator = new JDKRandomGenerator(); >> >> /** the crossover policy used by the algorithm. */ >> @@ -52,6 +51,9 @@ >> /** the selection policy used by the algorithm. */ >> private final SelectionPolicy selectionPolicy; >> >> + /** the number of generations evolved to reach {@link StoppingCondition} in the last run. */ >> + private int generationsEvolved = 0; >> + >> /** >> * @param crossoverPolicy The {@link CrossoverPolicy} >> * @param crossoverRate The crossover rate as a percentage (0-1 inclusive) >> @@ -96,6 +98,8 @@ >> >> /** >> * Evolve the given population. Evolution stops when the stopping condition >> + * is satisfied. Updates the {@link #getGenerationsEvolved() generationsEvolved} >> + * property with the number of generations evolved before the StoppingCondition >> * is satisfied. >> * >> * @param initial the initial, seed population. >> @@ -104,8 +108,10 @@ >> */ >> public Population evolve(Population initial, StoppingCondition condition) { >> Population current = initial; >> + generationsEvolved = 0; >> while (!condition.isSatisfied(current)) { >> current = nextGeneration(current); >> + generationsEvolved++; >> } >> return current; >> } >> @@ -207,4 +213,14 @@ >> return selectionPolicy; >> } >> >> + /** >> + * Returns the number of generations evolved to >> + * reach {@link StoppingCondition} in the last run. >> + * >> + * @return number of generations evolved >> + */ >> + public int getGenerationsEvolved() { >> + return generationsEvolved; >> + } >> + >> } >> >> Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml >> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=883132&r1=883131&r2=883132&view=diff >> ============================================================================== >> --- commons/proper/math/trunk/src/site/xdoc/changes.xml (original) >> +++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Nov 22 19:50:54 2009 >> @@ -39,6 +39,10 @@ >> >> >> >> + >> + Added generationsEvolved property to GeneticAlgorithm to track the number of generations >> + evolved by the evolve() method before reaching the StoppingCondition. >> + >> >> Fixed an index computation error in eigen decomposition. Once again, kudos to Dimitri >> for debugging this. >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org