[Libreoffice-commits] core.git: nlpsolver/ThirdParty

Todor Balabanov (via logerrit) logerrit at kemper.freedesktop.org
Wed May 1 14:11:22 UTC 2019


 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit df512e74753667194faa623b99884d3590597cfd
Author:     Todor Balabanov <todor.balabanov at gmail.com>
AuthorDate: Mon Apr 29 13:27:17 2019 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed May 1 16:10:45 2019 +0200

    Math pow is too slow in this case.
    
    Change-Id: I16149cabf75ec928d96975e4b98622df6951cefc
    Reviewed-on: https://gerrit.libreoffice.org/71519
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
index b6387bfb8a96..e5677818c0ef 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -57,7 +57,7 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
       if (Math.random()<CR || k == DIMENSION-1) {
         double Dabcd = 0;
         for(int i=0; i<referPoints.length; i++) {
-          Dabcd += Math.pow(-1, i%2)*referPoints[i].getLocation()[rj];
+          Dabcd += (i%2==0 ? +1D : -1D)*referPoints[i].getLocation()[rj];
         }
         trailPoint.getLocation()[rj] = gbest_t.getLocation()[rj]+FACTOR*Dabcd;
       } else {


More information about the Libreoffice-commits mailing list