From a71caa79c8eb09ff0374cdaf4b081ba42d1330a1 Mon Sep 17 00:00:00 2001 From: Todor Balabanov Date: Mon, 12 Jul 2021 19:13:32 +0300 Subject: Object initialization is done via a constructor with parameters. Change-Id: I66e87f7c898efb1f2c6b1d31fbd5654244e3ea82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118785 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../src/net/adaptivebox/deps/DEPSAgent.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'nlpsolver/ThirdParty/EvolutionarySolver') diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java index adc6a75bd4f4..b3e5f310031f 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java @@ -69,7 +69,23 @@ public class DEPSAgent implements ILibEngine { // Generate-and-test behaviors. private DEGTBehavior deGTBehavior; private PSGTBehavior psGTBehavior; - public double switchP = 0.5; + + private double switchP = 0.5; + + public DEPSAgent(ProblemEncoder encoder, DEGTBehavior deGTBehavior, PSGTBehavior psGTBehavior, double switchP, IGoodnessCompareEngine comparer, Library lib) { + setProblemEncoder(encoder); + + this.switchP = switchP; + + deGTBehavior.setLibrary(lib); + psGTBehavior.setLibrary(lib); + setGTBehavior(deGTBehavior); + setGTBehavior(psGTBehavior); + this.deGTBehavior = deGTBehavior; + this.psGTBehavior = psGTBehavior; + + qualityComparator = comparer; + } public void setLibrary(Library lib) { deGTBehavior.setLibrary(lib); @@ -101,17 +117,6 @@ 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() { -- cgit