diff options
Diffstat (limited to 'nlpsolver')
4 files changed, 8 insertions, 12 deletions
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; |