diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-07 11:37:32 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-07 11:38:47 +0200 |
commit | 414a6e4e0ce35ead40d2a0476f18fba1f746b7bf (patch) | |
tree | 9a12419eea56ea20fc720186815e645c20752bee /nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem | |
parent | fdo#82151 fixup (diff) | |
download | core-414a6e4e0ce35ead40d2a0476f18fba1f746b7bf.tar.gz core-414a6e4e0ce35ead40d2a0476f18fba1f746b7bf.zip |
convert EvolutionarySolver source to unix LF
so I dont keep getting problems when moving patches between Windows
and Linux
Change-Id: Ia2323ecb388bf5996279686e1bd2b1676c5ae213
Diffstat (limited to 'nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem')
2 files changed, 162 insertions, 162 deletions
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java index a5deb6315954..2e91e65cde51 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java @@ -1,123 +1,123 @@ -/**
- * Description: Encodes the specified problem into encoded information for
- * forming the goodness landscape.
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie May 31, 2000
- * Xiaofeng Xie Sep. 19, 2002
- * Xiaofeng Xie Mar. 01, 2003
- * Xiaofeng Xie May 11, 2004
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Please acknowledge the author(s) if you use this code in any way.
- *
- * @version 1.0
- * @Since MAOS1.0
- */
-
-package net.adaptivebox.problem;
-
-import net.adaptivebox.global.*;
-import net.adaptivebox.space.*;
-import net.adaptivebox.encode.*;
-import net.adaptivebox.knowledge.*;
-
-public abstract class ProblemEncoder {
- //Store the calculated results for the responses
- double[] tempResponseSet; //temp values
- double[] tempLocation; //temp values
-
- //the search space (S)
- protected DesignSpace designSpace = null;
-
- // For evaluate the response vector into encoded vector double[2]
- protected EvalStruct evalStruct = null;
-
- protected ProblemEncoder(int paramNum, int targetNum) throws Exception {
- designSpace = new DesignSpace(paramNum);
- evalStruct = new EvalStruct(targetNum);
- tempLocation = new double[paramNum];
- tempResponseSet = new double[targetNum];
- }
-
- public DesignSpace getDesignSpace() {
- return designSpace;
- }
-
- public EvalStruct getEvalStruct() {
- return evalStruct;
- }
-
- //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);
- }
-
- protected void setDefaultXAt(int i, double min, double max) {
- DesignDim dd = new DesignDim();
- 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) {
- EvalElement ee = new EvalElement();
- ee.targetBound = new BasicBound(min, max);
- evalStruct.setElemAt(ee, i);
- }
-
- protected void setDefaultYAt(int i, double min, double max, double weight) {
- EvalElement ee = new EvalElement();
- ee.targetBound = new BasicBound(min, max);
- ee.weight = weight;
- evalStruct.setElemAt(ee, i);
- }
-
- //get a fresh point
- public SearchPoint getFreshSearchPoint() {
- return new SearchPoint(designSpace.getDimension());
- }
-
- //get an encoded point
- public SearchPoint getEncodedSearchPoint() {
- SearchPoint point = getFreshSearchPoint();
- designSpace.initializeGene(point.getLocation());
- evaluate(point);
- return point;
- }
-
- //evaluate the point into encoded information
- public void evaluate(SearchPoint point) {
- //copy to temp point
- System.arraycopy(point.getLocation(), 0, this.tempLocation, 0, tempLocation.length);
- //mapping the temp point to original search space S
- designSpace.getMappingPoint(tempLocation);
- //calculate based on the temp point
- calcTargets(tempResponseSet, tempLocation);
- evalStruct.evaluate(point.getEncodeInfo(), tempResponseSet);
- point.setObjectiveValue(tempResponseSet[0]);
- }
-
- //calcuate 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++) {
- VY[i] = calcTargetAt(i, VX);
- }
- }
-}
-
+/** + * Description: Encodes the specified problem into encoded information for + * forming the goodness landscape. + * + * @ Author Create/Modi Note + * Xiaofeng Xie May 31, 2000 + * Xiaofeng Xie Sep. 19, 2002 + * Xiaofeng Xie Mar. 01, 2003 + * Xiaofeng Xie May 11, 2004 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Please acknowledge the author(s) if you use this code in any way. + * + * @version 1.0 + * @Since MAOS1.0 + */ + +package net.adaptivebox.problem; + +import net.adaptivebox.global.*; +import net.adaptivebox.space.*; +import net.adaptivebox.encode.*; +import net.adaptivebox.knowledge.*; + +public abstract class ProblemEncoder { + //Store the calculated results for the responses + double[] tempResponseSet; //temp values + double[] tempLocation; //temp values + + //the search space (S) + protected DesignSpace designSpace = null; + + // For evaluate the response vector into encoded vector double[2] + protected EvalStruct evalStruct = null; + + protected ProblemEncoder(int paramNum, int targetNum) throws Exception { + designSpace = new DesignSpace(paramNum); + evalStruct = new EvalStruct(targetNum); + tempLocation = new double[paramNum]; + tempResponseSet = new double[targetNum]; + } + + public DesignSpace getDesignSpace() { + return designSpace; + } + + public EvalStruct getEvalStruct() { + return evalStruct; + } + + //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); + } + + protected void setDefaultXAt(int i, double min, double max) { + DesignDim dd = new DesignDim(); + 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) { + EvalElement ee = new EvalElement(); + ee.targetBound = new BasicBound(min, max); + evalStruct.setElemAt(ee, i); + } + + protected void setDefaultYAt(int i, double min, double max, double weight) { + EvalElement ee = new EvalElement(); + ee.targetBound = new BasicBound(min, max); + ee.weight = weight; + evalStruct.setElemAt(ee, i); + } + + //get a fresh point + public SearchPoint getFreshSearchPoint() { + return new SearchPoint(designSpace.getDimension()); + } + + //get an encoded point + public SearchPoint getEncodedSearchPoint() { + SearchPoint point = getFreshSearchPoint(); + designSpace.initializeGene(point.getLocation()); + evaluate(point); + return point; + } + + //evaluate the point into encoded information + public void evaluate(SearchPoint point) { + //copy to temp point + System.arraycopy(point.getLocation(), 0, this.tempLocation, 0, tempLocation.length); + //mapping the temp point to original search space S + designSpace.getMappingPoint(tempLocation); + //calculate based on the temp point + calcTargets(tempResponseSet, tempLocation); + evalStruct.evaluate(point.getEncodeInfo(), tempResponseSet); + point.setObjectiveValue(tempResponseSet[0]); + } + + //calcuate 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++) { + VY[i] = calcTargetAt(i, VX); + } + } +} + diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/UnconstrainedProblemEncoder.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/UnconstrainedProblemEncoder.java index c06db87d83b7..03b621ec05d7 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/UnconstrainedProblemEncoder.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/UnconstrainedProblemEncoder.java @@ -1,39 +1,39 @@ -/**
- * Description: For unconstrained function
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie Dec 28, 2001
- * Xiaofeng Xie Mar 02, 2003
- * Xiaofeng Xie May 11, 2004
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Please acknowledge the author(s) if you use this code in any way.
- *
- * @version 1.0
- * @Since MAOS1.0
- */
-
-package net.adaptivebox.problem;
-
-import net.adaptivebox.global.*;
-
-public abstract class UnconstrainedProblemEncoder extends ProblemEncoder {
- protected UnconstrainedProblemEncoder(int NX) throws Exception {
- super(NX, 1);
- setDefaultYAt(0, BasicBound.MINDOUBLE, BasicBound.MINDOUBLE);
- }
-
- protected double calcTargetAt(int index, double[] VX) {
- return calcTarget(VX);
- }
- abstract public double calcTarget(double[] VX);
-}
+/** + * Description: For unconstrained function + * + * @ Author Create/Modi Note + * Xiaofeng Xie Dec 28, 2001 + * Xiaofeng Xie Mar 02, 2003 + * Xiaofeng Xie May 11, 2004 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Please acknowledge the author(s) if you use this code in any way. + * + * @version 1.0 + * @Since MAOS1.0 + */ + +package net.adaptivebox.problem; + +import net.adaptivebox.global.*; + +public abstract class UnconstrainedProblemEncoder extends ProblemEncoder { + protected UnconstrainedProblemEncoder(int NX) throws Exception { + super(NX, 1); + setDefaultYAt(0, BasicBound.MINDOUBLE, BasicBound.MINDOUBLE); + } + + protected double calcTargetAt(int index, double[] VX) { + return calcTarget(VX); + } + abstract public double calcTarget(double[] VX); +} |