diff options
author | Todor Balabanov <todor.balabanov@gmail.com> | 2021-06-16 11:16:40 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-17 20:41:37 +0200 |
commit | 72cd9250a80bc2db61b1f90217f2f7fdc0d51bcc (patch) | |
tree | 62c2d8757f5df2ad05626bce136caf15daac466f /nlpsolver | |
parent | 59611f7b6acbf643bde0e0121ee51e2df53e7d50 (diff) |
A separate function for getting a random search point is a little bit clearer.
Change-Id: I2d7471440cdee096b09ce704cbea3d5311f984c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117289
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'nlpsolver')
-rw-r--r-- | nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java | 2 | ||||
-rw-r--r-- | nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java | 4 |
2 files changed, 5 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 0e68f856d912..5dedc8052ec7 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java @@ -118,7 +118,7 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine { private SearchPoint[] getReferPoints() { SearchPoint[] referPoints = new SearchPoint[DVNum * 2]; for (int i = 0; i < referPoints.length; i++) { - referPoints[i] = socialLib.getSelectedPoint(RandomGenerator.intRangeRandom(0, socialLib.getPopSize() - 1)); + referPoints[i] = socialLib.getRandomPoint(); } return referPoints; } diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java index 247d4908c420..76e57ac76077 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java @@ -56,6 +56,10 @@ public class Library { return libPoints[index]; } + public SearchPoint getRandomPoint() { + return libPoints[RandomGenerator.intRangeRandom(0, libPoints.length - 1)]; + } + public static boolean replace(IGoodnessCompareEngine comparator, SearchPoint outPoint, SearchPoint tobeReplacedPoint) { boolean isBetter = false; |