summaryrefslogtreecommitdiff
path: root/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps
diff options
context:
space:
mode:
Diffstat (limited to 'nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps')
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java254
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java72
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java162
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java234
4 files changed, 361 insertions, 361 deletions
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index 02043f5b89f2..3107fa8deff1 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.
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie Jun 10, 2004
- * Xiaofeng Xie Jul 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 void setLibrary(Library lib) {
- socialLib = lib;
- deGTBehavior.setLibrary(socialLib);
- psGTBehavior.setLibrary(socialLib);
- }
-
- public void setProblemEncoder(ProblemEncoder encoder) {
- problemEncoder = encoder;
- trailPoint = problemEncoder.getFreshSearchPoint();
- pold_t = problemEncoder.getFreshSearchPoint();
- pcurrent_t = problemEncoder.getFreshSearchPoint();
- }
-
- public void setSpecComparator(IGoodnessCompareEngine comparer) {
- qualityComparator = comparer;
- }
-
- public void setPbest(SearchPoint pbest) {
- pbest_t = pbest;
- }
-
- protected AbsGTBehavior getGTBehavior() {
- if (Math.random()<switchP) {
- return deGTBehavior;
- } else {
- return psGTBehavior;
- }
- }
-
- 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;
- }
- }
-
- public void generatePoint() {
- // 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
- problemEncoder.evaluate(trailPoint);
- }
-
- public void learn() {
- selectGTBehavior.testBehavior(trailPoint, qualityComparator);
- }
-
- public SearchPoint getMGState() {
- return trailPoint;
- }
-}
-
+package net.adaptivebox.deps;
+
+/**
+ * Description: The description of agent with hybrid differential evolution and particle swarm.
+ *
+ * @ Author Create/Modi Note
+ * Xiaofeng Xie Jun 10, 2004
+ * Xiaofeng Xie Jul 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 void setLibrary(Library lib) {
+ socialLib = lib;
+ deGTBehavior.setLibrary(socialLib);
+ psGTBehavior.setLibrary(socialLib);
+ }
+
+ public void setProblemEncoder(ProblemEncoder encoder) {
+ problemEncoder = encoder;
+ trailPoint = problemEncoder.getFreshSearchPoint();
+ pold_t = problemEncoder.getFreshSearchPoint();
+ pcurrent_t = problemEncoder.getFreshSearchPoint();
+ }
+
+ public void setSpecComparator(IGoodnessCompareEngine comparer) {
+ qualityComparator = comparer;
+ }
+
+ public void setPbest(SearchPoint pbest) {
+ pbest_t = pbest;
+ }
+
+ protected AbsGTBehavior getGTBehavior() {
+ if (Math.random()<switchP) {
+ return deGTBehavior;
+ } else {
+ return psGTBehavior;
+ }
+ }
+
+ 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;
+ }
+ }
+
+ public void generatePoint() {
+ // 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
+ problemEncoder.evaluate(trailPoint);
+ }
+
+ public void learn() {
+ selectGTBehavior.testBehavior(trailPoint, qualityComparator);
+ }
+
+ public SearchPoint getMGState() {
+ return trailPoint;
+ }
+}
+
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 159ce7c73328..b4b9b4ca6a5e 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/AbsGTBehavior.java
@@ -1,36 +1,36 @@
-/**
- * Description: The description of generate-and-test behavior.
- *
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie May 17, 2004
- * Xiaofeng Xie Jul 01, 2008
- *
- * @version 1.0
- * @Since MAOS1.0
- *
- * @References:
- * [1] 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
- * -> a generate-and-test behavior
- */
-package net.adaptivebox.deps.behavior;
-
-import net.adaptivebox.goodness.*;
-import net.adaptivebox.knowledge.*;
-import net.adaptivebox.problem.*;
-
-abstract public class AbsGTBehavior {
- //The referred social library
- protected Library socialLib;
-
- public void setLibrary(Library lib) {
- socialLib = lib;
- }
-
- abstract public void generateBehavior(SearchPoint trailPoint, ProblemEncoder problemEncoder);
-
- abstract public void testBehavior(SearchPoint trailPoint, IGoodnessCompareEngine qualityComparator);
-}
-
+/**
+ * Description: The description of generate-and-test behavior.
+ *
+ *
+ * @ Author Create/Modi Note
+ * Xiaofeng Xie May 17, 2004
+ * Xiaofeng Xie Jul 01, 2008
+ *
+ * @version 1.0
+ * @Since MAOS1.0
+ *
+ * @References:
+ * [1] 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
+ * -> a generate-and-test behavior
+ */
+package net.adaptivebox.deps.behavior;
+
+import net.adaptivebox.goodness.*;
+import net.adaptivebox.knowledge.*;
+import net.adaptivebox.problem.*;
+
+abstract public class AbsGTBehavior {
+ //The referred social library
+ protected Library socialLib;
+
+ public void setLibrary(Library lib) {
+ socialLib = lib;
+ }
+
+ 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 50666ff4f8f5..7867fdb49db2 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -1,81 +1,81 @@
-/**
- * Description: The description of differential evolution Generate-and-Test Behavior.
-
- #Supported parameters:
- NAME VALUE_type Range DefaultV Description
- FACTOR real (0, 1.2] 0.5 DEAgent: scale constant
- CR real [0, 1] 0.9 DEAgent: crossover constant
- //Other choices for FACTOR and CR: (0.5, 0.1)
-
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie May 11, 2004
- * Xiaofeng Xie Jul 01, 2008
- *
- * @version 1.0
- * @Since MAOS1.0
- *
- * @References:
- * [1] Storn R, Price K. Differential evolution - a simple and efficient
- * heuristic for global optimization over continuous spaces. Journal of
- * Global Optimization, 1997, 11: 341-359
- * @ The original differential evolution idea
- * [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
- * -> a generate-and-test behavior
- */
-
-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.*;
-
-public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
- public 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
-
- //the own memory: store the point that generated in last learning cycle
- protected SearchPoint pbest_t;
-
- public void setPbest(SearchPoint pbest) {
- pbest_t = pbest;
- }
-
- 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; k<DIMENSION; k++) {
- 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];
- }
- trailPoint.getLocation()[rj] = gbest_t.getLocation()[rj]+FACTOR*Dabcd;
- } else {
- trailPoint.getLocation()[rj] = pbest_t.getLocation()[rj];
- }
- rj = (rj+1)%DIMENSION;
- }
- }
-
- public void testBehavior(SearchPoint trailPoint, IGoodnessCompareEngine qualityComparator) {
- Library.replace(qualityComparator, trailPoint, pbest_t);
- }
-
- protected 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));
- }
- return referPoints;
- }
-}
-
+/**
+ * Description: The description of differential evolution Generate-and-Test Behavior.
+
+ #Supported parameters:
+ NAME VALUE_type Range DefaultV Description
+ FACTOR real (0, 1.2] 0.5 DEAgent: scale constant
+ CR real [0, 1] 0.9 DEAgent: crossover constant
+ //Other choices for FACTOR and CR: (0.5, 0.1)
+
+ *
+ * @ Author Create/Modi Note
+ * Xiaofeng Xie May 11, 2004
+ * Xiaofeng Xie Jul 01, 2008
+ *
+ * @version 1.0
+ * @Since MAOS1.0
+ *
+ * @References:
+ * [1] Storn R, Price K. Differential evolution - a simple and efficient
+ * heuristic for global optimization over continuous spaces. Journal of
+ * Global Optimization, 1997, 11: 341-359
+ * @ The original differential evolution idea
+ * [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
+ * -> a generate-and-test behavior
+ */
+
+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.*;
+
+public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
+ public 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
+
+ //the own memory: store the point that generated in last learning cycle
+ protected SearchPoint pbest_t;
+
+ public void setPbest(SearchPoint pbest) {
+ pbest_t = pbest;
+ }
+
+ 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; k<DIMENSION; k++) {
+ 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];
+ }
+ trailPoint.getLocation()[rj] = gbest_t.getLocation()[rj]+FACTOR*Dabcd;
+ } else {
+ trailPoint.getLocation()[rj] = pbest_t.getLocation()[rj];
+ }
+ rj = (rj+1)%DIMENSION;
+ }
+ }
+
+ public void testBehavior(SearchPoint trailPoint, IGoodnessCompareEngine qualityComparator) {
+ Library.replace(qualityComparator, trailPoint, pbest_t);
+ }
+
+ protected 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));
+ }
+ return referPoints;
+ }
+}
+
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 b4ae0017eb69..c1e8db0123ae 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/PSGTBehavior.java
@@ -1,117 +1,117 @@
-/**
- * Description: The description of particle swarm (PS) Generate-and-test Behavior.
- *
- #Supported parameters:
- NAME VALUE_type Range DefaultV Description
- c1 real [0, 2] 1.494 PSAgent: learning factor for pbest
- c2 real [0, 2] 1.494 PSAgent: learning factor for gbest
- w real [0, 1] 0.729 PSAgent: inertia weight
- CL real [0, 0.1] 0 PSAgent: chaos factor
- //Other choices for c1, c2, w, and CL: (2, 2, 0.4, 0.001)
-
- * @ Author Create/Modi Note
- * Xiaofeng Xie May 11, 2004
- * Xiaofeng Xie Jul 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] Kennedy J, Eberhart R C. Particle swarm optimization. IEEE Int. Conf. on
- * Neural Networks, Perth, Australia, 1995: 1942-1948
- * @ For original particle swarm idea
- * [2] Shi Y H, Eberhart R C. A Modified Particle Swarm Optimizer. IEEE Inter. Conf.
- * on Evolutionary Computation, Anchorage, Alaska, 1998: 69-73
- * @ For the inertia weight: adjust the trade-off between exploitation & exploration
- * [3] Clerc M, Kennedy J. The particle swarm - explosion, stability, and
- * convergence in a multidimensional complex space. IEEE Trans. on Evolutionary
- * Computation. 2002, 6 (1): 58-73
- * @ Constriction factor: ensures the convergence
- * [4] Xie X F, Zhang W J, Yang Z L. A dissipative particle swarm optimization.
- * Congress on Evolutionary Computation, Hawaii, USA, 2002: 1456-1461
- * @ The CL parameter
- * [5] Xie X F, Zhang W J, Bi D C. Optimizing semiconductor devices by self-
- * organizing particle swarm. Congress on Evolutionary Computation, Oregon, USA,
- * 2004: 2017-2022
- * @ Further experimental analysis on the convergence of PSO
- * [6] 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
- * -> a generate-and-test behavior
- *
- */
-
-package net.adaptivebox.deps.behavior;
-
-import net.adaptivebox.goodness.*;
-import net.adaptivebox.knowledge.*;
-import net.adaptivebox.problem.*;
-import net.adaptivebox.space.*;
-
-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])
- 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
-
- //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;
-
- public void setMemPoints(SearchPoint pbest, BasicPoint pcurrent, BasicPoint pold) {
- pcurrent_t = pcurrent;
- pbest_t = pbest;
- pold_t = pold;
- }
-
- public void generateBehavior(SearchPoint trailPoint, ProblemEncoder problemEncoder) {
- SearchPoint gbest_t = socialLib.getGbest();
- DesignSpace designSpace = problemEncoder.getDesignSpace();
- 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;
- }
- }
- }
-
- public void testBehavior(SearchPoint trailPoint, IGoodnessCompareEngine qualityComparator) {
- Library.replace(qualityComparator, trailPoint, pbest_t);
- pold_t.importLocation(pcurrent_t);
- pcurrent_t.importLocation(trailPoint);
- }
-
-}
-
+/**
+ * Description: The description of particle swarm (PS) Generate-and-test Behavior.
+ *
+ #Supported parameters:
+ NAME VALUE_type Range DefaultV Description
+ c1 real [0, 2] 1.494 PSAgent: learning factor for pbest
+ c2 real [0, 2] 1.494 PSAgent: learning factor for gbest
+ w real [0, 1] 0.729 PSAgent: inertia weight
+ CL real [0, 0.1] 0 PSAgent: chaos factor
+ //Other choices for c1, c2, w, and CL: (2, 2, 0.4, 0.001)
+
+ * @ Author Create/Modi Note
+ * Xiaofeng Xie May 11, 2004
+ * Xiaofeng Xie Jul 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] Kennedy J, Eberhart R C. Particle swarm optimization. IEEE Int. Conf. on
+ * Neural Networks, Perth, Australia, 1995: 1942-1948
+ * @ For original particle swarm idea
+ * [2] Shi Y H, Eberhart R C. A Modified Particle Swarm Optimizer. IEEE Inter. Conf.
+ * on Evolutionary Computation, Anchorage, Alaska, 1998: 69-73
+ * @ For the inertia weight: adjust the trade-off between exploitation & exploration
+ * [3] Clerc M, Kennedy J. The particle swarm - explosion, stability, and
+ * convergence in a multidimensional complex space. IEEE Trans. on Evolutionary
+ * Computation. 2002, 6 (1): 58-73
+ * @ Constriction factor: ensures the convergence
+ * [4] Xie X F, Zhang W J, Yang Z L. A dissipative particle swarm optimization.
+ * Congress on Evolutionary Computation, Hawaii, USA, 2002: 1456-1461
+ * @ The CL parameter
+ * [5] Xie X F, Zhang W J, Bi D C. Optimizing semiconductor devices by self-
+ * organizing particle swarm. Congress on Evolutionary Computation, Oregon, USA,
+ * 2004: 2017-2022
+ * @ Further experimental analysis on the convergence of PSO
+ * [6] 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
+ * -> a generate-and-test behavior
+ *
+ */
+
+package net.adaptivebox.deps.behavior;
+
+import net.adaptivebox.goodness.*;
+import net.adaptivebox.knowledge.*;
+import net.adaptivebox.problem.*;
+import net.adaptivebox.space.*;
+
+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])
+ 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
+
+ //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;
+
+ public void setMemPoints(SearchPoint pbest, BasicPoint pcurrent, BasicPoint pold) {
+ pcurrent_t = pcurrent;
+ pbest_t = pbest;
+ pold_t = pold;
+ }
+
+ public void generateBehavior(SearchPoint trailPoint, ProblemEncoder problemEncoder) {
+ SearchPoint gbest_t = socialLib.getGbest();
+ DesignSpace designSpace = problemEncoder.getDesignSpace();
+ 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;
+ }
+ }
+ }
+
+ public void testBehavior(SearchPoint trailPoint, IGoodnessCompareEngine qualityComparator) {
+ Library.replace(qualityComparator, trailPoint, pbest_t);
+ pold_t.importLocation(pcurrent_t);
+ pcurrent_t.importLocation(trailPoint);
+ }
+
+}
+