summaryrefslogtreecommitdiff
path: root/nlpsolver
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-18 10:01:21 +0200
committerNoel Grandin <noel@peralex.com>2014-11-18 12:44:28 +0200
commit0063cf285696951e336b9cec1da8881997b286ce (patch)
treebe70dfd8127c35f9e4a6d18d4db459a587813bf4 /nlpsolver
parent250391009aec9930abcc57930ddd4b6f56f4df9c (diff)
java: make fields final where possible
found by PMD Change-Id: I87780366119c141cd2dafe6ca1bf2d9798b10aec
Diffstat (limited to 'nlpsolver')
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java2
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java2
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java16
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java2
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java2
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java8
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java4
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java2
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java20
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java14
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java24
11 files changed, 48 insertions, 48 deletions
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 c9879c099e61..c40f2c1ec258 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/behavior/DEGTBehavior.java
@@ -35,7 +35,7 @@ import net.adaptivebox.problem.*;
import net.adaptivebox.space.*;
public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
- private int DVNum = 2; //Number of differential vectors, normally be 1 or 2
+ private final 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
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
index b61046d34d92..1ad1adefd08c 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/encode/EvalElement.java
@@ -25,7 +25,7 @@ import net.adaptivebox.global.*;
public class EvalElement {
//The weight for each response (target)
- private double weight = 1;
+ private final double weight = 1;
/**
* The expected range of the response value, forms the following objective:
*
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
index ae8d4d130f8c..2d9f55fc2ac4 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/goodness/ACRComparator.java
@@ -36,18 +36,18 @@ import net.adaptivebox.global.*;
public class ACRComparator implements IGoodnessCompareEngine, IUpdateCycleEngine {
- private Library socialPool;
+ private final Library socialPool;
private double epsilon_t = 0;
- private double RU = 0.75;
- private double RL = 0.25;
- private double BETAF = 0.618;
- private double BETAL = 0.618;
- private double BETAU = 1.382;
+ private final double RU = 0.75;
+ private final double RL = 0.25;
+ private final double BETAF = 0.618;
+ private final double BETAL = 0.618;
+ private final double BETAU = 1.382;
- private double T = -1;
+ private final double T;
- private double TthR = 0.5;
+ private final double TthR = 0.5;
public ACRComparator(Library lib, int T) {
socialPool = lib;
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
index 6b6574bcc081..d4c202c989fc 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/Library.java
@@ -29,7 +29,7 @@ import net.adaptivebox.goodness.*;
import net.adaptivebox.problem.*;
public class Library {
- private SearchPoint[] libPoints = new SearchPoint[0];
+ private final SearchPoint[] libPoints;
private int gIndex = -1;
public Library(SearchPoint[] points){
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
index ea37e1e5cd0b..dbd472f043e3 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java
@@ -27,7 +27,7 @@ public class SearchPoint extends BasicPoint implements IEncodeEngine {
//store the encode information for goodness evaluation
//encodeInfo[0]: the sum of constraints (if it equals to 0, then be a feasible point)
//encodeInfo[1]: the value of objective function
- private double[] encodeInfo = new double[2];
+ private final double[] encodeInfo = new double[2];
private double objectiveValue;
public SearchPoint(int dim) {
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
index 603648e8428d..bc32c1c8d78b 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
@@ -33,14 +33,14 @@ import net.adaptivebox.knowledge.*;
public abstract class ProblemEncoder {
//Store the calculated results for the responses
- private double[] tempResponseSet; //temp values
- private double[] tempLocation; //temp values
+ private final double[] tempResponseSet; //temp values
+ private final double[] tempLocation; //temp values
//the search space (S)
- private DesignSpace designSpace = null;
+ private final DesignSpace designSpace;
// For evaluate the response vector into encoded vector double[2]
- private EvalStruct evalStruct = null;
+ private final EvalStruct evalStruct;
protected ProblemEncoder(int paramNum, int targetNum) throws Exception {
designSpace = new DesignSpace(paramNum);
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java
index 2bebff6f7fda..b473ae0a3807 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/sco/SCAgent.java
@@ -48,9 +48,9 @@ public class SCAgent {
private IGoodnessCompareEngine specComparator;
//the coefficients of SCAgent
- private int TaoB = 2;
+ private final int TaoB = 2;
//The early version set TaoW as the size of external library (NL), but 4 is often enough
- private int TaoW = 4;
+ private final int TaoW = 4;
//The referred external library
private Library externalLib;
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
index 1cf1b8592a44..a590a69742f7 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
@@ -22,7 +22,7 @@ package net.adaptivebox.space;
public class BasicPoint implements Cloneable, ILocationEngine {
//store the location information in the search space (S)
- private double[] location;
+ private final double[] location;
public BasicPoint(int dim) {
location = new double[dim];
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
index 9d779afe7225..2d93dca6e4bf 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java
@@ -61,8 +61,8 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
}
private class Variable {
- private CellMap CellMap;
- private int OriginalVariable;
+ private final CellMap CellMap;
+ private final int OriginalVariable;
private double MinValue;
private double MaxValue;
private double Granularity;
@@ -78,8 +78,8 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
private class CalcProblemEncoder extends ProblemEncoder {
- private ArrayList<Variable> m_variables;
- private ArrayList<ExtSolverConstraint> m_constraints;
+ private final ArrayList<Variable> m_variables;
+ private final ArrayList<ExtSolverConstraint> m_constraints;
private CalcProblemEncoder(ArrayList<Variable> variables,
ArrayList<ExtSolverConstraint> constraints) throws Exception {
@@ -152,19 +152,19 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
protected double m_toleratedMin;
protected double m_toleratedMax;
- private ArrayList<Variable> m_variables = new ArrayList<Variable>();
+ private final ArrayList<Variable> m_variables = new ArrayList<Variable>();
//properties
protected PropertyInfo<Integer> m_swarmSize = new PropertyInfo<Integer>("SwarmSize", 70, "Size of Swam");
protected PropertyInfo<Integer> m_librarySize = new PropertyInfo<Integer>("LibrarySize", 210, "Size of Library");
protected PropertyInfo<Integer> m_learningCycles = new PropertyInfo<Integer>("LearningCycles", 2000, "Learning Cycles");
- private PropertyInfo<Boolean> m_guessVariableRange = new PropertyInfo<Boolean>("GuessVariableRange", true, "Variable Bounds Guessing");
- private PropertyInfo<Double> m_variableRangeThreshold = new PropertyInfo<Double>("VariableRangeThreshold", 3.0, "Variable Bounds Threshold (when guessing)"); //to approximate the variable bounds
- private PropertyInfo<Boolean> m_useACRComperator = new PropertyInfo<Boolean>("UseACRComparator", false, "Use ACR Comparator (instead of BCH)");
- private PropertyInfo<Boolean> m_useRandomStartingPoint = new PropertyInfo<Boolean>("UseRandomStartingPoint", false, "Use Random starting point");
+ private final PropertyInfo<Boolean> m_guessVariableRange = new PropertyInfo<Boolean>("GuessVariableRange", true, "Variable Bounds Guessing");
+ private final PropertyInfo<Double> m_variableRangeThreshold = new PropertyInfo<Double>("VariableRangeThreshold", 3.0, "Variable Bounds Threshold (when guessing)"); //to approximate the variable bounds
+ private final PropertyInfo<Boolean> m_useACRComperator = new PropertyInfo<Boolean>("UseACRComparator", false, "Use ACR Comparator (instead of BCH)");
+ private final PropertyInfo<Boolean> m_useRandomStartingPoint = new PropertyInfo<Boolean>("UseRandomStartingPoint", false, "Use Random starting point");
protected PropertyInfo<Integer> m_required = new PropertyInfo<Integer>("StagnationLimit", 70, "Stagnation Limit");
protected PropertyInfo<Double> m_tolerance = new PropertyInfo<Double>("Tolerance", 1e-6, "Stagnation Tolerance");
- private PropertyInfo<Boolean> m_enhancedSolverStatus = new PropertyInfo<Boolean>("EnhancedSolverStatus", true, "Show enhanced solver status");
+ private final PropertyInfo<Boolean> m_enhancedSolverStatus = new PropertyInfo<Boolean>("EnhancedSolverStatus", true, "Show enhanced solver status");
protected IEvolutionarySolverStatusDialog m_solverStatusDialog;
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 f7fc741fc6bf..716a79b79438 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
@@ -100,15 +100,15 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
return m_serviceNames;
}
- private PropertyInfo<Double> m_agentSwitchRate = new PropertyInfo<Double>("AgentSwitchRate", 0.5, "Agent Switch Rate (DE Probability)");
+ private final 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)");
- private PropertyInfo<Double> m_CR = new PropertyInfo<Double>("DECR", 0.9, "DE: Crossover Probability (0-1)");
+ private final PropertyInfo<Double> m_factor = new PropertyInfo<Double>("DEFactor", 0.5, "DE: Scaling Factor (0-1.2)");
+ private final PropertyInfo<Double> m_CR = new PropertyInfo<Double>("DECR", 0.9, "DE: Crossover Probability (0-1)");
// --PS
- private PropertyInfo<Double> m_c1 = new PropertyInfo<Double>("PSC1", 1.494, "PS: Cognitive Constant");
- private PropertyInfo<Double> m_c2 = new PropertyInfo<Double>("PSC2", 1.494, "PS: Social Constant");
- private PropertyInfo<Double> m_weight = new PropertyInfo<Double>("PSWeight", 0.729, "PS: Constriction Coefficient");
- private PropertyInfo<Double> m_CL = new PropertyInfo<Double>("PSCL", 0.0, "PS: Mutation Probability (0-0.005)");
+ private final PropertyInfo<Double> m_c1 = new PropertyInfo<Double>("PSC1", 1.494, "PS: Cognitive Constant");
+ private final PropertyInfo<Double> m_c2 = new PropertyInfo<Double>("PSC2", 1.494, "PS: Social Constant");
+ private final PropertyInfo<Double> m_weight = new PropertyInfo<Double>("PSWeight", 0.729, "PS: Constriction Coefficient");
+ private final PropertyInfo<Double> m_CL = new PropertyInfo<Double>("PSCL", 0.0, "PS: Mutation Probability (0-0.005)");
public void solve() {
try {
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java
index cd3dc0c3c7cb..da8dbb22e997 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java
@@ -45,18 +45,18 @@ public class EvolutionarySolverStatusUno extends BaseDialog
XActionListener {
private int userState;
- private Label lblSolutionValue;
- private Label lblIteration;
- private ProgressBar pbIteration;
- private Label lblIterationValue;
- private Label lblStagnation;
- private ProgressBar pbStagnation;
- private Label lblStagnationValue;
- private Label lblRuntimeValue;
- private Button btnStop;
- private Button btnOK;
- private Button btnContinue;
- private int defaultTextColor;
+ private final Label lblSolutionValue;
+ private final Label lblIteration;
+ private final ProgressBar pbIteration;
+ private final Label lblIterationValue;
+ private final Label lblStagnation;
+ private final ProgressBar pbStagnation;
+ private final Label lblStagnationValue;
+ private final Label lblRuntimeValue;
+ private final Button btnStop;
+ private final Button btnOK;
+ private final Button btnContinue;
+ private final int defaultTextColor;
private int maxIterations;
private int maxStagnation;