summaryrefslogtreecommitdiffstats
path: root/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-12 09:55:57 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-11-12 11:03:29 +0000
commitbb437029c1e5331bcc3f8fb2fc87837142a52f33 (patch)
tree56bde4059792a5284e90ae3b10ee4388cc913a54 /nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
parentfdo#80651 replaced oxygen icon and added new tango icon for single page (diff)
downloadcore-bb437029c1e5331bcc3f8fb2fc87837142a52f33.tar.gz
core-bb437029c1e5331bcc3f8fb2fc87837142a52f33.zip
java: convert fields to local variables where possible
found by PMD Change-Id: I05b45382b8fb1b734657ce9421a20e6ef6fbe542 Reviewed-on: https://gerrit.libreoffice.org/12376 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java')
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java27
1 files changed, 12 insertions, 15 deletions
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 523ae209ca9a..f7fc741fc6bf 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
@@ -100,9 +100,6 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
return m_serviceNames;
}
- // com.sun.star.sheet.XSolver:
- private DEPSAgent[] m_agents;
-
private PropertyInfo<Double> m_agentSwitchRate = new PropertyInfo<Double>("AgentSwitchRate", 0.5, "Agent Switch Rate (DE Probability)");
// --DE
private PropertyInfo<Double> m_factor = new PropertyInfo<Double>("DEFactor", 0.5, "DE: Scaling Factor (0-1.2)");
@@ -122,11 +119,11 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
initializeSolve();
//Init:
- m_agents = new DEPSAgent[m_swarmSize.getValue()];
+ DEPSAgent[] agents = new DEPSAgent[m_swarmSize.getValue()];
for (int i = 0; i < m_swarmSize.getValue(); i++) {
- m_agents[i] = new DEPSAgent();
- m_agents[i].setProblemEncoder(m_problemEncoder);
- m_agents[i].setPbest(m_library.getSelectedPoint(i));
+ agents[i] = new DEPSAgent();
+ agents[i].setProblemEncoder(m_problemEncoder);
+ agents[i].setPbest(m_library.getSelectedPoint(i));
DEGTBehavior deGTBehavior = new DEGTBehavior();
deGTBehavior.FACTOR = m_factor.getValue();
@@ -138,12 +135,12 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
psGTBehavior.CL = m_CL.getValue();
psGTBehavior.weight = m_weight.getValue();
- m_agents[i].switchP = m_agentSwitchRate.getValue();
- m_agents[i].setGTBehavior(deGTBehavior);
- m_agents[i].setGTBehavior(psGTBehavior);
+ agents[i].switchP = m_agentSwitchRate.getValue();
+ agents[i].setGTBehavior(deGTBehavior);
+ agents[i].setGTBehavior(psGTBehavior);
- m_agents[i].setSpecComparator(m_specCompareEngine);
- m_agents[i].setLibrary(m_library);
+ agents[i].setSpecComparator(m_specCompareEngine);
+ agents[i].setLibrary(m_library);
}
//Learn:
@@ -170,13 +167,13 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
m_library.refreshGbest(m_specCompareEngine);
for (int i = 0; i < m_swarmSize.getValue(); i++)
- m_agents[i].generatePoint();
+ agents[i].generatePoint();
for (int i = 0; i < m_swarmSize.getValue(); i++)
- m_agents[i].learn();
+ agents[i].learn();
for (int i = 0; i < m_swarmSize.getValue(); i++) {
- SearchPoint agentPoint = m_agents[i].getMGState();
+ SearchPoint agentPoint = agents[i].getMGState();
boolean inRange = (agentPoint.getObjectiveValue() >= m_toleratedMin && agentPoint.getObjectiveValue() <= m_toleratedMax);
if (Library.replace(m_envCompareEngine, agentPoint, m_totalBestPoint)) {
m_solverStatusDialog.setBestSolution(m_totalBestPoint.getObjectiveValue(), m_totalBestPoint.isFeasible());