diff options
author | Todor Balabanov <todor.balabanov@gmail.com> | 2019-04-29 13:27:17 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-01 16:10:45 +0200 |
commit | df512e74753667194faa623b99884d3590597cfd (patch) | |
tree | ef40829d30390ffb6d9d3efcd48f54f130bd8a84 /nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior | |
parent | f82356d9a1ce1457593a5f42728e2962561328cf (diff) |
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@yahoo.fr>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior')
-rw-r--r-- | nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java | 2 |
1 files changed, 1 insertions, 1 deletions
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 { |