[Libreoffice-commits] core.git: nlpsolver/src nlpsolver/ThirdParty

Todor Balabanov (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 17 20:22:51 UTC 2021


 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java |   33 +++-------
 nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java              |    4 -
 2 files changed, 14 insertions(+), 23 deletions(-)

New commits:
commit 7b93bae224c7c2c49b105ef97304bb46f8b68da5
Author:     Todor Balabanov <todor.balabanov at gmail.com>
AuthorDate: Sat Jul 17 18:27:27 2021 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 17 22:22:17 2021 +0200

    Some lower objects coupling.
    
    Change-Id: I0a7c658d830f82d627d20b9ed7000f3c5b8f1f89
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119105
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
index b3e5f310031f..7a6077a725c4 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java
@@ -38,7 +38,6 @@ import net.adaptivebox.deps.behavior.PSGTBehavior;
 import net.adaptivebox.global.RandomGenerator;
 import net.adaptivebox.goodness.IGoodnessCompareEngine;
 import net.adaptivebox.knowledge.ILibEngine;
-import net.adaptivebox.knowledge.Library;
 import net.adaptivebox.knowledge.SearchPoint;
 import net.adaptivebox.problem.ProblemEncoder;
 import net.adaptivebox.space.BasicPoint;
@@ -72,31 +71,21 @@ public class DEPSAgent implements ILibEngine {
 
   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);
-    psGTBehavior.setLibrary(lib);
-  }
-
-  public void setProblemEncoder(ProblemEncoder encoder) {
+  public DEPSAgent(ProblemEncoder encoder, DEGTBehavior deGTBehavior, PSGTBehavior psGTBehavior, double switchP, IGoodnessCompareEngine comparer) {
     problemEncoder = encoder;
+
     trailPoint = problemEncoder.getFreshSearchPoint();
     pold_t = problemEncoder.getFreshSearchPoint();
     pcurrent_t = problemEncoder.getFreshSearchPoint();
+
+    this.switchP = switchP;
+
+    setGTBehavior(deGTBehavior);
+    setGTBehavior(psGTBehavior);
+    this.deGTBehavior = deGTBehavior;
+    this.psGTBehavior = psGTBehavior;
+
+    qualityComparator = comparer;
   }
 
   public void setSpecComparator(IGoodnessCompareEngine comparer) {
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
index 20cf9286e91a..edba08936d39 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
@@ -131,14 +131,16 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
             deGTBehavior.MIN_FACTOR = Math.min(m_minFactor.getValue(), m_maxFactor.getValue());
             deGTBehavior.MAX_FACTOR = Math.max(m_minFactor.getValue(), m_maxFactor.getValue());
             deGTBehavior.CR = m_CR.getValue();
+            deGTBehavior.setLibrary(m_library);
 
             PSGTBehavior psGTBehavior = new PSGTBehavior();
             psGTBehavior.c1 = m_c1.getValue();
             psGTBehavior.c2 = m_c2.getValue();
             psGTBehavior.CL = m_CL.getValue();
             psGTBehavior.weight = m_weight.getValue();
+            psGTBehavior.setLibrary(m_library);
 
-            agents[i] = new DEPSAgent(m_problemEncoder, deGTBehavior, psGTBehavior, m_agentSwitchRate.getValue(), m_specCompareEngine, m_library);
+            agents[i] = new DEPSAgent(m_problemEncoder, deGTBehavior, psGTBehavior, m_agentSwitchRate.getValue(), m_specCompareEngine);
             agents[i].setPbest(m_library.getSelectedPoint(i));
         }
 


More information about the Libreoffice-commits mailing list