summaryrefslogtreecommitdiff
path: root/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
diff options
context:
space:
mode:
authorTodor Balabanov <todor.balabanov@gmail.com>2019-05-13 14:29:17 +0300
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-05-17 08:45:46 +0200
commit5ee453818c88f0a73ca2863a80c6b901feed1837 (patch)
treeb95833b4759506c6dfa71164da37ec3e24c8cfd6 /nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
parentacd4625f2f1bf418452ffdafeac1b83fe1b2acde (diff)
Some additional manual formatting.
Change-Id: Ie5590535d013aa2f747dd034fa2fcd2ae5c3956b Reviewed-on: https://gerrit.libreoffice.org/72226 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java')
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java19
1 files changed, 11 insertions, 8 deletions
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
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
@@ -64,20 +64,23 @@ import net.adaptivebox.space.DesignSpace;
public class PSGTBehavior extends AbsGTBehavior {
// 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])
+ // 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 weight
- public double CL = 0; // See ref[4], normally be 0.001~0.005
+ //inertia weight
+ public double weight = 0.4;
+
+ //See ref[4], normally be 0.001~0.005
+ public double CL = 0;
// 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;
@@ -100,7 +103,8 @@ public class PSGTBehavior extends AbsGTBehavior {
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
+
+ // limitation for delta_x
deltaxbm = 0.5 * designSpace.getMagnitudeIn(b);
if (deltaxb < -deltaxbm) {
deltaxb = -deltaxbm;
@@ -118,5 +122,4 @@ public class PSGTBehavior extends AbsGTBehavior {
pold_t.importLocation(pcurrent_t);
pcurrent_t.importLocation(trailPoint);
}
-
}