summaryrefslogtreecommitdiff
path: root/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java')
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
index 58b7ab4c907d..c6a25e93c8f1 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java
@@ -34,11 +34,11 @@ import net.adaptivebox.space.DesignDim;
import net.adaptivebox.space.DesignSpace;
public abstract class ProblemEncoder {
- //Store the calculated results for the responses
- private final double[] tempResponseSet; //temp values
- private final double[] tempLocation; //temp values
+ // Store the calculated results for the responses
+ private final double[] tempResponseSet; // temp values
+ private final double[] tempLocation; // temp values
- //the search space (S)
+ // the search space (S)
private final DesignSpace designSpace;
// For evaluate the response vector into encoded vector double[2]
@@ -55,27 +55,27 @@ public abstract class ProblemEncoder {
return designSpace;
}
- //set the default information for each dimension of search space (S)
- protected void setDefaultXAt(int i, double min, double max, double grain) {
+ // set the default information for each dimension of search space (S)
+ protected void setDefaultXAt(int i, double min, double max, double grain) {
DesignDim dd = new DesignDim();
dd.grain = grain;
dd.paramBound = new BasicBound(min, max);
designSpace.setElemAt(dd, i);
}
- //set the default information for evaluation each response
- protected void setDefaultYAt(int i, double min, double max) {
+ // set the default information for evaluation each response
+ protected void setDefaultYAt(int i, double min, double max) {
EvalElement ee = new EvalElement();
ee.targetBound = new BasicBound(min, max);
evalStruct.setElemAt(ee, i);
}
- //get a fresh point
+ // get a fresh point
public SearchPoint getFreshSearchPoint() {
return new SearchPoint(designSpace.getDimension());
}
- //get an encoded point
+ // get an encoded point
public SearchPoint getEncodedSearchPoint() {
SearchPoint point = getFreshSearchPoint();
designSpace.initializeGene(point.getLocation());
@@ -83,26 +83,25 @@ public abstract class ProblemEncoder {
return point;
}
- //evaluate the point into encoded information
+ // evaluate the point into encoded information
public void evaluate(SearchPoint point) {
- //copy to temp point
+// copy to temp point
System.arraycopy(point.getLocation(), 0, this.tempLocation, 0, tempLocation.length);
- //mapping the temp point to original search space S
+// mapping the temp point to original search space S
designSpace.getMappingPoint(tempLocation);
- //calculate based on the temp point
+// calculate based on the temp point
calcTargets(tempResponseSet, tempLocation);
evalStruct.evaluate(point.getEncodeInfo(), tempResponseSet);
point.setObjectiveValue(tempResponseSet[0]);
}
- //calculate each response, must be implemented
+ // calculate each response, must be implemented
abstract protected double calcTargetAt(int index, double[] VX);
// calculate all the responses VY[] based on given point VX[]
private void calcTargets(double[] VY, double[] VX) {
- for(int i=0; i<VY.length; i++) {
+ for (int i = 0; i < VY.length; i++) {
VY[i] = calcTargetAt(i, VX);
}
}
}
-