Minor update of tool tips in AbstractProblemDoubleOffset.

This commit is contained in:
Marcel Kronfeld 2011-04-05 11:58:12 +00:00
parent ee49a14ea3
commit 877118b6b3
17 changed files with 66 additions and 66 deletions

View File

@ -419,7 +419,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
JComponent view, JComponent viewWrapper) {
JPanel newPanel = new JPanel();
if (tipText != null) {
view.setToolTipText(tipText);
label.setToolTipText(tipText);
view.setToolTipText(tipText);
}
newPanel.setBorder(BorderFactory.createEmptyBorder(10,5,0,10));

View File

@ -15,12 +15,12 @@ package eva2.gui;
/*==========================================================================*
* CLASS DECLARATION
*==========================================================================*/
import javax.swing.*;
import java.awt.event.*;
import java.beans.*;
/**
*
*/
import java.beans.PropertyEditor;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
public class PropertyValueSelector extends JComboBox {
PropertyEditor m_Editor;
/**

View File

@ -11,8 +11,8 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
// protected AbstractEAIndividual m_OverallBest = null;
protected int m_ProblemDimension = 10;
protected double m_XOffSet = 0.0; // TODO make them private, implement eval() and create abstract evalWithoutOffsets
protected double m_YOffSet = 0.0;
protected double m_XOffset = 0.0; // TODO make them private, implement eval() and create abstract evalWithoutOffsets
protected double m_YOffset = 0.0;
// protected boolean m_UseTestConstraint = false;
public AbstractProblemDoubleOffset() {
@ -24,8 +24,8 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
super();
super.cloneObjects(b);
this.m_ProblemDimension = b.m_ProblemDimension;
this.m_XOffSet = b.m_XOffSet;
this.m_YOffSet = b.m_YOffSet;
this.m_XOffset = b.m_XOffset;
this.m_YOffset = b.m_YOffset;
// this.m_UseTestConstraint = b.m_UseTestConstraint;
}
@ -51,29 +51,29 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
}
/** This method allows you to set/get an offset for decision variables.
* @param XOffSet The offset for the decision variables.
* @param XOffset The offset for the decision variables.
*/
public void setXOffSet(double XOffSet) {
this.m_XOffSet = XOffSet;
public void setXOffset(double XOffset) {
this.m_XOffset = XOffset;
}
public double getXOffSet() {
return this.m_XOffSet;
public double getXOffset() {
return this.m_XOffset;
}
public String xOffSetTipText() {
return "Choose an offset for the decision variable.";
public String XOffsetTipText() {
return "Choose an offset for the decision variables.";
}
/** This method allows you to set/get the offset for the
* objective value.
* @param YOffSet The offset for the objective value.
* @param YOffset The offset for the objective value.
*/
public void setYOffSet(double YOffSet) {
this.m_YOffSet = YOffSet;
public void setYOffset(double YOffset) {
this.m_YOffset = YOffset;
}
public double getYOffSet() {
return this.m_YOffSet;
public double getYOffset() {
return this.m_YOffset;
}
public String yOffSetTipText() {
public String YOffsetTipText() {
return "Choose an offset for the objective value.";
}
/** Length of the x vector at is to be optimized

View File

@ -40,9 +40,9 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
x = rotateMaybe(x);
double[] result = new double[1];
double c1 = this.calculateC(1);
result[0] = m_YOffSet;
result[0] = m_YOffset;
for (int i = 0; i < x.length-1; i++) {
double xi = x[i]-m_XOffSet;
double xi = x[i]-m_XOffset;
result[0] += ((this.calculateC(xi))/(c1 * Math.pow(Math.abs(xi),2-this.m_D))) + Math.pow(xi, 2) -1;
}
return result;

View File

@ -43,11 +43,11 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
double[] result = new double[1];
double tmpProd = 1;
for (int i = 0; i < x.length; i++) {
double xi = x[i]-m_XOffSet;
double xi = x[i]-m_XOffset;
result[0] += Math.pow(xi, 2);
tmpProd *= Math.cos((xi)/Math.sqrt(i+1));
}
result[0] = ((result[0]/this.m_D) - tmpProd + 1)+m_YOffSet;
result[0] = ((result[0]/this.m_D) - tmpProd + 1)+m_YOffset;
return result;
}

View File

@ -38,10 +38,10 @@ public class F12Problem extends AbstractProblemDoubleOffset implements java.io.S
double[] result = new double[1];
double tmp = 0;//-5;
for (int i = 1; i < x.length-1; i++) {
tmp += Math.pow(x[i]-m_XOffSet, 2);
tmp += Math.pow(x[i]-m_XOffset, 2);
}
double x0 = x[0]-m_XOffSet;
result[0] = m_YOffSet+((Math.exp(-5*x0*x0)+2*Math.exp(-5*Math.pow(1-x0, 2)))*Math.exp(-5*tmp));
double x0 = x[0]-m_XOffset;
result[0] = m_YOffset+((Math.exp(-5*x0*x0)+2*Math.exp(-5*Math.pow(1-x0, 2)))*Math.exp(-5*tmp));
return result;
}

View File

@ -52,10 +52,10 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet;
result[0] = m_YOffset;
for (int i=0; i<x.length; i++) {
double xi = (x[i]-m_XOffSet);
double xi = (x[i]-m_XOffset);
result[0] -= xi*Math.sin(Math.sqrt(Math.abs(xi)));
}
result[0] += (418.9829 * m_ProblemDimension);

View File

@ -32,8 +32,8 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface
public double[] eval(double[] x) {
double[] result = new double[1];
double x0 = x[0]-rotationDX-m_XOffSet;
double x1 = x[1]-rotationDX-m_XOffSet;
double x0 = x[0]-rotationDX-m_XOffset;
double x1 = x[1]-rotationDX-m_XOffset;
if (rotation != 0.) {
double cosw = Math.cos(rotation);
double sinw = Math.sin(rotation);
@ -43,7 +43,7 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface
x0=tmpx0;
}
//matlab: 40 + (- exp(cos(5*X)+cos(3*Y)) .* exp(-X.^2) .* (-.05*Y.^2+5));
result[0] = m_YOffSet+36.9452804947;//36.945280494653247;
result[0] = m_YOffset+36.9452804947;//36.945280494653247;
result[0] += (-Math.exp(Math.cos(3*x0)+Math.cos(6*x1)) * Math.exp(-x0*x0/10) * (-.05*x1*x1+5));
return result;

View File

@ -46,10 +46,10 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet;
result[0] = m_YOffset;
// add an offset in solution space
for (int i = 0; i < x.length; i++) {
result[0] += Math.pow(x[i] - this.m_XOffSet, 2);
result[0] += Math.pow(x[i] - this.m_XOffset, 2);
}
return result;
}
@ -94,7 +94,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
// first order partial derivation in direction x_i is 2*x_i
double[] grads=new double[x.length];
for (int i=0; i<x.length; i++) {
grads[i]=(2.*(x[i] - this.m_XOffSet));
grads[i]=(2.*(x[i] - this.m_XOffset));
}
return grads;
}

View File

@ -40,14 +40,14 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet;
result[0] = m_YOffset;
double xi, xii;
for (int i = 0; i < x.length-1; i++) {
xi=x[i]-m_XOffSet;
xii=x[i+1]-m_XOffSet;
xi=x[i]-m_XOffset;
xii=x[i+1]-m_XOffset;
result[0] += (100*(xii-xi*xi)*(xii-xi*xi)+(xi-1)*(xi-1));
}
if (m_YOffSet==0 && (result[0]<=0)) result[0]=Math.sqrt(Double.MIN_VALUE); // guard for plots in log scale
if (m_YOffset==0 && (result[0]<=0)) result[0]=Math.sqrt(Double.MIN_VALUE); // guard for plots in log scale
return result;
}
@ -58,8 +58,8 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
double xi, xii;
for (int i = 0; i < dim-1; i++) {
xi=x[i]-m_XOffSet;
xii=x[i+1]-m_XOffSet;
xi=x[i]-m_XOffset;
xii=x[i+1]-m_XOffset;
result[i] += 400*xi*(xi*xi-xii) + 2*xi-2;
result[i+1] += -200 * (xi*xi - xii);

View File

@ -33,9 +33,9 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet+6*x.length;
result[0] = m_YOffset+6*x.length;
for (int i = 0; i < x.length-1; i++) {
result[0] += Math.floor(x[i]- this.m_XOffSet);
result[0] += Math.floor(x[i]- this.m_XOffset);
}
return result;
}

View File

@ -37,9 +37,9 @@ public class F4Problem extends AbstractProblemDoubleOffset implements java.io.Se
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet;
result[0] = m_YOffset;
for (int i = 0; i < x.length-1; i++) {
result[0] += (i+1)*Math.pow((x[i]-m_XOffSet), 4);
result[0] += (i+1)*Math.pow((x[i]-m_XOffset), 4);
}
return result;
}

View File

@ -38,11 +38,11 @@ public class F5Problem extends AbstractProblemDoubleOffset implements java.io.Se
x = rotateMaybe(x);
double[] result = new double[1];
double tmp;
result[0] = m_YOffSet;
result[0] = m_YOffset;
for (int i = 0; i < x.length; i++) {
tmp = 0;
for (int j = 0; j <= i; j++) {
tmp += x[j]-m_XOffSet;
tmp += x[j]-m_XOffset;
}
result[0] += Math.pow(tmp, 2);
}

View File

@ -44,9 +44,9 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = x.length * this.m_A + m_YOffSet;
result[0] = x.length * this.m_A + m_YOffset;
for (int i = 0; i < x.length; i++) {
double xi = x[i]-m_XOffSet;
double xi = x[i]-m_XOffset;
result[0] += Math.pow(xi, 2) - this.m_A * Math.cos(this.m_Omega*xi);
}
return result;
@ -57,7 +57,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte
double[] result = new double[x.length];
for (int j=0; j<x.length; j++) {
result[j]=0;
double xj = x[j]-m_XOffSet;
double xj = x[j]-m_XOffset;
result[j] += 2*xj + this.m_Omega * this.m_A * Math.sin(this.m_Omega*xj);
}
return result;

View File

@ -72,14 +72,14 @@ public class F7Problem extends AbstractProblemDoubleOffset implements java.io.Se
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet;
result[0] = m_YOffset;
if ((Math.floor(this.m_CurrentTimeStamp / this.m_t)%2) == 0) {
for (int i = 0; i < x.length-1; i++) {
result[0] += Math.pow(x[i]-m_XOffSet, 2);
result[0] += Math.pow(x[i]-m_XOffset, 2);
}
} else {
for (int i = 0; i < x.length-1; i++) {
result[0] += Math.pow(x[i]-m_XOffSet-this.m_Change, 2);
result[0] += Math.pow(x[i]-m_XOffset-this.m_Change, 2);
}
}
return result;

View File

@ -63,13 +63,13 @@ public class F8Problem extends AbstractProblemDoubleOffset
double sum1 = 0, sum2 = 0, exp1, exp2;
for (int i = 0; i < x.length; i++) {
double xi = x[i]-m_XOffSet;
double xi = x[i]-m_XOffset;
sum1 += (xi)*(xi);
sum2 += Math.cos(c * (xi));
}
exp1 = -b*Math.sqrt(sum1/(double)this.m_ProblemDimension);
exp2 = sum2/(double)this.m_ProblemDimension;
result[0] = m_YOffSet + a + Math.E - a * Math.exp(exp1)- Math.exp(exp2);
result[0] = m_YOffset + a + Math.E - a * Math.exp(exp1)- Math.exp(exp2);
return result;
}
@ -186,15 +186,15 @@ public class F8Problem extends AbstractProblemDoubleOffset
m_ListOfOptima=new Population();
// ingeniously avoid recursive calls during refinement!
double[] pos = new double[getProblemDimension()];
Arrays.fill(pos, getXOffSet());
Arrays.fill(pos, getXOffset());
addOptimum(pos); // the global optimum
double refinedX = 0;
if (getProblemDimension()<18) for (int i=0; i<getProblemDimension(); i++) {
// TODO what about dimensions higher than 18???
for (int k=-1; k<=1; k+=2) {
Arrays.fill(pos, getXOffSet());
Arrays.fill(pos, getXOffset());
if (refinedX == 0) { // we dont know the exact x-offset for the optima, so refine once
pos[i]=k+getXOffSet();
pos[i]=k+getXOffset();
double[] dir = pos.clone();
dir[i]-=0.05;
pos = inverseRotateMaybe(pos);
@ -205,9 +205,9 @@ public class F8Problem extends AbstractProblemDoubleOffset
System.err.println("Warning, possibly converged to a wrong optimum in F8Problem.initListOfOptima!");
}
pos = rotateMaybe(pos);
refinedX = Math.abs(pos[i]-getXOffSet()); // store the refined position which is equal in any direction and dimension
refinedX = Math.abs(pos[i]-getXOffset()); // store the refined position which is equal in any direction and dimension
} else {
pos[i]=(k*refinedX)+getXOffSet();
pos[i]=(k*refinedX)+getXOffset();
}
addOptimum(pos);
}

View File

@ -26,9 +26,9 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se
public double[] eval(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = m_YOffSet;
result[0] = m_YOffset;
for (int i = 0; i < x.length; i++) {
result[0] += (i+1)*Math.pow(x[i]-m_XOffSet, 2);
result[0] += (i+1)*Math.pow(x[i]-m_XOffset, 2);
}
return result;
}