Fixing rotation for AbstractMultiModalProblemKnown.

This commit is contained in:
Marcel Kronfeld 2010-02-26 10:50:07 +00:00
parent 43b2d031a1
commit 13f5219a19
2 changed files with 13 additions and 1 deletions

View File

@ -114,7 +114,8 @@ public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDoub
} }
/** /**
* This method returns the unnormalized function value for an maximization problem * This method returns the unnormalized (and unrotated!) function value for an maximization problem.
*
* @param x The n-dimensional input vector * @param x The n-dimensional input vector
* @return The m-dimensional output vector. * @return The m-dimensional output vector.
*/ */
@ -196,6 +197,10 @@ public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDoub
m_GlobalOpt = tmp; m_GlobalOpt = tmp;
} }
} }
if (isDoRotation()) {
point = inverseRotateMaybe(point); // theres an inverse rotation required
tmpIndy.SetDoubleGenotype(point);
}
this.m_ListOfOptima.add(tmpIndy); this.m_ListOfOptima.add(tmpIndy);
} }

View File

@ -132,6 +132,13 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
return x; return x;
} }
protected double[] inverseRotateMaybe(double[] x) {
if (isDoRotation()) {
if (rotation==null) initProblem();
x = Mathematics.rotate(x, rotation.inverse());
}
return x;
}
/** /**
* Add all constraint violations to the individual. Expect that the fitness has already been set. * Add all constraint violations to the individual. Expect that the fitness has already been set.
* *