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

2021-07-19 Thread Julien Nabet (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 |3 ++-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 695d926248acf6e26222b26242f95fb46066aae6
Author: Julien Nabet 
AuthorDate: Sun Jul 18 19:37:20 2021 +0200
Commit: Julien Nabet 
CommitDate: Mon Jul 19 18:01:24 2021 +0200

AbsGTBehavior should implement ILibEngine

so we're sure all derivatives will have to

Change-Id: I4e62d02f01382dbc95b28ffcb3d278aa31427f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119145
Tested-by: Jenkins
Reviewed-by: Todor Balabanov 
Reviewed-by: Julien Nabet 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
index c96174227b93..b6aacd3ccc40 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
@@ -18,12 +18,13 @@
 package net.adaptivebox.deps.behavior;
 
 import net.adaptivebox.goodness.IGoodnessCompareEngine;
+import net.adaptivebox.knowledge.ILibEngine;
 import net.adaptivebox.knowledge.Library;
 import net.adaptivebox.knowledge.SearchPoint;
 import net.adaptivebox.problem.ProblemEncoder;
 import net.adaptivebox.space.BasicPoint;
 
-abstract public class AbsGTBehavior {
+abstract public class AbsGTBehavior implements ILibEngine {
   // The referred social library
   protected Library socialLib;
 
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 ada457f3233c..21bc2fb82de3 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -30,13 +30,12 @@ package net.adaptivebox.deps.behavior;
 
 import net.adaptivebox.global.RandomGenerator;
 import net.adaptivebox.goodness.IGoodnessCompareEngine;
-import net.adaptivebox.knowledge.ILibEngine;
 import net.adaptivebox.knowledge.Library;
 import net.adaptivebox.knowledge.SearchPoint;
 import net.adaptivebox.problem.ProblemEncoder;
 import net.adaptivebox.space.BasicPoint;
 
-public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
+public class DEGTBehavior extends AbsGTBehavior {
   //Number of differential vectors, normally be 1 or 2
   private static final int DVNum = 2;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-18 Thread Julien Nabet (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
|2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 371ae1cf2307e5585f4f66f001c97d464cf44429
Author: Julien Nabet 
AuthorDate: Sun Jul 18 10:01:45 2021 +0200
Commit: Julien Nabet 
CommitDate: Sun Jul 18 10:47:45 2021 +0200

nlpsolver: DEPSAgent doesn't implement ILibEngine

Fix this error:

/home/julien/lo/libreoffice/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java:45:
 error: DEPSAgent is not abstract and does not override abstract method 
setLibrary(Library) in ILibEngine
public class DEPSAgent implements ILibEngine {
   ^
1 error

(on pc Debian testing x86-64 with master sources updated today
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-post-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.11+9-post-Debian-1, mixed mode, 
sharing)
)

Change-Id: I1ce2d1a9ddee1020889f1a7a8fcd3387980b241f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119119
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index b3e5f310031f..75e66ff251b6 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -43,7 +43,7 @@ import net.adaptivebox.knowledge.SearchPoint;
 import net.adaptivebox.problem.ProblemEncoder;
 import net.adaptivebox.space.BasicPoint;
 
-public class DEPSAgent implements ILibEngine {
+public class DEPSAgent {
 
   // Describes the problem to be solved
   private ProblemEncoder problemEncoder;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-12 Thread Caolán McNamara (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
|   11 ++
 1 file changed, 11 insertions(+)

New commits:
commit 61618141f0204ce6653354f6424e11276d939aed
Author: Caolán McNamara 
AuthorDate: Sun Jul 11 19:52:52 2021 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 12 10:46:57 2021 +0200

cid#1487032 NP: Null pointer dereference

and

cid#1487033 UwF: Unwritten field

since...

commit 822f128e734f37ee4de9bf5b62640cbec140701e
Date:   Wed Jul 7 16:01:19 2021 +0300

Polymorphism is a better approach when there are chains of inheritance.

where deGTBehavior and psGTBehavior are no longer stored when set from
DEPSSolverImpl.java:146 and DEPSSolverImpl.java:147

Change-Id: If3d228bf6e5f2b1ddd119d75b55bd778bcce8b05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118759
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 88aa56eff837..adc6a75bd4f4 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -101,6 +101,17 @@ public class DEPSAgent implements ILibEngine {
 
   public void setGTBehavior(AbsGTBehavior gtBehavior) {
 gtBehavior.setMemPoints(pbest_t, pcurrent_t, pold_t);
+
+// see getGTBehavior and setLibrary for uses of
+// deGTBehavior and psGTBehavior
+if (gtBehavior instanceof DEGTBehavior) {
+  deGTBehavior = ((DEGTBehavior) gtBehavior);
+  return;
+}
+if (gtBehavior instanceof PSGTBehavior) {
+  psGTBehavior = ((PSGTBehavior) gtBehavior);
+  return;
+}
   }
 
   public void generatePoint() {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-07 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
 |   13 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 |3 ++
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |3 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
  |1 
 4 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 822f128e734f37ee4de9bf5b62640cbec140701e
Author: Todor Balabanov 
AuthorDate: Wed Jul 7 16:01:19 2021 +0300
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 8 03:49:56 2021 +0200

Polymorphism is a better approach when there are chains of inheritance.

Change-Id: I2580dafcf8792bf4b11db78988db8c2976e4545c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118569
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 58250089b02f..88aa56eff837 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -66,7 +66,7 @@ public class DEPSAgent implements ILibEngine {
   // the own memory: store the personal best point
   private SearchPoint pbest_t;
 
-  // Generate-and-test Behaviors
+  // Generate-and-test behaviors.
   private DEGTBehavior deGTBehavior;
   private PSGTBehavior psGTBehavior;
   public double switchP = 0.5;
@@ -100,16 +100,7 @@ public class DEPSAgent implements ILibEngine {
   }
 
   public void setGTBehavior(AbsGTBehavior gtBehavior) {
-if (gtBehavior instanceof DEGTBehavior) {
-  deGTBehavior = ((DEGTBehavior) gtBehavior);
-  deGTBehavior.setPbest(pbest_t);
-  return;
-}
-if (gtBehavior instanceof PSGTBehavior) {
-  psGTBehavior = ((PSGTBehavior) gtBehavior);
-  psGTBehavior.setMemPoints(pbest_t, pcurrent_t, pold_t);
-  return;
-}
+gtBehavior.setMemPoints(pbest_t, pcurrent_t, pold_t);
   }
 
   public void generatePoint() {
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
index b811572ada82..c96174227b93 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
@@ -21,6 +21,7 @@ import net.adaptivebox.goodness.IGoodnessCompareEngine;
 import net.adaptivebox.knowledge.Library;
 import net.adaptivebox.knowledge.SearchPoint;
 import net.adaptivebox.problem.ProblemEncoder;
+import net.adaptivebox.space.BasicPoint;
 
 abstract public class AbsGTBehavior {
   // The referred social library
@@ -30,6 +31,8 @@ abstract public class AbsGTBehavior {
 socialLib = lib;
   }
 
+  abstract public void setMemPoints(SearchPoint pbest, BasicPoint pcurrent, 
BasicPoint pold);
+
   abstract public void generateBehavior(SearchPoint trailPoint, ProblemEncoder 
problemEncoder);
 
   abstract public void testBehavior(SearchPoint trailPoint, 
IGoodnessCompareEngine qualityComparator);
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 df7ff571065d..ada457f3233c 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -52,7 +52,8 @@ public class DEGTBehavior extends AbsGTBehavior implements 
ILibEngine {
   // the own memory: store the point that generated in last learning cycle
   private SearchPoint pbest_t;
 
-  public void setPbest(SearchPoint pbest) {
+  @Override
+  public void setMemPoints(SearchPoint pbest, BasicPoint pcurrent, BasicPoint 
pold) {
 pbest_t = pbest;
   }
 
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
index 3c7523209138..eb35a1ad4e9a 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
@@ -85,6 +85,7 @@ public class PSGTBehavior extends AbsGTBehavior {
   // the own memory: store the personal best point
   private SearchPoint pbest_t;
 
+  @Override
   public void setMemPoints(SearchPoint pbest, BasicPoint pcurrent, BasicPoint 
pold) {
 pcurrent_t = pcurrent;
 pbest_t = pbest;

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

2021-06-19 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
|3 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
 |4 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
 |7 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
 |   24 ++
 4 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit ffef53274b44bfe77128ba400845f4c4ce70893e
Author: Todor Balabanov 
AuthorDate: Fri Jun 18 10:46:33 2021 +0300
Commit: Tomaž Vajngerl 
CommitDate: Sun Jun 20 03:59:07 2021 +0200

It is a good practice single source of random numbers to be used.

Change-Id: If76e247461288a9ed938b4f6cb592c814b8bbe2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117406
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index b9784c8a2ab3..58250089b02f 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -35,6 +35,7 @@ package net.adaptivebox.deps;
 import net.adaptivebox.deps.behavior.AbsGTBehavior;
 import net.adaptivebox.deps.behavior.DEGTBehavior;
 import net.adaptivebox.deps.behavior.PSGTBehavior;
+import net.adaptivebox.global.RandomGenerator;
 import net.adaptivebox.goodness.IGoodnessCompareEngine;
 import net.adaptivebox.knowledge.ILibEngine;
 import net.adaptivebox.knowledge.Library;
@@ -91,7 +92,7 @@ public class DEPSAgent implements ILibEngine {
   }
 
   private AbsGTBehavior getGTBehavior() {
-if (Math.random() < switchP) {
+if (RandomGenerator.doubleZeroOneRandom() < switchP) {
   return deGTBehavior;
 } else {
   return psGTBehavior;
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 5dedc8052ec7..df7ff571065d 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -88,7 +88,7 @@ public class DEGTBehavior extends AbsGTBehavior implements 
ILibEngine {
 
 /* Handle first part of the trial vector. */
 for (int index = 0; index < guaranteeIndex; index++) {
-  if (CR <= Math.random()) {
+  if (CR <= RandomGenerator.doubleZeroOneRandom()) {
 trailVector[index] = locaclVector[index];
 continue;
   }
@@ -101,7 +101,7 @@ public class DEGTBehavior extends AbsGTBehavior implements 
ILibEngine {
 
 /* Handle second part of the trial vector. */
 for (int index = guaranteeIndex + 1; index < DIMENSION; index++) {
-  if (CR <= Math.random()) {
+  if (CR <= RandomGenerator.doubleZeroOneRandom()) {
 trailVector[index] = locaclVector[index];
 continue;
   }
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
index dd61355f86fd..3c7523209138 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
@@ -55,6 +55,7 @@
 
 package net.adaptivebox.deps.behavior;
 
+import net.adaptivebox.global.RandomGenerator;
 import net.adaptivebox.goodness.IGoodnessCompareEngine;
 import net.adaptivebox.knowledge.Library;
 import net.adaptivebox.knowledge.SearchPoint;
@@ -102,14 +103,14 @@ public class PSGTBehavior extends AbsGTBehavior {
 
 int DIMENSION = designSpace.getDimension();
 for (int b = 0; b < DIMENSION; b++) {
-  if (Math.random() < CL) {
+  if (RandomGenerator.doubleZeroOneRandom() < CL) {
 designSpace.mutationAt(trailPointLocation, b);
 continue;
   }
 
   double deltaxb = weight * (pcurrent_t_location[b] - pold_t_location[b])
-+ c1 * Math.random() * (pbest_t_location[b] - 
pcurrent_t_location[b])
-+ c2 * Math.random() * (gbest_t_location[b] - 
pcurrent_t_location[b]);
++ c1 * RandomGenerator.doubleZeroOneRandom() * 
(pbest_t_location[b] - pcurrent_t_location[b])
++ c2 * RandomGenerator.doubleZeroOneRandom() * 
(gbest_t_location[b] - pcurrent_t_location[b]);
 
   // limitation for delta_x
   double deltaxbm = 0.5 * designSpace.getMagnitudeIn(b);
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
 

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

2021-06-14 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
 |   40 ++
 1 file changed, 24 insertions(+), 16 deletions(-)

New commits:
commit b3bf90ec5fb3d4c6379288081e63d944cda8d5a4
Author: Todor Balabanov 
AuthorDate: Mon Jun 14 15:14:20 2021 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jun 15 06:03:52 2021 +0200

Fewer array reference calls make the code more readable and more efficient.

Change-Id: I7416633a735078a4e0e857f050ea7bfaadba310c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117158
Reviewed-by: Noel Grandin 
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
index 13c605b63780..dd61355f86fd 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
@@ -92,27 +92,35 @@ public class PSGTBehavior extends AbsGTBehavior {
 
   @Override
   public void generateBehavior(SearchPoint trailPoint, ProblemEncoder 
problemEncoder) {
-SearchPoint gbest_t = socialLib.getGbest();
 DesignSpace designSpace = problemEncoder.getDesignSpace();
+
+double[] pold_t_location = pold_t.getLocation();
+double[] pbest_t_location = pbest_t.getLocation();
+double[] pcurrent_t_location = pcurrent_t.getLocation();
+double[] gbest_t_location = socialLib.getGbest().getLocation();
+double[] trailPointLocation = trailPoint.getLocation();
+
 int DIMENSION = designSpace.getDimension();
-double deltaxb, deltaxbm;
 for (int b = 0; b < DIMENSION; b++) {
   if (Math.random() < CL) {
-designSpace.mutationAt(trailPoint.getLocation(), b);
-  } else {
-deltaxb = weight * (pcurrent_t.getLocation()[b] - 
pold_t.getLocation()[b])
-+ c1 * Math.random() * (pbest_t.getLocation()[b] - 
pcurrent_t.getLocation()[b])
-+ c2 * Math.random() * (gbest_t.getLocation()[b] - 
pcurrent_t.getLocation()[b]);
-
-// limitation for delta_x
-deltaxbm = 0.5 * designSpace.getMagnitudeIn(b);
-if (deltaxb < -deltaxbm) {
-  deltaxb = -deltaxbm;
-} else if (deltaxb > deltaxbm) {
-  deltaxb = deltaxbm;
-}
-trailPoint.getLocation()[b] = pcurrent_t.getLocation()[b] + deltaxb;
+designSpace.mutationAt(trailPointLocation, b);
+continue;
   }
+
+  double deltaxb = weight * (pcurrent_t_location[b] - pold_t_location[b])
++ c1 * Math.random() * (pbest_t_location[b] - 
pcurrent_t_location[b])
++ c2 * Math.random() * (gbest_t_location[b] - 
pcurrent_t_location[b]);
+
+  // limitation for delta_x
+  double deltaxbm = 0.5 * designSpace.getMagnitudeIn(b);
+
+  if (deltaxb < -deltaxbm) {
+deltaxb = -deltaxbm;
+  } else if (deltaxb > deltaxbm) {
+deltaxb = deltaxbm;
+  }
+
+  trailPointLocation[b] = pcurrent_t_location[b] + deltaxb;
 }
   }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-05-17 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
 |   10 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |   11 ++
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
  |   19 ++--
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalStruct.java
   |   10 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
  |7 +
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/BCHComparator.java
  |4 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/IGoodnessCompareEngine.java
 |   12 ++-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
   |1 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
   |6 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
  |8 +-
 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java   
  |   39 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java
 |1 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
   |1 
 13 files changed, 74 insertions(+), 55 deletions(-)

New commits:
commit 5ee453818c88f0a73ca2863a80c6b901feed1837
Author: Todor Balabanov 
AuthorDate: Mon May 13 14:29:17 2019 +0300
Commit: Samuel Mehrbrodt 
CommitDate: Fri May 17 08:45:46 2019 +0200

Some additional manual formatting.

Change-Id: Ie5590535d013aa2f747dd034fa2fcd2ae5c3956b
Reviewed-on: https://gerrit.libreoffice.org/72226
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 0f1240df9a1b..b9784c8a2ab3 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -46,6 +46,7 @@ public class DEPSAgent implements ILibEngine {
 
   // Describes the problem to be solved
   private ProblemEncoder problemEncoder;
+
   // Forms the goodness landscape
   private IGoodnessCompareEngine qualityComparator;
 
@@ -57,8 +58,10 @@ public class DEPSAgent implements ILibEngine {
 
   // the own memory: store the point that generated in old learning cycle
   private BasicPoint pold_t;
+
   // the own memory: store the point that generated in last learning cycle
   private BasicPoint pcurrent_t;
+
   // the own memory: store the personal best point
   private SearchPoint pbest_t;
 
@@ -109,11 +112,12 @@ public class DEPSAgent implements ILibEngine {
   }
 
   public void generatePoint() {
-// generates a new point in the search space (S) based on
-// its memory and the library
+// generates a new point in the search space (S) based on
+// its memory and the library
 selectGTBehavior = this.getGTBehavior();
 selectGTBehavior.generateBehavior(trailPoint, problemEncoder);
-// evaluate into goodness information
+
+// evaluate into goodness information
 problemEncoder.evaluate(trailPoint);
   }
 
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 40e570a77559..645318341108 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -37,9 +37,14 @@ import net.adaptivebox.problem.ProblemEncoder;
 import net.adaptivebox.space.BasicPoint;
 
 public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
-  private static final int DVNum = 2; // Number of differential vectors, 
normally be 1 or 2
-  public double FACTOR = 0.5; // scale constant: (0, 1.2], normally be 0.5
-  public double CR = 0.9; // crossover constant: [0, 1], normally be 0.1 or 0.9
+  //Number of differential vectors, normally be 1 or 2
+  private static final int DVNum = 2;
+
+  //scale constant: (0, 1.2], normally be 0.5
+  public double FACTOR = 0.5;
+
+  //crossover constant: [0, 1], normally be 0.1 or 0.9
+  public double CR = 0.9;
 
   // the own memory: store the point that generated in last learning cycle
   private SearchPoint pbest_t;
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
index afd18390e630..13c605b63780 100644
--- 

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

2019-05-12 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
 |   29 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 |3 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |   31 +--
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
  |   43 ++--
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
  |   23 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalStruct.java
   |   15 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/IEncodeEngine.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java
   |   27 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
  |   99 --
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
  |   21 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/BCHComparator.java
  |   17 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/IGoodnessCompareEngine.java
 |7 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/ILibEngine.java
|3 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
   |   34 +--
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
   |   17 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
  |   33 +--
 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java   
  |   79 ---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java
 |   13 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
   |   29 --
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/ILocationEngine.java
   |2 
 21 files changed, 254 insertions(+), 275 deletions(-)

New commits:
commit 51387dc280dadf7a29d215a72d2d0026451d2be6
Author: Todor Balabanov 
AuthorDate: Sun May 12 10:35:45 2019 +0300
Commit: Julien Nabet 
CommitDate: Sun May 12 22:50:34 2019 +0200

Formatting - Eclipse IDE Java Conventions with spaces for indentation.

Change-Id: I0c3e50ef25bda0bc4ae59665a07848fe75507121
Reviewed-on: https://gerrit.libreoffice.org/72185
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 50ab8fd8c8f0..0f1240df9a1b 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -44,25 +44,25 @@ import net.adaptivebox.space.BasicPoint;
 
 public class DEPSAgent implements ILibEngine {
 
-  //Describes the problem to be solved
+  // Describes the problem to be solved
   private ProblemEncoder problemEncoder;
-  //Forms the goodness landscape
+  // Forms the goodness landscape
   private IGoodnessCompareEngine qualityComparator;
 
-  //store the point that generated in current learning cycle
+  // store the point that generated in current learning cycle
   private SearchPoint trailPoint;
 
-  //temp variable
+  // temp variable
   private AbsGTBehavior selectGTBehavior;
 
-  //the own memory: store the point that generated in old learning cycle
+  // the own memory: store the point that generated in old learning cycle
   private BasicPoint pold_t;
-  //the own memory: store the point that generated in last learning cycle
+  // the own memory: store the point that generated in last learning cycle
   private BasicPoint pcurrent_t;
-  //the own memory: store the personal best point
+  // the own memory: store the personal best point
   private SearchPoint pbest_t;
 
-  //Generate-and-test Behaviors
+  // Generate-and-test Behaviors
   private DEGTBehavior deGTBehavior;
   private PSGTBehavior psGTBehavior;
   public double switchP = 0.5;
@@ -88,7 +88,7 @@ public class DEPSAgent implements ILibEngine {
   }
 
   private AbsGTBehavior getGTBehavior() {
-if (Math.random()0, and the second is 
achieved by using
+  // Two normally choices for (c1, c2, weight), i.e., (2, 2, 0.4), or (1.494,
+  // 1.494, 0.729)
+  // The first is used in dissipative PSO (cf. [4]) as CL>0, and the second is
+  // achieved by using
   // constriction factors (cf. [3])
-  public double c1=2;
-  public double c2=2;
-  public double weight = 0.4; //inertia 

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

2019-05-11 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
 |   61 +++---
 1 file changed, 48 insertions(+), 13 deletions(-)

New commits:
commit c728bb5420f19eb6fbec859ec927f35d772694be
Author: Todor Balabanov 
AuthorDate: Thu May 2 15:17:38 2019 +0300
Commit: Tomaž Vajngerl 
CommitDate: Sun May 12 04:04:54 2019 +0200

Generate behavior code simplification and very small speed-up.

Change-Id: Ib13080e4c21738affa129d12a07f5380f665e7a4
Reviewed-on: https://gerrit.libreoffice.org/71673
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

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 a58a66196372..dc7f7400cd58 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -48,24 +48,59 @@ public class DEGTBehavior extends AbsGTBehavior implements 
ILibEngine {
 pbest_t = pbest;
   }
 
+  /**
+   * Crossover and mutation for a single vector element done in a single step.
+   *
+   * @param index
+   *Index of the trial vector element to be changed.
+   * @param trialVector
+   *Trial vector reference.
+   * @param globalVector
+   *Global best found vector reference.
+   * @param differenceVectors
+   *List of vectors used for difference delta calculation.
+   */
+  private void crossoverAndMutation(int index, double trialVector[], double 
globalVector[], BasicPoint differenceVectors[]) {
+double delta = 0D;
+
+for (int i = 0; i < differenceVectors.length; i++) {
+  delta += (i % 2 == 0 ? +1D : -1D) * 
differenceVectors[i].getLocation()[index];
+}
+
+trialVector[index] = globalVector[index] + FACTOR * delta;
+  }
+
   @Override
   public void generateBehavior(SearchPoint trailPoint, ProblemEncoder 
problemEncoder) {
-SearchPoint gbest_t = socialLib.getGbest();
-
 BasicPoint[] referPoints = getReferPoints();
 int DIMENSION = problemEncoder.getDesignSpace().getDimension();
-int rj = RandomGenerator.intRangeRandom(0, DIMENSION-1);
-for (int k=0; khttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-10 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
 |   12 +---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 |7 ++---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |   12 +---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
  |   10 ---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
  |2 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
  |5 +--
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
   |7 ++---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
   |7 ++---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
  |   14 --
 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java   
  |   13 +
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java
 |6 +---
 11 files changed, 50 insertions(+), 45 deletions(-)

New commits:
commit 7aeef2e88b0a74be6670f13536281bbaecfa568f
Author: Todor Balabanov 
AuthorDate: Wed May 8 14:34:10 2019 +0300
Commit: Julien Nabet 
CommitDate: Fri May 10 08:49:42 2019 +0200

Import of each class is better practice than import of entire library.

Change-Id: I13c4916b951d36ea5e83e52c9c6e36df552bdfeb
Reviewed-on: https://gerrit.libreoffice.org/71961
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 58b7e5e60c31..50ab8fd8c8f0 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -32,11 +32,15 @@ package net.adaptivebox.deps;
  * -> an agent perspective
  */
 
-import net.adaptivebox.deps.behavior.*;
+import net.adaptivebox.deps.behavior.AbsGTBehavior;
+import net.adaptivebox.deps.behavior.DEGTBehavior;
+import net.adaptivebox.deps.behavior.PSGTBehavior;
 import net.adaptivebox.goodness.IGoodnessCompareEngine;
-import net.adaptivebox.knowledge.*;
-import net.adaptivebox.problem.*;
-import net.adaptivebox.space.*;
+import net.adaptivebox.knowledge.ILibEngine;
+import net.adaptivebox.knowledge.Library;
+import net.adaptivebox.knowledge.SearchPoint;
+import net.adaptivebox.problem.ProblemEncoder;
+import net.adaptivebox.space.BasicPoint;
 
 public class DEPSAgent implements ILibEngine {
 
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
index 60f438cc637c..3e556719bfdb 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
@@ -17,9 +17,10 @@
  */
 package net.adaptivebox.deps.behavior;
 
-import net.adaptivebox.goodness.*;
-import net.adaptivebox.knowledge.*;
-import net.adaptivebox.problem.*;
+import net.adaptivebox.goodness.IGoodnessCompareEngine;
+import net.adaptivebox.knowledge.Library;
+import net.adaptivebox.knowledge.SearchPoint;
+import net.adaptivebox.problem.ProblemEncoder;
 
 abstract public class AbsGTBehavior {
   //The referred social library
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 e5677818c0ef..a58a66196372 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -28,11 +28,13 @@
 
 package net.adaptivebox.deps.behavior;
 
-import net.adaptivebox.goodness.*;
-import net.adaptivebox.global.*;
-import net.adaptivebox.knowledge.*;
-import net.adaptivebox.problem.*;
-import net.adaptivebox.space.*;
+import net.adaptivebox.global.RandomGenerator;
+import net.adaptivebox.goodness.IGoodnessCompareEngine;
+import net.adaptivebox.knowledge.ILibEngine;
+import net.adaptivebox.knowledge.Library;
+import net.adaptivebox.knowledge.SearchPoint;
+import net.adaptivebox.problem.ProblemEncoder;
+import net.adaptivebox.space.BasicPoint;
 
 public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
   private static final int DVNum = 2;  //Number of differential vectors, 
normally be 1 or 2
diff --git 

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

2019-05-01 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
 |   46 --
 1 file changed, 19 insertions(+), 27 deletions(-)

New commits:
commit b596210c09374f53d4349990945a07520c092f55
Author: Todor Balabanov 
AuthorDate: Wed May 1 15:04:27 2019 +0300
Commit: Noel Grandin 
CommitDate: Wed May 1 16:15:24 2019 +0200

Fisher-Yates shuffling algorithm achieves much better randomization.

Change-Id: I6d204a7ba0fa19f4c318d1c70f5a0344e0640d6d
Reviewed-on: https://gerrit.libreoffice.org/71620
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
index d7fafc9b9046..18ced86335dc 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
@@ -59,37 +59,29 @@ public class RandomGenerator {
 }
 
 public static int[] randomSelection(int maxNum, int times) {
-if (times <= 0)
-return new int[0];
-int realTimes = Math.min(maxNum, times);
-boolean[] flags = new boolean[maxNum];
-boolean isBelowHalf = times < maxNum * 0.5;
-int virtualTimes = realTimes;
-if (!isBelowHalf) {
-virtualTimes = maxNum - realTimes;
+if (maxNum < 0) {
+maxNum = 0;
 }
-int i = 0;
-int upper = maxNum - 1;
-int[] indices = new int[realTimes];
 
-while (i < virtualTimes) {
-indices[i] = intRangeRandom(0, upper);
-if (!flags[indices[i]]) {
-flags[indices[i]] = true;
-i++;
-}
+if (times < 0) {
+times = 0;
 }
-if (!isBelowHalf) {
-int j = 0;
-for (i = 0; i < maxNum; i++) {
-if (flags[i] == isBelowHalf) {
-indices[j] = i;
-j++;
-if (j == realTimes)
-break;
-}
-}
+
+int[] all = new int[maxNum];
+for (int i = 0; i < all.length; i++) {
+all[i] = i;
 }
+
+/* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle */
+int[] indices = new int[Math.min(maxNum, times)];
+for (int i = 0, j, value; i < indices.length; i++) {
+j = intRangeRandom(i, all.length - 1);
+
+value = all[j];
+all[j] = all[i];
+indices[i] = all[i] = value;
+}
+
 return indices;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-01 Thread Todor Balabanov (via logerrit)
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
 |   11 +++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 209e40de80dec55427d406951f01507a6c8aeb84
Author: Todor Balabanov 
AuthorDate: Mon Apr 29 18:55:25 2019 +0300
Commit: Noel Grandin 
CommitDate: Wed May 1 16:11:30 2019 +0200

Random class is better than Math random function.

Change-Id: Ia35e3bb3b4f0323c7fbfc54ae5064afdf2c3f381
Reviewed-on: https://gerrit.libreoffice.org/71539
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
index b59b0f8b19ed..d7fafc9b9046 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
@@ -22,7 +22,13 @@
 
 package net.adaptivebox.global;
 
+import java.util.Random;
+
 public class RandomGenerator {
+/**
+ * Pseudo-random number generator instance.
+ */
+private static Random PRNG = new Random();
 
 /**
  * This function returns a random integer number between the lowLimit and
@@ -34,8 +40,7 @@ public class RandomGenerator {
  * @return int return value Example: for find [0,1,2]
  */
 public static int intRangeRandom(int lowLimit, int upLimit) {
-int num = (int) Math
-.floor(doubleRangeRandom(lowLimit, upLimit + 1) - 1E-10);
+int num = lowLimit + PRNG.nextInt(upLimit - lowLimit + 1);
 return num;
 }
 
@@ -49,7 +54,7 @@ public class RandomGenerator {
  * @return double return value
  */
 public static double doubleRangeRandom(double lowLimit, double upLimit) {
-double num = lowLimit + Math.random() * (upLimit - lowLimit);
+double num = lowLimit + PRNG.nextDouble() * (upLimit - lowLimit);
 return num;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-01 Thread Todor Balabanov (via logerrit)
 
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 
AuthorDate: Mon Apr 29 13:27:17 2019 +0300
Commit: Noel Grandin 
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 
Reviewed-by: Noel Grandin 

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()https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2015-10-01 Thread Andrea Gelmini
 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java | 
   2 +-
 svx/source/sdr/contact/viewcontactofe3dpolygon.cxx   | 
   4 ++--
 vcl/source/filter/igif/gifread.hxx   | 
   2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 5e985c2f346f25ada98e19e0531ea99cd9a7931c
Author: Andrea Gelmini 
Date:   Thu Oct 1 14:00:32 2015 +0200

Fix typos

Change-Id: I4452d4a4a4a61f39cd9c2b5a441c6c2017f15ce8
Reviewed-on: https://gerrit.libreoffice.org/19073
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java
index e922ba1..959b22e 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java
@@ -76,7 +76,7 @@ public class SCAgent {
   public SearchPoint generatePoint() {
 //generate a new point
 generatePoint(trailPoint);
-//evaluete the generated point
+//evaluate the generated point
 problemEncoder.evaluate(trailPoint);
 return trailPoint;
   }
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx 
b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index 5b5116e..d646046 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -149,11 +149,11 @@ namespace sdr
 
 // #i98295#
 // unfortunately, this SdrObject type which allows a free 3d 
geometry definition was defined
-// wrong topologically in relation to it's plane normal and 3D 
visibility when it was invented
+// wrong topologically in relation to its plane normal and 3D 
visibility when it was invented
 // a long time ago. Since the API allows creation of this 
SDrObject type, it is not possible to
 // simply change this definition. Only the chart should use it, 
and at least this object type
 // only exists at Runtime (is not saved and/or loaded in any 
FileFormat). Still someone external
-// may have used it in it's API. To not risk wrong 3D lightings, I 
have to switch the orientation
+// may have used it in its API. To not risk wrong 3D lightings, I 
have to switch the orientation
 // of the polygon here
 aPolyPolygon3D.flip();
 
diff --git a/vcl/source/filter/igif/gifread.hxx 
b/vcl/source/filter/igif/gifread.hxx
index 969370f..b6489a0 100644
--- a/vcl/source/filter/igif/gifread.hxx
+++ b/vcl/source/filter/igif/gifread.hxx
@@ -79,7 +79,7 @@ class GIFReader : public GraphicReader
 sal_uInt16  nLoops;
 GIFAction   eActAction;
 boolbStatus;
-boolbGCTransparent; // is the image transparant, 
if yes:
+boolbGCTransparent; // is the image transparent, 
if yes:
 boolbInterlaced;
 boolbOverreadBlock;
 boolbImGraphicReady;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-18 Thread Noel Grandin
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |9 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
  |   14 +++---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
  |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalStruct.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/IEncodeEngine.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicArray.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicTag.java
 |   21 --
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/CompareValue.java
 |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
 |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/IUpdateCycleEngine.java
   |4 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
  |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
  |4 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/BCHComparator.java
  |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/IGoodnessCompareEngine.java
 |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/PenaltyComparator.java
  |4 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/SRComparator.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/ILibEngine.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
   |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
  |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/UnconstrainedProblemEncoder.java
 |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
|2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java
 |2 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
   |4 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/ILocationEngine.java
   |2 
 30 files changed, 41 insertions(+), 65 deletions(-)

New commits:
commit 79c6aff069a9593571226bb32e907f837a203b7c
Author: Noel Grandin n...@peralex.com
Date:   Wed Nov 12 15:50:43 2014 +0200

java: fix some javadoc errors

Eclipse was flagging this text as invalid javadoc tags

Change-Id: I09e090c6cc49366191f96d34bd51f6ba68cf18aa
Reviewed-on: https://gerrit.libreoffice.org/12524
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
index b4b9b4c..60f438c 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
@@ -2,7 +2,7 @@
  * Description: The description of generate-and-test behavior.
  *
  *
- * @ AuthorCreate/Modi Note
+ * Author  Create/Modi Note
  * Xiaofeng XieMay 17, 2004
  * Xiaofeng XieJul 01, 2008
  *
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 3e7b32e..c9879c0 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java

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

2014-09-02 Thread rbuj
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
 |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit bc796af28524841eb54ed68836a87ff85e62e2ac
Author: rbuj robert@gmail.com
Date:   Mon Sep 1 19:57:02 2014 +0200

nlpsolver: fix javadoc error: bad use of ''

Change-Id: Ibfaeef155982ce6eeefe8ef51eea9c2bddb12c46
Reviewed-on: https://gerrit.libreoffice.org/11244
Reviewed-by: Thomas Arnhold tho...@arnhold.org
Tested-by: Thomas Arnhold tho...@arnhold.org

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
index 81612dc..5ff9a35 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
@@ -29,16 +29,17 @@ public class EvalElement {
   /**
* The expected range of the response value, forms the following objective:
*
+   * pre
* NO minValue   maxValue : THE ELEMENT OF BasicBound
* 1  MINDOUBLE, MINDOUBLE: the minimize objective
* 2  MAXDOUBLE, MAXDOUBLE: the maximize objective
-   * 3  MINDOUBLE, v: the lessthan constraint  (v)
-   * 4  v, MAXDOUBLE: the largethan constraint (v)
+   * 3  MINDOUBLE, v: the lessthan constraint  {@literal (v)}
+   * 4  v, MAXDOUBLE: the largethan constraint {@literal (v)}
* 5  v1   , v2   : the region constraint, i.e. belongs to [v1, v2]
*
* OPTIM type: the No.1 and No.2
* CONS  type: the last three
-   *
+   * /pre
*/
   public BasicBound targetBound = new BasicBound();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-07 Thread Noel Grandin
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java 
 |  254 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
 |   72 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
  |  162 ++---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
  |  234 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/IEncodeEngine.java
|   48 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicArray.java
   |   62 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java
   |  186 +++---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicTag.java
 |   80 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/CompareValue.java
 |   40 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java
|   88 +--
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/IUpdateCycleEngine.java
   |   46 -
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
  |  246 
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/UnconstrainedProblemEncoder.java
 |   78 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
   |  282 +-
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/ILocationEngine.java
   |   50 -
 15 files changed, 964 insertions(+), 964 deletions(-)

New commits:
commit 414a6e4e0ce35ead40d2a0476f18fba1f746b7bf
Author: Noel Grandin n...@peralex.com
Date:   Thu Aug 7 11:37:32 2014 +0200

convert EvolutionarySolver source to unix LF

so I dont keep getting problems when moving patches between Windows
and Linux

Change-Id: Ia2323ecb388bf5996279686e1bd2b1676c5ae213

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 02043f5..3107fa8 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -1,127 +1,127 @@
-package net.adaptivebox.deps;
-
-/**
- * Description: The description of agent with hybrid differential evolution 
and particle swarm.
- *
- * @ AuthorCreate/Modi Note
- * Xiaofeng XieJun 10, 2004
- * Xiaofeng XieJul 01, 2008
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * Please acknowledge the author(s) if you use this code in any way.
- *
- * @version 1.0
- * @Since MAOS1.0
- *
- * @References:
- * [1] Zhang W J, Xie X F. DEPSO: hybrid particle swarm with differential
- * evolution operator. IEEE International Conference on Systems, Man  
Cybernetics,
- * Washington D C, USA, 2003: 3816-3821
- * [2] X F Xie, W J Zhang. SWAF: swarm algorithm framework for numerical
- * optimization. Genetic and Evolutionary Computation Conference (GECCO),
- * Seattle, WA, USA, 2004: 238-250
- * - an agent perspective
- */
-
-import net.adaptivebox.deps.behavior.*;
-import net.adaptivebox.goodness.IGoodnessCompareEngine;
-import net.adaptivebox.knowledge.*;
-import net.adaptivebox.problem.*;
-import net.adaptivebox.space.*;
-
-public class DEPSAgent implements ILibEngine {
-
-  //Describes the problem to be solved
-  protected ProblemEncoder problemEncoder;
-  //Forms the goodness landscape
-  protected IGoodnessCompareEngine qualityComparator;
-
-  //store the point that generated in current learning cycle
-  protected SearchPoint trailPoint;
-
-  //temp variable
-  private AbsGTBehavior selectGTBehavior;
-
-  //The referred library
-  protected Library socialLib;
-  //the own memory: store the point that generated in old learning cycle
-  protected BasicPoint pold_t;
-  //the own memory: store the point that generated in last learning cycle
-  protected BasicPoint pcurrent_t;
-  //the own memory: store the personal best point
-  protected SearchPoint pbest_t;
-
-  //Generate-and-test Behaviors
-  protected DEGTBehavior deGTBehavior;
-  protected PSGTBehavior psGTBehavior;
-  public double switchP = 0.5;
-
-  public 

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

2014-08-07 Thread rbuj
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
 |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit efbc5ac6cc4f8d7b57e4d24a70bae92fa0d22060
Author: rbuj robert@gmail.com
Date:   Thu Aug 7 14:19:04 2014 +0200

nlpsolver: Number parsing

Change-Id: I37a83b8e8c0f084ae175be5a5c58fc6b852e23a1
Reviewed-on: https://gerrit.libreoffice.org/10807
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
index 0a17c11..8d3436a 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
@@ -128,12 +128,12 @@ public class GlobalString {
 
   static public int toInteger(Object oVal) throws Exception {
 if(oVal==null) throw new Exception(Null string);
-return new Integer(oVal.toString()).intValue();
+return Integer.parseInt(oVal.toString());
   }
 
   static public double toDouble(Object oVal) throws Exception {
 if(oVal==null) throw new Exception(Null string);
-return new Double(oVal.toString()).doubleValue();
+return Double.parseDouble(oVal.toString());
   }
 
   public static Object toObject(String key) throws Exception{
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-07 Thread rbuj
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
 |4 +---
 
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
 |4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

New commits:
commit 90b4217e20af48e08352bdd6b478e7a8c59ee035
Author: rbuj robert@gmail.com
Date:   Thu Aug 7 14:06:11 2014 +0200

nlpsolver: Use System.arraycopy

Change-Id: I2550bf0799bd5ebc7f6ff299752fa90b7a31674d
Reviewed-on: https://gerrit.libreoffice.org/10806
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
index 0085ff7..c33d649 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
@@ -42,9 +42,7 @@ public class SearchPoint extends BasicPoint implements 
IEncodeEngine {
   }
 
   private void importEncodeInfo(double[] info) {
-for(int i=0; iencodeInfo.length; i++) {
-  encodeInfo[i] = info[i];
-}
+System.arraycopy(info, 0, encodeInfo, 0, encodeInfo.length);
   }
 
   private void importEncodeInfo(IEncodeEngine point) {
diff --git 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
index 48f4df4..35e2ac0 100644
--- 
a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
+++ 
b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java
@@ -131,9 +131,7 @@ public class DesignSpace {
 
   public double[] getRealLoc(double[] imageLoc) {
 double[] realLoc = new double[imageLoc.length];
-for (int i=0; iimageLoc.length; i++) {
-  realLoc[i] = imageLoc[i];
-}
+System.arraycopy(imageLoc, 0, realLoc, 0, imageLoc.length);
 annulusAdjust(realLoc);
 return realLoc;
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits