Small bugfix for setting the problemDimension.

refs #26
This commit is contained in:
Fabian Becker 2014-10-27 20:36:23 +01:00
parent f43e575b18
commit d170727f8e
3 changed files with 9 additions and 7 deletions

View File

@ -6,6 +6,8 @@ import eva2.optimization.enums.StatisticsOnTwoSampledData;
import eva2.tools.ReflectPackage;
import eva2.tools.StringTools;
import eva2.tools.math.Mathematics;
import org.apache.commons.math3.stat.ranking.NaNStrategy;
import org.apache.commons.math3.stat.ranking.TiesStrategy;
import java.text.DecimalFormat;
import java.util.*;
@ -255,15 +257,19 @@ public class EvAStatisticalEvaluation {
private static String calculateMannWhitney(String field, OptimizationJob job1, OptimizationJob job2) {
double[] dat1 = job1.getDoubleDataColumn(field);
double[] dat2 = job2.getDoubleDataColumn(field);
org.apache.commons.math3.stat.inference.MannWhitneyUTest mU = new org.apache.commons.math3.stat.inference.MannWhitneyUTest(NaNStrategy.FAILED, TiesStrategy.AVERAGE);
double t = Double.NaN;
if (dat1 != null && dat2 != null) {
return "" + mU.mannWhitneyUTest(dat1, dat2);
/*
Object obj = ReflectPackage.instantiateWithParams("jsc.independentsamples.MannWhitneyTest", new Object[]{dat1, dat2}, null);
if (obj != null) {
Object sp = BeanInspector.callIfAvailable(obj, "getSP", new Object[]{});
t = (Double) sp;
} else {
LOGGER.warning("For the MannWhitney test, the JSC package is required on the class path!");
}
}*/
}
return "" + t;
}
@ -308,9 +314,9 @@ public class EvAStatisticalEvaluation {
assert(uA + uB == n1 * n2);
double u = Math.min(uA, uB);
double mU = (n1 * n2) / 2;
double omegaU = Math.sqrt((n1*n2*(n1 + n2 + 1.0))/12.0);
double sigmaU = Math.sqrt((n1*n2*(n1 + n2 + 1.0))/12.0);
t = (u - mU) / omegaU;
t = (u - mU) / sigmaU;
}
return "" + t;
}

View File

@ -5,7 +5,6 @@ package eva2.problems;
*/
public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble implements Interface2DBorderProblem {
protected int problemDimension = 10;
protected double xOffset = 0.0; // TODO make them private, implement evaluate() and create abstract evalWithoutOffsets
protected double yOffset = 0.0;

View File

@ -20,15 +20,12 @@ import java.util.ArrayList;
*/
@Description("T1 is to be minimized.")
public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implements java.io.Serializable {
protected int problemDimension = 30;
protected int outputDimension = 2;
protected double noise = 0.0;
protected double xOffset = 0.0;
protected double yOffset = 0.0;
protected boolean applyConstraints = false;
// transient private GraphPointSet mySet;
public TF1Problem() {
super(1.);
}