Fix all errors in javadoc generation.
This commit is contained in:
parent
65b1f7df74
commit
f4dc718b33
@ -47,11 +47,11 @@ import java.util.List;
|
||||
* optimization procedures in EvA2. The arguments passed to the methods
|
||||
* initialize the respective optimization procedure. To perform an optimization
|
||||
* one has to do the following:
|
||||
* <code>
|
||||
* {@code
|
||||
* InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments);
|
||||
* EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls);
|
||||
* while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize();
|
||||
* </code>
|
||||
* }
|
||||
*/
|
||||
public class OptimizerFactory {
|
||||
|
||||
@ -323,7 +323,7 @@ public class OptimizerFactory {
|
||||
* This method creates a Hill Climber algorithm with a default fixed-size
|
||||
* mutation.
|
||||
*
|
||||
* @param pop The size of the population
|
||||
* @param popSize The size of the population
|
||||
* @param problem The problem to be optimized
|
||||
* @param listener
|
||||
* @return An optimization procedure that performs hill climbing.
|
||||
@ -715,8 +715,8 @@ public class OptimizerFactory {
|
||||
* Use default random seed and the population size of the optimizer.
|
||||
*
|
||||
* @param opt
|
||||
* @param popSize
|
||||
* @param problem
|
||||
* @param term
|
||||
* @return
|
||||
* @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem,
|
||||
* long, InterfaceTerminator)
|
||||
@ -1117,7 +1117,7 @@ public class OptimizerFactory {
|
||||
/**
|
||||
* Add a new InterfaceTerminator to the current user-defined optimizer in a
|
||||
* boolean combination. The old and the given terminator will be combined as
|
||||
* in (TOld && TNew) if bAnd is true, and as in (TOld || TNew) if bAnd is
|
||||
* in (TOld && TNew) if bAnd is true, and as in (TOld || TNew) if bAnd is
|
||||
* false. If there was no user-defined terminator (or it was set to null)
|
||||
* the new one is used without conjunction.
|
||||
*
|
||||
@ -1327,7 +1327,6 @@ public class OptimizerFactory {
|
||||
* @param evalCycle
|
||||
* @param popSize
|
||||
* @param minImprovement
|
||||
* @param method
|
||||
* @param sigmaClust
|
||||
* @return
|
||||
*/
|
||||
@ -1500,7 +1499,7 @@ public class OptimizerFactory {
|
||||
* A standard niching ES which employs predefined values and standard ES
|
||||
* variation operators.
|
||||
*
|
||||
* @param problem
|
||||
* @param prob
|
||||
* @return
|
||||
*/
|
||||
public static OptimizationParameters standardNichingEs(AbstractOptimizationProblem prob) {
|
||||
@ -1513,7 +1512,7 @@ public class OptimizerFactory {
|
||||
/**
|
||||
* A niching ES.
|
||||
*
|
||||
* @param problem
|
||||
* @param prob
|
||||
* @return
|
||||
*/
|
||||
public static OptimizationParameters createNichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) {
|
||||
|
@ -32,7 +32,7 @@ class SplashScreen extends JWindow {
|
||||
* Once this method returns, the splash screen is realized, which means
|
||||
* that almost all work on the splash screen should proceed through the
|
||||
* event dispatch thread. In particular, any call to
|
||||
* <code>dispose</code> for the splash screen must be performed in the event
|
||||
* {@code dispose} for the splash screen must be performed in the event
|
||||
* dispatch thread.
|
||||
*/
|
||||
public void splash() {
|
||||
|
@ -59,23 +59,23 @@ public abstract class SwingWorker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the value to be returned by the <code>get</code> method.
|
||||
* Compute the value to be returned by the {@code get} method.
|
||||
*/
|
||||
public abstract Object construct();
|
||||
|
||||
/**
|
||||
* Called on the event dispatching thread (not on the worker thread)
|
||||
* after the <code>construct</code> method has returned.
|
||||
* after the {@code construct} method has returned.
|
||||
*/
|
||||
public void finished() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value created by the <code>construct</code> method.
|
||||
* Return the value created by the {@code construct} method.
|
||||
* Returns null if either the constructing thread or the current
|
||||
* thread was interrupted before a value was produced.
|
||||
*
|
||||
* @return the value created by the <code>construct</code> method
|
||||
* @return the value created by the {@code construct} method
|
||||
*/
|
||||
public Object get() {
|
||||
while (true) {
|
||||
@ -93,7 +93,7 @@ public abstract class SwingWorker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a thread that will call the <code>construct</code> method
|
||||
* Start a thread that will call the {@code construct} method
|
||||
* and then exit.
|
||||
*/
|
||||
public SwingWorker() {
|
||||
|
@ -150,9 +150,9 @@ public class DPointSetMultiIcon extends DComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* method returns the nearest <code>DPoint</code> in this <code>DPointSet</code>.
|
||||
* method returns the nearest {@code DPoint} in this {@code DPointSet}.
|
||||
*
|
||||
* @return the nearest <code>DPoint</code>
|
||||
* @return the nearest {@code DPoint}
|
||||
*/
|
||||
public DPoint getNearestDPoint(DPoint point) {
|
||||
int minIndex = getNearestDPointIndex(point);
|
||||
@ -169,9 +169,9 @@ public class DPointSetMultiIcon extends DComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* method returns the index to the nearest <code>DPoint</code> in this <code>DPointSet</code>.
|
||||
* method returns the index to the nearest {@code DPoint} in this {@code DPointSet}.
|
||||
*
|
||||
* @return the index to the nearest <code>DPoint</code>. -1 if no nearest <code>DPoint</code> was found.
|
||||
* @return the index to the nearest {@code DPoint}. -1 if no nearest {@code DPoint} was found.
|
||||
*/
|
||||
public int getNearestDPointIndex(DPoint point) {
|
||||
double minValue = Double.MAX_VALUE;
|
||||
|
@ -497,8 +497,6 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
|
||||
/**
|
||||
* Allows marking an individual as infeasible if fitness penalty is used.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setMarkPenalized(boolean p) {
|
||||
isPenalized = p;
|
||||
|
@ -49,7 +49,7 @@ public class EAIndividualComparator implements Comparator<Object>, Serializable
|
||||
|
||||
/**
|
||||
* Constructor for a specific fitness criterion in the multi-objective case.
|
||||
* For comparison, only the given fitness criterion is used if it is >= 0.
|
||||
* For comparison, only the given fitness criterion is used if it is >= 0.
|
||||
*
|
||||
* @param fitnessCriterion
|
||||
*/
|
||||
@ -59,7 +59,7 @@ public class EAIndividualComparator implements Comparator<Object>, Serializable
|
||||
|
||||
/**
|
||||
* Constructor for a specific fitness criterion in the multi-objective case.
|
||||
* For comparison, only the given fitness criterion is used if it is >= 0.
|
||||
* For comparison, only the given fitness criterion is used if it is >= 0.
|
||||
* If preferFeasible is true, feasible individuals will always be prefered.
|
||||
*
|
||||
* @param fitIndex
|
||||
|
@ -274,7 +274,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
* This method allows you to set the double data.
|
||||
*
|
||||
* @param doubleData The new double data.
|
||||
* @see InterfaceDataTypeDouble.SetDoubleData()
|
||||
*/
|
||||
@Override
|
||||
public void setDoublePhenotype(double[] doubleData) {
|
||||
@ -286,7 +285,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
* memetic algorithms.
|
||||
*
|
||||
* @param doubleData The new double data.
|
||||
* @see InterfaceDataTypeDouble.SetDoubleDataLamarckian()
|
||||
*/
|
||||
@Override
|
||||
public void setDoubleGenotype(double[] doubleData) {
|
||||
@ -341,7 +339,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
* This method allows you to set the binary data.
|
||||
*
|
||||
* @param binaryData The new binary data.
|
||||
* @see InterfaceDataTypeBinary.SetBinaryData()
|
||||
*/
|
||||
@Override
|
||||
public void setBinaryPhenotype(BitSet binaryData) {
|
||||
@ -353,16 +350,12 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
* memetic algorithms.
|
||||
*
|
||||
* @param binaryData The new binary data.
|
||||
* @see InterfaceBinaryData.setBinaryDataLamarckian()
|
||||
*/
|
||||
@Override
|
||||
public void setBinaryGenotype(BitSet binaryData) {
|
||||
this.binaryIndividual.setBinaryGenotype(binaryData);
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* These are for GUI
|
||||
*/
|
||||
/**
|
||||
* This method allows the CommonJavaObjectEditorPanel to read the
|
||||
* name to the current object.
|
||||
|
@ -169,7 +169,7 @@ public class ClusteringDynPeakIdent implements InterfaceClustering, java.io.Seri
|
||||
* which are not dominated by other individuals within distance rho.
|
||||
* Note that the returned set may be smaller than q.
|
||||
*
|
||||
* @param pop
|
||||
* @param metric Distance Metric
|
||||
* @param q the number of peaks to be identified
|
||||
* @param rho the niche radius
|
||||
* @return the dynamic peak set
|
||||
|
@ -17,7 +17,7 @@ import java.util.ArrayList;
|
||||
/**
|
||||
* This is the Unimodal Normal Distribution Crossover by Ono and Kobayashi, 1997. Cf.:
|
||||
*
|
||||
* @INPROCEEDINGS{Ono1997, author = {Ono, Isao and Kobayashi, Shigenobu},
|
||||
* INPROCEEDINGS{Ono1997, author = {Ono, Isao and Kobayashi, Shigenobu},
|
||||
* title = {{A Real Coded Genetic Algorithm for Function Optimization Using Unimodal Normal Distributed Crossover}},
|
||||
* booktitle = {ICGA},
|
||||
* year = {1997},
|
||||
|
@ -21,7 +21,7 @@ import java.util.BitSet;
|
||||
* elements to a certain type and all to a subset of the range).
|
||||
* <p>
|
||||
* The initialization may be parameterized in two ways, where each takes a fixed
|
||||
* segment length s. Firstly, a fixed number of bits (k<=s) is set per segment,
|
||||
* segment length s. Firstly, a fixed number of bits (k<=s) is set per segment,
|
||||
* so each segment has equal cardinality.
|
||||
* Secondly, an int-array can be specified which defines possibly varying k_i for
|
||||
* each segment i, so different segments may have different cardinality. The array
|
||||
|
@ -12,7 +12,7 @@ import eva2.util.annotation.Description;
|
||||
* ES mutation with path length control. The step size (single sigma) is
|
||||
* adapted using the evolution path length by adapting the real path length
|
||||
* to the expected path length in for uncorrelated single steps.
|
||||
* See Hansen&Ostermeier 2001, Eqs. 16,17.
|
||||
* See Hansen&Ostermeier 2001, Eqs. 16,17.
|
||||
*/
|
||||
@Description("The single step size is controlled using the evolution path.")
|
||||
public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Serializable {
|
||||
|
@ -21,9 +21,9 @@ import java.io.Serializable;
|
||||
/**
|
||||
* Implementing CMA ES with rank-mu-update and weighted recombination. More information can be found here:
|
||||
* - http://www.bionik.tu-berlin.de/user/niko/cmaesintro.html
|
||||
* - N.Hansen & S.Kern 2004: Evaluating the CMA Evolution Strategy on Multimodal Test Functions.
|
||||
* - N.Hansen & S.Kern 2004: Evaluating the CMA Evolution Strategy on Multimodal Test Functions.
|
||||
* Parallel Problem Solving from Nature 2004.
|
||||
* - For the stopping criteria: Auger&Hansen, CEC '05, A Restart CMA ES with increasing population size.
|
||||
* - For the stopping criteria: Auger&Hansen, CEC '05, A Restart CMA ES with increasing population size.
|
||||
* <p>
|
||||
* The implementation uses a structure for keeping all adaptive parameters, CMAParamSet, which is stored
|
||||
* in the populations, so that in principle, multi-modal optimization with several populations becomes possible.
|
||||
@ -105,7 +105,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In
|
||||
* Perform the main adaption of sigma and C using evolution paths.
|
||||
* The evolution path is deduced from the center of the selected population compared to the old
|
||||
* mean value.
|
||||
* See Hansen&Kern 04 for further information.
|
||||
* See Hansen&Kern 04 for further information.
|
||||
*
|
||||
* @param oldGen
|
||||
* @param selectedP
|
||||
@ -702,7 +702,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In
|
||||
}
|
||||
|
||||
/**
|
||||
* From Auger&Hansen, CEC '05, stopping criterion TolX.
|
||||
* From Auger&Hansen, CEC '05, stopping criterion TolX.
|
||||
*
|
||||
* @param tolX
|
||||
* @return
|
||||
@ -720,7 +720,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In
|
||||
}
|
||||
|
||||
/**
|
||||
* From Auger&Hansen, CEC '05, stopping criterion noeffectaxis.
|
||||
* From Auger&Hansen, CEC '05, stopping criterion noeffectaxis.
|
||||
*
|
||||
* @param d
|
||||
* @param gen
|
||||
@ -743,7 +743,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In
|
||||
}
|
||||
|
||||
/**
|
||||
* From Auger&Hansen, CEC '05, stopping criterion noeffectcoord.
|
||||
* From Auger&Hansen, CEC '05, stopping criterion noeffectcoord.
|
||||
*
|
||||
* @param d
|
||||
* @return
|
||||
@ -760,11 +760,11 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In
|
||||
}
|
||||
|
||||
/**
|
||||
* Test condition of C (Auger&Hansen, CEC '05, stopping criterion conditioncov).
|
||||
* Return true, if a diagonal entry is <= 0 or >= d.
|
||||
* Test condition of C (Auger&Hansen, CEC '05, stopping criterion conditioncov).
|
||||
* Return true, if a diagonal entry is <= 0 or >= d.
|
||||
*
|
||||
* @param d
|
||||
* @return true, if a diagonal entry is <= 0 or >= d, else false
|
||||
* @return true, if a diagonal entry is <= 0 or >= d, else false
|
||||
*/
|
||||
public boolean testCCondition(Population pop, double d) {
|
||||
CMAParamSet params = (CMAParamSet) pop.getData(cmaParamsKey);
|
||||
|
@ -161,12 +161,12 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab
|
||||
|
||||
/**
|
||||
* Select a random index within the given genotype lying in [iMin,iMax]. If applicable, the given
|
||||
* value is avoided with certain probility, namely by trying to find a different value for maxTries
|
||||
* value is avoided with certain probality, namely by trying to find a different value for maxTries
|
||||
* times.
|
||||
*
|
||||
* @param maxTries
|
||||
* @param genotype
|
||||
* @param maybePreferedValue
|
||||
* @param avoidValue
|
||||
* @param iMin
|
||||
* @param iMax
|
||||
* @return
|
||||
@ -182,11 +182,6 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab
|
||||
return k;
|
||||
}
|
||||
|
||||
// private int getRandomSecondIndex(int firstIndex, AbstractEAIndividual individual) {
|
||||
// int genoLen = ((InterfaceGAIndividual)individual).getGenotypeLength();
|
||||
// return RNG.randomInt(0, genoLen);
|
||||
// }
|
||||
|
||||
protected Object valueAt(Object genotype, int k) {
|
||||
if (genotype instanceof BitSet) {
|
||||
return ((BitSet) genotype).get(k);
|
||||
|
@ -14,7 +14,7 @@ import java.util.BitSet;
|
||||
/**
|
||||
* Swap two random bits of a GA individual within subsequences (segments) of fixed length.
|
||||
* If preferPairs is true, unequal pairs
|
||||
* are picked with some preference (by trying for >= s/2 times, where s is the binary
|
||||
* are picked with some preference (by trying for >= s/2 times, where s is the binary
|
||||
* segment length).
|
||||
* Multiple mutations per segment can occur if the boolean switch is activated, meaning
|
||||
* that further mutations are performed recursively with p_mut. Thus, the probability
|
||||
|
@ -15,7 +15,7 @@ import eva2.util.annotation.Description;
|
||||
* <br><br>
|
||||
* <b>Example: </b>
|
||||
* <pre>
|
||||
* 1 2 | 3 4 5 | 6 7 8 9 ->
|
||||
* 1 2 | 3 4 5 | 6 7 8 9 ->
|
||||
* 1 2 | 5 4 3 | 6 7 8 9
|
||||
* </pre>
|
||||
*/
|
||||
@ -30,8 +30,10 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat
|
||||
return this;
|
||||
}
|
||||
|
||||
/** This method allows you to evaluate wether two mutation operators
|
||||
/**
|
||||
* This method allows you to evaluate whether two mutation operators
|
||||
* are actually the same.
|
||||
*
|
||||
* @param mutator The other mutation operator
|
||||
*/
|
||||
@Override
|
||||
|
@ -35,15 +35,11 @@ public class EuclideanDiversityAbsorptionStrategy extends StandardAbsorptionStra
|
||||
epsilon = eps;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* shouldAbsorbParticleIntoSubswarm
|
||||
*/
|
||||
/**
|
||||
* @tested true if
|
||||
* the subswarm is active and
|
||||
* the particle lies in the radius of the subswarm and
|
||||
* the diversity (mean distance from the gbest) of the subswarm < epsilon
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.StandardAbsorptionStrategy#shouldAbsorbParticleIntoSubswarm(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
* true if
|
||||
* the sub-swarm is active and
|
||||
* the particle lies in the radius of the sub-swarm and
|
||||
* the diversity (mean distance from the gbest) of the sub-swarm < epsilon
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||
@ -58,10 +54,6 @@ public class EuclideanDiversityAbsorptionStrategy extends StandardAbsorptionStra
|
||||
return meanDistanceFromGBestPos < getEpsilon();
|
||||
}
|
||||
|
||||
/**
|
||||
* *******************************************************************************************************************
|
||||
* setter, getter
|
||||
*/
|
||||
public void setEpsilon(double epsilon) {
|
||||
this.epsilon = epsilon;
|
||||
}
|
||||
|
@ -9,12 +9,11 @@ import eva2.optimization.strategies.ParticleSubSwarmOptimization;
|
||||
public interface InterfaceAbsorptionStrategy {
|
||||
|
||||
/**
|
||||
* @param indy
|
||||
* @param indy Individual
|
||||
* @param subswarm the swarm indy will be absorbed from
|
||||
* @param mainswarm the swarm indy currently belongs to
|
||||
* (population statistics from that swarm may be used to decide whether indy should be absorbed)
|
||||
* @return
|
||||
* @tested decides whether indy should be absorbed into the subswarm according to the absorption strategie
|
||||
* @return Decides whether indy should be absorbed into the sub-swarm according to the absorption strategy
|
||||
*/
|
||||
boolean shouldAbsorbParticleIntoSubswarm(
|
||||
AbstractEAIndividual indy,
|
||||
@ -22,10 +21,11 @@ public interface InterfaceAbsorptionStrategy {
|
||||
ParticleSubSwarmOptimization mainswarm);
|
||||
|
||||
/**
|
||||
* @param indy
|
||||
* Absorbs indy according to the absorption strategy
|
||||
*
|
||||
* @param indy Individual
|
||||
* @param subswarm the swarm indy will be absorbed from
|
||||
* @param mainswarm the swarm indy currently belongs to
|
||||
* @tested absorbs indy according to the absorbtion strategy
|
||||
*/
|
||||
void absorbParticle(
|
||||
AbstractEAIndividual indy,
|
||||
|
@ -22,10 +22,9 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy,
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested true if
|
||||
* tested true if
|
||||
* the subswarm is active and
|
||||
* the particle lies in the radius of the subswarm
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceAbsorptionStrategy#shouldAbsorbParticleIntoSubswarm(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||
@ -43,20 +42,13 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy,
|
||||
return dist <= R;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* absorbParticle
|
||||
*/
|
||||
|
||||
/**
|
||||
* @tested junit
|
||||
* adds indy to an active subswarm, then removes indy from the mainswarm.
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceAbsorptionStrategy#absorbParticle(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
* Adds indy to an active sub-swarm, then removes indy from the main-swarm.
|
||||
*/
|
||||
@Override
|
||||
public void absorbParticle(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||
if (!subswarm.isActive()) {
|
||||
System.out.println("absorbParticle: trying to absorb a particle into an inactive subswarm.");
|
||||
System.out.println("absorbParticle: trying to absorb a particle into an inactive sub-swarm.");
|
||||
return;
|
||||
}
|
||||
subswarm.add(indy);
|
||||
|
@ -83,9 +83,8 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested true if the subswarm is active and all particles are completely converged
|
||||
* (i.e. the stddev over the past 3 iterations is < epsilson)
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#shouldDeactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
* True if the subswarm is active and all particles are completely converged
|
||||
* (i.e. the stddev over the past 3 iterations is < epsilson)
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) {
|
||||
@ -98,14 +97,9 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr
|
||||
return (isConverged(subswarm.getPopulation()));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* deactivateSubswarm
|
||||
*/
|
||||
|
||||
/**
|
||||
* @tested the subswarm is deactivated and the particles indices are returned. They are
|
||||
* The subswarm is deactivated and the particles indices are returned. They are
|
||||
* to be reinitialized into the mainswarm.
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#deactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
*/
|
||||
@Override
|
||||
public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||
@ -126,11 +120,6 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr
|
||||
return particleIndices;
|
||||
}
|
||||
|
||||
/**
|
||||
* *******************************************************************************************************************
|
||||
* getter, setter
|
||||
*/
|
||||
|
||||
public void setEpsilon(double epsilon) {
|
||||
this.epsilon = epsilon;
|
||||
}
|
||||
|
@ -8,18 +8,20 @@ import eva2.optimization.strategies.ParticleSubSwarmOptimization;
|
||||
public interface InterfaceDeactivationStrategy {
|
||||
|
||||
/**
|
||||
* Decides whether a subswarm should be deactivated according to the deactivation strategy
|
||||
*
|
||||
* @param subswarm
|
||||
* @return
|
||||
* @tested decides whether a subswarm should be deacitvated according to the deactivation strategy
|
||||
*/
|
||||
boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm);
|
||||
|
||||
/**
|
||||
* Deactivates a given subswarm.
|
||||
* What happens to the particles in this subswarm depends on the concrete strategy.
|
||||
*
|
||||
* @param subswarm
|
||||
* @param mainswarm
|
||||
* @tested deactivates a given subswarm.
|
||||
* What happens to the particles in this subswarm depends on the concrete strategy.
|
||||
* Return the list of indices to be reinitialized or null.
|
||||
* @return the list of indices to be reinitialized or null.
|
||||
*/
|
||||
int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm);
|
||||
|
||||
|
@ -21,10 +21,6 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
||||
private double epsilon = 0.0001;
|
||||
private int stdDevHorizon = 3;
|
||||
|
||||
/**
|
||||
* *******************************************************************************************************************
|
||||
* ctors
|
||||
*/
|
||||
public StandardDeactivationStrategy() {
|
||||
|
||||
}
|
||||
@ -51,7 +47,6 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
||||
/**
|
||||
* @param pop
|
||||
* @return
|
||||
* @tested
|
||||
*/
|
||||
public boolean areAllConverged(Population pop) {
|
||||
for (int i = 0; i < pop.size(); ++i) {
|
||||
@ -72,9 +67,8 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested true if the subswarm is active and all particles are completely converged
|
||||
* (i.e. the stddev over the past 3 iterations is < epsilson)
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#shouldDeactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
* True if the subswarm is active and all particles are completely converged
|
||||
* (i.e. the stddev over the past 3 iterations is < epsilson)
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) {
|
||||
@ -87,14 +81,10 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
||||
return (areAllConverged(subswarm.getPopulation()));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* deactivateSubswarm
|
||||
*/
|
||||
|
||||
/**
|
||||
* @tested the subswarm is deactivated and the particles indices are returned. They are
|
||||
* The subswarm is deactivated and the particles indices are returned. They are
|
||||
* to be reinitialized into the mainswarm.
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#deactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
*/
|
||||
@Override
|
||||
public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||
@ -115,11 +105,6 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
||||
return particleIndices;
|
||||
}
|
||||
|
||||
/**
|
||||
* *******************************************************************************************************************
|
||||
* getter, setter
|
||||
*/
|
||||
|
||||
public void setEpsilon(double epsilon) {
|
||||
this.epsilon = epsilon;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class ScatterMergingStrategy extends StandardMergingStrategy {
|
||||
/**
|
||||
* @param i
|
||||
* @param j
|
||||
* @tested if both active: reinitializes subswarm j back into the main swarm and deletes it from the subswarms.
|
||||
* if both active: reinitializes subswarm j back into the main swarm and deletes it from the subswarms.
|
||||
* if both inactive: adds population of subswarm j to population of subswarm i, then deletes subswarm j.
|
||||
*/
|
||||
@Override
|
||||
|
@ -41,8 +41,7 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested the subswarms are merged, if they overlap (or are very close) and if they are of equal state
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceMergingStrategie#shouldMergeSubswarms(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
* the subswarms are merged, if they overlap (or are very close) and if they are of equal state
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldMergeSubswarms(ParticleSubSwarmOptimization subswarm1, ParticleSubSwarmOptimization subswarm2) {
|
||||
@ -108,7 +107,6 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i
|
||||
/**
|
||||
* @param i
|
||||
* @param j
|
||||
* @tested junit
|
||||
* adds population of subswarm j to population of subswarm i, then deletes subswarm j.
|
||||
*/
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ public class GenerateNeighborSubswarmCreationStrategy extends
|
||||
private double mu = 0.1;
|
||||
|
||||
/**
|
||||
* @tested creates a subswarm from the given particle and its neighbor in the mainswarm.
|
||||
* Creates a subswarm from the given particle and its neighbor in the mainswarm.
|
||||
* If the neighbors pbest is better than the particles pbest, a new neighbor is generated.
|
||||
*/
|
||||
@Override
|
||||
|
@ -9,22 +9,25 @@ import eva2.optimization.strategies.ParticleSubSwarmOptimization;
|
||||
public interface InterfaceSubswarmCreationStrategy {
|
||||
|
||||
/**
|
||||
* Decides whether a subswarm should be created for the given indy and mainswarm according to the creation strategy
|
||||
*
|
||||
* @param indy
|
||||
* @param mainswarm
|
||||
* @return
|
||||
* @tested decides whether a subswarm should be created for the given indy and mainswarm according to the creation strategie
|
||||
*/
|
||||
boolean shouldCreateSubswarm(
|
||||
AbstractEAIndividual indy,
|
||||
ParticleSubSwarmOptimization mainswarm);
|
||||
|
||||
/**
|
||||
* @param preparedSubswarm a subswarm which is appropriatly prepared
|
||||
* Creates a subswarm from indy, the details depend on the concrete strategy.
|
||||
*
|
||||
* @param preparedSubswarm a subswarm which is appropriately prepared
|
||||
* (ie its problem, optimization strategy etc. are set correctly from the "meta-optimizer")
|
||||
* Afterwards the subswarm containes the generated particles
|
||||
* Afterwards the subswarm contains the generated particles
|
||||
* @param indy a particle from which a subswarm should be created
|
||||
* @param mainSwarm the main swarm which contains indy
|
||||
* @tested creates a subswarm from indy, the details depend on the concrete strategy.
|
||||
* Creates a subswarm from indy, the details depend on the concrete strategy.
|
||||
*/
|
||||
void createSubswarm(
|
||||
ParticleSubSwarmOptimization preparedSubswarm,
|
||||
|
@ -36,9 +36,7 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
|
||||
|
||||
/**
|
||||
* @param indy main swarm particle
|
||||
* @return
|
||||
* @tested junit
|
||||
* true if the stddev of the particles fitness < delta and no constraints are violated
|
||||
* @return true if the stddev of the particles fitness < delta and no constraints are violated
|
||||
*/
|
||||
@Override
|
||||
public boolean shouldCreateSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization mainswarm) {
|
||||
@ -54,9 +52,8 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
|
||||
|
||||
/**
|
||||
* @param indy main swarm particle
|
||||
* @return
|
||||
* @tested junit
|
||||
* true, if reasons exist why no subswarm should be created from indy.
|
||||
* @return true, if reasons exist why no subswarm should be created from indy.
|
||||
*
|
||||
* Reasons like:
|
||||
* poor fitness (not implemented),
|
||||
* convergence on plateau (not implemented),
|
||||
@ -74,14 +71,10 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* createSubswarm
|
||||
*/
|
||||
|
||||
/**
|
||||
* @tested creates a subswarm from the given particle and its neighbor in the mainswarm,
|
||||
* Creates a subswarm from the given particle and its neighbor in the mainswarm,
|
||||
* then deletes the two particles from the mainswarm.
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceSubswarmCreationStrategy#createSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
||||
*/
|
||||
@Override
|
||||
public void createSubswarm(ParticleSubSwarmOptimization preparedSubswarm, AbstractEAIndividual indy, ParticleSubSwarmOptimization mainSwarm) {
|
||||
|
@ -156,8 +156,8 @@ public class PostProcess {
|
||||
* or a random subset of the cluster or the best and a random subset. Returns shallow copies!
|
||||
* returnQuota should be in [0,1] and defines, which percentage of individuals of each cluster is kept, however
|
||||
* at least one is kept per cluster.
|
||||
* lonerMode defines whether loners are discarded, kept, or treated as clusters, meaning they are kept if returnQuota > 0.
|
||||
* takeOverMode defines whether, of a cluster with size > 1, which n individuals are kept. Either the n best only,
|
||||
* lonerMode defines whether loners are discarded, kept, or treated as clusters, meaning they are kept if returnQuota > 0.
|
||||
* takeOverMode defines whether, of a cluster with size > 1, which n individuals are kept. Either the n best only,
|
||||
* or the single best and random n-1, or all n random.
|
||||
*
|
||||
* @param pop
|
||||
@ -238,9 +238,9 @@ public class PostProcess {
|
||||
* Filter the individuals of a population which have a fitness norm below a given value.
|
||||
* Returns shallow copies!
|
||||
*
|
||||
* @param pop
|
||||
* @param fitNorm
|
||||
* @param bSmaller if true, return individuals with lower or equal, else with higher fitness norm only
|
||||
* @param pop Population
|
||||
* @param fitNorm The fitness threshold
|
||||
* @param bSmallerEq if true, return individuals with lower or equal, else with higher fitness norm only
|
||||
* @return
|
||||
*/
|
||||
public static Population filterFitnessNormed(Population pop, double fitNorm, boolean bSmallerEq) {
|
||||
@ -436,7 +436,7 @@ public class PostProcess {
|
||||
* Returns the number of function calls really performed by the method and a flag indicating whether the
|
||||
* processing was aborted by the user. Sets the number of function calls
|
||||
* in the population back to the original count.
|
||||
* If the baseEvals parameter (which should be >= 0) is > 0, then the number of evaluations is set as
|
||||
* If the baseEvals parameter (which should be >= 0) is > 0, then the number of evaluations is set as
|
||||
* number of evaluations before the optimization using the given terminator.
|
||||
*
|
||||
* @param pop
|
||||
@ -471,7 +471,7 @@ public class PostProcess {
|
||||
* meaning that typically only one best is returned.
|
||||
* Returns the number of function calls really performed by the method and a flag indicating whether the
|
||||
* processing was aborted by the user. Sets the number of function calls
|
||||
* in the population back to the original count. If the baseEvals parameter (which should be >= 0) is > 0,
|
||||
* in the population back to the original count. If the baseEvals parameter (which should be >= 0) is > 0,
|
||||
* then the number of evaluations is set as
|
||||
* number of evaluations before the optimization using the given terminator.
|
||||
*
|
||||
@ -525,7 +525,7 @@ public class PostProcess {
|
||||
* @param initPerturbation
|
||||
* @param prob
|
||||
* @return
|
||||
* @see NelderMeadSimplex#createNMSPopulation(candidate, perturbRatio, range, includeCand)
|
||||
* @see NelderMeadSimplex#createNMSPopulation
|
||||
*/
|
||||
public static Pair<AbstractEAIndividual, Integer> localSolverNMS(AbstractEAIndividual cand, int hcSteps,
|
||||
double initPerturbation, AbstractOptimizationProblem prob) {
|
||||
@ -548,7 +548,7 @@ public class PostProcess {
|
||||
* @param index index of the individual for which to produce the sub population
|
||||
* @param maxRelativePerturbation
|
||||
* @param includeCand
|
||||
* @see #createPopInSubRange(double, AbstractOptimizationProblem, AbstractEAIndividual)
|
||||
* @see #createPopInSubRange
|
||||
* @see NelderMeadSimplex#createNMSPopulation(AbstractEAIndividual, double, double[][], boolean)
|
||||
*/
|
||||
public static Population createLSSupPopulation(PostProcessMethod method, AbstractOptimizationProblem problem, Population candidates, int index, double maxRelativePerturbation, boolean includeCand) {
|
||||
@ -763,7 +763,6 @@ public class PostProcess {
|
||||
*
|
||||
* @param searchBoxLen
|
||||
* @param indy
|
||||
* @return
|
||||
*/
|
||||
public static void createPopInSubRange(Population destPop, double searchBoxLen,
|
||||
int targetSize, AbstractEAIndividual indy) {
|
||||
@ -1133,8 +1132,8 @@ public class PostProcess {
|
||||
* @param treatAsUnknown
|
||||
* @param listener
|
||||
* @return
|
||||
* @see {@link AbstractOptimizationProblem#extractPotentialOptima}
|
||||
* @see AbstractOptimizationProblem#isPotentialOptimumNMS(AbstractEAIndividual, double, double, int)
|
||||
* @see AbstractOptimizationProblem#extractPotentialOptima
|
||||
* @see AbstractOptimizationProblem#isPotentialOptimumNMS
|
||||
*/
|
||||
public static int[] checkAccuracy(AbstractOptimizationProblem prob, Population sols, double[] epsilonPhenoSpace,
|
||||
double extrOptEpsFitConf, double extrOptClustSig, int maxEvals, SolutionHistogram[] solHists, boolean treatAsUnknown,
|
||||
@ -1225,7 +1224,7 @@ public class PostProcess {
|
||||
|
||||
/**
|
||||
* Select a local search range for a given method based on the clustering parameter.
|
||||
* If clustering was deactivated (sigma <= 0), then the default mutation step size is used.
|
||||
* If clustering was deactivated (sigma <= 0), then the default mutation step size is used.
|
||||
* The specific search method may interpret the search range differently.
|
||||
*
|
||||
* @param method
|
||||
@ -1254,7 +1253,7 @@ public class PostProcess {
|
||||
/**
|
||||
* Select a perturbation for individual i fitting to the population - avoiding overlap.
|
||||
* In this case, return the third of the minimum distance to the next neighbor in the population.
|
||||
* The maxPerturb can be given as upper bound of the perturbation if it is > 0.
|
||||
* The maxPerturb can be given as upper bound of the perturbation if it is > 0.
|
||||
*
|
||||
* @param candidates population of solutions to look at
|
||||
* @param i index of the individual in the population to look at
|
||||
|
@ -168,7 +168,6 @@ public class SolutionHistogram {
|
||||
* @param upperBound upper bound of the fitness interval
|
||||
* @param nBins number of bins
|
||||
* @return an integer array with the number of individuals in each bin
|
||||
* @see filterFitnessIn()
|
||||
*/
|
||||
public static SolutionHistogram createFitNormHistogram(Population pop, double lowerBound, double upperBound, int nBins, int crit) {
|
||||
SolutionHistogram res = new SolutionHistogram(lowerBound, upperBound, nBins);
|
||||
|
@ -34,7 +34,7 @@ public interface InterfaceSelection {
|
||||
void prepareSelection(Population population);
|
||||
|
||||
/**
|
||||
* This method will select >size< individuals from the given
|
||||
* This method will select *size* individuals from the given
|
||||
* Population.
|
||||
*
|
||||
* @param population The source population where to select from
|
||||
@ -44,7 +44,7 @@ public interface InterfaceSelection {
|
||||
Population selectFrom(Population population, int size);
|
||||
|
||||
/**
|
||||
* This method allows you to select >size< partners for a given Individual
|
||||
* This method allows you to select *size* partners for a given Individual
|
||||
*
|
||||
* @param dad The already seleceted parent
|
||||
* @param availablePartners The mating pool.
|
||||
|
@ -48,7 +48,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will select >size< individuals from the given
|
||||
* This method will select *size* individuals from the given
|
||||
* Population.
|
||||
*
|
||||
* @param population The source population where to select from
|
||||
@ -107,7 +107,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows you to select >size< partners for a given Individual
|
||||
* This method allows you to select *size* partners for a given Individual
|
||||
*
|
||||
* @param dad The already selected parent
|
||||
* @param availablePartners The mating pool.
|
||||
|
@ -20,7 +20,7 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ
|
||||
|
||||
private boolean obeyDebsConstViolationPrinciple = true;
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
* Comment for {@code serialVersionUID}
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private InterfaceSelectionProbability selProbCalculator = new SelProbStandard();
|
||||
@ -55,7 +55,7 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ
|
||||
/**
|
||||
* This method will select individuals from the given Population with respect to their
|
||||
* selection propability. This implements a fixed segment roulette wheel selection which ensures
|
||||
* that every individual which has a selection probability p >= (k/size) is selected k or k+1 times.
|
||||
* that every individual which has a selection probability p >= (k/size) is selected k or k+1 times.
|
||||
*
|
||||
* @param population The source population where to select from
|
||||
* @param size The number of Individuals to select
|
||||
|
@ -38,7 +38,7 @@ public class SelProbFitnessSharing extends AbstractSelProb implements java.io.Se
|
||||
* This method computes the selection probability for each individual
|
||||
* in the population. Note: Summed over the complete population the selection
|
||||
* probability sums up to one. Keep in mind that fitness is always to be
|
||||
* minimizied! Small values for data => big values for selectionprob.
|
||||
* minimizied! Small values for data => big values for selectionprob.
|
||||
*
|
||||
* @param population The population to compute.
|
||||
* @param data The input data as double[][].
|
||||
|
@ -26,7 +26,7 @@ public class SelProbStandard extends AbstractSelProb implements java.io.Serializ
|
||||
* This method computes the selection probability for each individual
|
||||
* in the population. Note: Summed over the complete population the selection
|
||||
* probability sums up to one. Keep in mind that fitness is always to be
|
||||
* minimizied! Small values for data => big values for selectionprob.
|
||||
* minimizied! Small values for data => big values for selectionprob.
|
||||
*
|
||||
* @param population The population to compute.
|
||||
* @param data The input data as double[][].
|
||||
|
@ -100,7 +100,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
public static final String NEXT_GENERATION_PERFORMED = "NextGenerationPerformed";
|
||||
|
||||
/**
|
||||
* With <code>autoAging = true</code> #incrGeneration automatically
|
||||
* With {@code autoAging = true} #incrGeneration automatically
|
||||
* ages individuals.
|
||||
*/
|
||||
private boolean autoAging = true;
|
||||
@ -485,8 +485,6 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
/**
|
||||
* Create a population instance which distributes the individuals according
|
||||
* to a random latin hypercube sampling.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static void createRLHSampling(Population pop, boolean fillPop) {
|
||||
if (pop.size() <= 0) {
|
||||
@ -523,7 +521,6 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
* @param cardinality an integer giving the number of (random) bits to set
|
||||
* @param stdDev standard deviation of the cardinality variation (can be
|
||||
* zero to fix the cardinality)
|
||||
* @return
|
||||
*/
|
||||
public static void createBinCardinality(Population pop, boolean fillPop, int cardinality, int stdDev) {
|
||||
if (pop.size() <= 0) {
|
||||
@ -630,7 +627,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
|
||||
/**
|
||||
* This method will allow you to increment the current number of function
|
||||
* calls by a number > 1. Notice that it might slightly disturb notification
|
||||
* calls by a number > 1. Notice that it might slightly disturb notification
|
||||
* if a notifyEvalInterval is set.
|
||||
*
|
||||
* @param d The number of function calls to increment by.
|
||||
@ -991,7 +988,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
/**
|
||||
* This method will return the index of the current best individual from the
|
||||
* population in the given fitness component (or using dominance when
|
||||
* fitIndex < 0). If the population is empty, -1 is returned.
|
||||
* fitIndex < 0). If the population is empty, -1 is returned.
|
||||
*
|
||||
* @return The index of the best individual.
|
||||
* @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
|
||||
@ -1006,7 +1003,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
/**
|
||||
* This method will return the index of the current best individual from the
|
||||
* population in the given fitness component (or using dominance when
|
||||
* fitIndex < 0).
|
||||
* fitIndex < 0).
|
||||
*
|
||||
* @return The index of the best individual.
|
||||
* @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
|
||||
@ -1163,12 +1160,12 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
* This method returns the n current best individuals from the population,
|
||||
* where the sorting criterion is delivered by an
|
||||
* AbstractEAIndividualComparator. There are less than n individuals
|
||||
* returned if the population is smaller than n. If n is <= 0, then all
|
||||
* returned if the population is smaller than n. If n is <= 0, then all
|
||||
* individuals are returned and effectively just sorted by fitness. This
|
||||
* does not check constraints!
|
||||
*
|
||||
* @param n number of individuals to look out for
|
||||
* @return The m best individuals, where m <= n
|
||||
* @return The m best individuals, where m <= n
|
||||
*/
|
||||
public Population getBestNIndividuals(int n, int fitIndex) {
|
||||
if (n <= 0 || (n > super.size())) {
|
||||
@ -1183,12 +1180,12 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
* This method returns the n current worst individuals from the population,
|
||||
* where the sorting criterion is delivered by an
|
||||
* AbstractEAIndividualComparator. There are less than n individuals
|
||||
* returned if the population is smaller than n. If n is <= 0, then all
|
||||
* returned if the population is smaller than n. If n is <= 0, then all
|
||||
* individuals are returned and effectively just sorted by fitness. This
|
||||
* does not check constraints!
|
||||
*
|
||||
* @param n number of individuals to look out for
|
||||
* @return The m worst individuals, where m <= n
|
||||
* @return The m worst individuals, where m <= n
|
||||
*/
|
||||
public Population getWorstNIndividuals(int n, int fitIndex) {
|
||||
Population pop = new Population(n);
|
||||
@ -1222,7 +1219,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
* individuals
|
||||
* @param res sorted result population, will be cleared
|
||||
* @param comp the Comparator to use with individuals
|
||||
* @return The m sorted best or worst individuals, where m <= n
|
||||
* @param res The m sorted best or worst individuals, where m <= n (will be added to res)
|
||||
*/
|
||||
public void getSortedNIndividuals(int n, boolean bBestOrWorst, Population res, Comparator<Object> comp) {
|
||||
if ((n < 0) || (n > super.size())) {
|
||||
@ -2082,7 +2079,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
||||
* @param indy
|
||||
* @param d
|
||||
* @param metric
|
||||
* @return true if d(indy,pop)<=d, else false
|
||||
* @return true if d(indy,pop)<=d, else false
|
||||
*/
|
||||
public boolean isWithinPopDist(AbstractEAIndividual indy, double d, InterfaceDistanceMetric metric) {
|
||||
Pair<Integer, Double> closest = Population.getClosestFarthestIndy(indy, this, metric, true);
|
||||
|
@ -1184,7 +1184,6 @@ public class ClusterBasedNichingEA extends AbstractOptimizer implements Interfac
|
||||
* the upper limit if the clustering parameter is controlled.
|
||||
*
|
||||
* @param prob
|
||||
* @param q
|
||||
*/
|
||||
public void setUpperBoundClustDiff(InterfaceProblemDouble prob) {
|
||||
if (caForSpeciesDifferentation instanceof ClusteringDensityBased) {
|
||||
|
@ -33,7 +33,7 @@ import java.util.Formatter;
|
||||
* predefined, and lambda new samples are drawn for every peak in every
|
||||
* iteration. Thus, in relation to the standard ES, some new parameters are due.
|
||||
* On the other hand, the selection schemes are predefined. This is done
|
||||
* according to Shir&Bäck, Niching in Evolution Strategies, Tec.Report 2005.
|
||||
* according to Shir&Bäck, Niching in Evolution Strategies, Tec.Report 2005.
|
||||
* <p>
|
||||
* Unfortunately the algorithm was not described in every detail. It remained
|
||||
* unclear how exactly the peak population where filled and esp. what happens if
|
||||
@ -54,7 +54,7 @@ import java.util.Formatter;
|
||||
* framework which is still used to optimize the single peak populations.
|
||||
* <p>
|
||||
* This class should also cover "Dynamic niching in evolution strategies with
|
||||
* covariance matrix adaptation" by Shir & Bäck, CEC 2005, when employing
|
||||
* covariance matrix adaptation" by Shir & Bäck, CEC 2005, when employing
|
||||
* SelectBest as parent selection and muPerPeak=1.
|
||||
* <p>
|
||||
* Some notes:
|
||||
@ -267,7 +267,7 @@ public class EsDpiNiching extends AbstractOptimizer implements Serializable, Int
|
||||
|
||||
/**
|
||||
* Use the deactivation of converged species, storing them to an archive,
|
||||
* with the given parameters. If windowLen <= 0, the deactivation mechanism
|
||||
* with the given parameters. If windowLen <= 0, the deactivation mechanism
|
||||
* is disabled. This provides for semi-sequential niching with DPI-ES
|
||||
*
|
||||
* @param threshold
|
||||
|
@ -259,7 +259,7 @@ public class EvolutionStrategies extends AbstractOptimizer implements java.io.Se
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will check the population constraints myu <= lambda and will
|
||||
* This method will check the population constraints myu <= lambda and will
|
||||
* calculate the population size accordingly.
|
||||
*/
|
||||
protected void checkPopulationConstraints() {
|
||||
|
@ -30,9 +30,9 @@ import java.util.LinkedList;
|
||||
* Lambda is increased multiplicatively for every restart, and typical initial values are
|
||||
* mu=5, lambda=10, incFact=2.
|
||||
* The IPOP-CMA-ES won the CEC 2005 benchmark challenge.
|
||||
* Refer to Auger&Hansen 05 for more details.
|
||||
* Refer to Auger&Hansen 05 for more details.
|
||||
* <p>
|
||||
* A.Auger & N.Hansen. A Restart CMA Evolution Strategy With Increasing Population Size. CEC 2005.
|
||||
* A.Auger & N.Hansen. A Restart CMA Evolution Strategy With Increasing Population Size. CEC 2005.
|
||||
*/
|
||||
@Description("An ES with increasing population size.")
|
||||
public class EvolutionStrategyIPOP extends EvolutionStrategies implements InterfacePopulationChangedEventListener, InterfaceAdditionalPopulationInformer {
|
||||
@ -186,7 +186,8 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
|
||||
/**
|
||||
* Test for the IPOP stopping criteria.
|
||||
*
|
||||
* @param population
|
||||
* @param term
|
||||
* @param pop
|
||||
* @return
|
||||
*/
|
||||
public static boolean testIPOPStopCrit(InterfaceTerminator term, Population pop) {
|
||||
|
@ -445,9 +445,8 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
||||
* This method allows you to toggle between a truly parallel and a serial
|
||||
* implementation.
|
||||
*
|
||||
* @return The current optimization mode
|
||||
*/
|
||||
// TODO Deactivated from GUI because the current implementation does not really parallelize on a multicore.
|
||||
// TODO Deactivated from GUI because the current implementation does not really paralelize on a multicore.
|
||||
// Instead, the new direct problem parallelization can be used.
|
||||
// public boolean isLocalOnly() {
|
||||
// return this.numLocalOnly;
|
||||
|
@ -66,7 +66,7 @@ import java.util.Vector;
|
||||
* subswarm can formally have, but it does not affect the actual radius. This
|
||||
* adjustment is proposed in [2] in order to improve the performance of the
|
||||
* NichePSO. Experiments showed a good performance for relatively small values
|
||||
* of maxAllowedSwarmRadius <= 0.0001 on lower dimensional problems. For higher
|
||||
* of maxAllowedSwarmRadius <= 0.0001 on lower dimensional problems. For higher
|
||||
* dimensional problems, larger values may be preferable.
|
||||
* <p>
|
||||
* [1] R. Brits, A. P. Engelbrecht and B. Bergh. A Niching Particle Swarm
|
||||
@ -147,13 +147,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
// by default, calculate the individuals fitness std dev using this number of past fitness values
|
||||
public static final int defaultFitStdDevHorizon = 3;
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* ctors, clone
|
||||
*/
|
||||
/**
|
||||
* @tested
|
||||
*/
|
||||
public NichePSO() {
|
||||
if (log) {
|
||||
initLogFile();
|
||||
@ -177,9 +170,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
GenericObjectEditor.setHideProperty(getClass(), "maxAllowedSwarmRadius", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested @param a
|
||||
*/
|
||||
public NichePSO(NichePSO a) {
|
||||
this.mainSwarmSize = a.mainSwarmSize;
|
||||
this.maxAllowedSwarmRadius = a.maxAllowedSwarmRadius;
|
||||
@ -213,17 +203,13 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested (non-Javadoc)
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new NichePSO(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested ps sets the mainswarm according to the NichePSO Parameters,
|
||||
* ps sets the mainswarm according to the NichePSO Parameters,
|
||||
* called via initialize()
|
||||
*/
|
||||
protected void initMainSwarm() {
|
||||
@ -252,7 +238,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested inits the template used for creating subswarms this is only
|
||||
* inits the template used for creating subswarms this is only
|
||||
* called in the ctor not via initialize() (would overwrite changes set from
|
||||
* outside for the next run)
|
||||
*/
|
||||
@ -279,7 +265,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return an optimizer with parameters set according to the nichePSO
|
||||
* @tested returns the optimizer that should be used to create a new
|
||||
* returns the optimizer that should be used to create a new
|
||||
* subswarm
|
||||
*/
|
||||
public ParticleSubSwarmOptimization getNewSubSwarmOptimizer() {
|
||||
@ -290,7 +276,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit, junit&, emp, ... (non-Javadoc)
|
||||
* @see eva2.optimization.strategies.InterfaceOptimizer#initialize()
|
||||
*/
|
||||
@Override
|
||||
@ -319,7 +304,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested (non-Javadoc) uses the given population and basically sets rnd
|
||||
* uses the given population and basically sets rnd
|
||||
* velocity vectors (if reset == false)
|
||||
*/
|
||||
@Override
|
||||
@ -335,11 +320,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* Optimization
|
||||
*/
|
||||
/**
|
||||
* @tested (non-Javadoc)
|
||||
* @see eva2.optimization.strategies.InterfaceOptimizer#optimize()
|
||||
*/
|
||||
@Override
|
||||
@ -498,7 +478,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit deactivates the subswarms according to the decativation
|
||||
* deactivates the subswarms according to the decativation
|
||||
* strategy
|
||||
*/
|
||||
protected void deactivateSubSwarmsIfPossible() {
|
||||
@ -546,10 +526,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
return actCnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* Merging
|
||||
*/
|
||||
protected void mergingEventFor(int i, int j) {
|
||||
if (isVerbose()) {
|
||||
System.out.print("merge condition \n");
|
||||
@ -564,7 +540,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit merges the subswarms according to the merging strategy
|
||||
* merges the subswarms according to the merging strategy
|
||||
*/
|
||||
protected void mergeSubswarmsIfPossible() {
|
||||
boolean runagain = false;
|
||||
@ -608,7 +584,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* junit absorbs the mainswarm particles into the subswarm according
|
||||
* absorbs the mainswarm particles into the subswarm according
|
||||
* to the absorbtion strategy
|
||||
*/
|
||||
protected void absorbParticlesIfPossible() {
|
||||
@ -636,10 +612,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* Subswarm Creation
|
||||
*/
|
||||
protected void subswarmCreationEventFor(AbstractEAIndividual currentindy, ParticleSubSwarmOptimization subswarm) {
|
||||
if (isVerbose()) {
|
||||
System.out.print("creating subswarm\n");
|
||||
@ -655,7 +627,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit creates a subswarm from every particle in the mainswarm
|
||||
* creates a subswarm from every particle in the mainswarm
|
||||
* that meets the convergence-criteria of the creation strategy
|
||||
*/
|
||||
protected void createSubswarmIfPossible() {
|
||||
@ -679,13 +651,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* setter, getter: population and solutions
|
||||
*/
|
||||
/**
|
||||
* @tested nn (non-Javadoc)
|
||||
*/
|
||||
@Override
|
||||
public void setPopulation(Population pop) {
|
||||
//pass on to mainswarm optimizer
|
||||
@ -695,7 +660,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
/**
|
||||
* @return a population consisting of copies from the mainswarm and all
|
||||
* active subswarms
|
||||
* @tested junit, junit&
|
||||
*/
|
||||
public Population getActivePopulation() {
|
||||
// construct a metapop with clones from the mainswarm and all active subswarms
|
||||
@ -727,7 +691,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
/**
|
||||
* @return a population consisting of copies from the mainswarm and all
|
||||
* subswarms.
|
||||
* @tested junit returns a population consisting of copies from the
|
||||
* returns a population consisting of copies from the
|
||||
* mainswarm and all subswarms (active and inactive, so the size of this
|
||||
* Population is not necessarily constant). (Especially important for the
|
||||
* call back regarding the output file... ) Beware:
|
||||
@ -788,7 +752,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
/**
|
||||
* @return a population consisting of the personal best solutions of every
|
||||
* particle in the mainswarm and all subswarms
|
||||
* @tested junit (non-Javadoc)
|
||||
* @see eva2.optimization.strategies.InterfaceOptimizer#getAllSolutions()
|
||||
*/
|
||||
@Override
|
||||
@ -819,7 +782,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return the best solution found by any particle in any swarm
|
||||
* @tested junit
|
||||
*/
|
||||
public AbstractEAIndividual getGlobalBestSolution() {
|
||||
Population metapop = getPopulation();
|
||||
@ -839,7 +801,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return array with copies of the gbest individuals
|
||||
* @tested junit returns the cloned global best individuals (ie best of all
|
||||
* returns the cloned global best individuals (ie best of all
|
||||
* time) from every subswarm and the main swarm
|
||||
*/
|
||||
public Population getSubswarmRepresentatives(boolean onlyInactive) {
|
||||
@ -859,7 +821,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @param size
|
||||
* @tested ps sets the !initial! size of the mainswarm population use this
|
||||
* ps sets the !initial! size of the mainswarm population use this
|
||||
* instead of getPopulation.setPopulationSize()
|
||||
*/
|
||||
public void setMainSwarmSize(int size) {
|
||||
@ -871,7 +833,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return the !initial! size of the mainswarm population
|
||||
* @tested nn returns the !initial! size of the mainswarm population
|
||||
* returns the !initial! size of the mainswarm population
|
||||
*/
|
||||
public int getMainSwarmSize() {
|
||||
return this.mainSwarmSize;
|
||||
@ -883,7 +845,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @param val
|
||||
* @tested ps defines the maximal allowed subswarm radius for absorption and
|
||||
* defines the maximal allowed subswarm radius for absorption and
|
||||
* merging
|
||||
*/
|
||||
public void setMaxAllowedSwarmRadius(double val) {
|
||||
@ -899,7 +861,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @tested nn
|
||||
*/
|
||||
public double getMaxAllowedSwarmRadius() {
|
||||
return this.maxAllowedSwarmRadius;
|
||||
@ -1002,7 +963,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @param val
|
||||
* @tested nn
|
||||
*/
|
||||
public void SetPartlyInactive(boolean val) {
|
||||
this.partlyInactive = val;
|
||||
@ -1010,7 +970,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @tested nn
|
||||
*/
|
||||
public boolean isPartlyInactive() {
|
||||
return partlyInactive;
|
||||
@ -1186,7 +1145,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
/**
|
||||
* @param problem
|
||||
* @tested ps This method will set the problem that is to be optimized
|
||||
* This method will set the problem that is to be optimized
|
||||
*/
|
||||
@Override
|
||||
@Hidden
|
||||
@ -1221,7 +1180,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
/**
|
||||
* @param vals
|
||||
* @return
|
||||
* @tested junit
|
||||
*/
|
||||
public double getMedian(double[] vals) {
|
||||
java.util.Arrays.sort(vals);
|
||||
@ -1299,13 +1257,9 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
return meanDiv;
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* setter, getter: infostrings
|
||||
*/
|
||||
/**
|
||||
* @return The name of the algorithm
|
||||
* @tested nn This method will return a naming String
|
||||
* This method will return a naming String
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
@ -1314,7 +1268,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return A descriptive string
|
||||
* @tested nn This method will return a string describing all properties of
|
||||
* This method will return a string describing all properties of
|
||||
* the optimizer and the applied methods.
|
||||
*/
|
||||
@Override
|
||||
@ -1327,7 +1281,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return descriptive string of the elite
|
||||
* @tested emp returns a string that lists the global best individuals (ie
|
||||
* emp returns a string that lists the global best individuals (ie
|
||||
* best of all time) from every subswarm
|
||||
*/
|
||||
public String getSubswarmRepresentativesAsString(boolean onlyInactive) {
|
||||
@ -1342,7 +1296,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @tested emp
|
||||
* emp
|
||||
*/
|
||||
public String getPerformanceAsString() {
|
||||
if (!(optimizationProblem instanceof InterfaceMultimodalProblem)) {
|
||||
@ -1390,7 +1344,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
* for the logfile
|
||||
*/
|
||||
/**
|
||||
* @tested emp generates the NichePSO_date file
|
||||
* emp generates the NichePSO_date file
|
||||
*/
|
||||
protected void initLogFile() {
|
||||
// opening output file...
|
||||
@ -1426,7 +1380,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @param line string to be written
|
||||
* @tested emp writes something to the LogFile
|
||||
* emp writes something to the LogFile
|
||||
*/
|
||||
protected void writeToLogFile(String line) {
|
||||
String write = line + "\n";
|
||||
@ -1441,16 +1395,10 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ************************************************- plotting analysing
|
||||
* debugging -************************************
|
||||
* /**********************************************************************************************************************
|
||||
* getter for debugging and analysing
|
||||
*/
|
||||
/**
|
||||
* @param index
|
||||
* @return particle with given index
|
||||
* @tested @param pop
|
||||
* @param pop
|
||||
*/
|
||||
public AbstractEAIndividual getIndyByParticleIndexAndPopulation(Population pop, Integer index) {
|
||||
for (int i = 0; i < pop.size(); ++i) {
|
||||
@ -1466,7 +1414,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @return main swarm particle with given index
|
||||
* @tested @param index
|
||||
* @param index
|
||||
*/
|
||||
public AbstractEAIndividual getIndyByParticleIndex(Integer index) {
|
||||
AbstractEAIndividual indy = null;
|
||||
@ -1486,7 +1434,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested @return particle with minimal stddev in fitness over the last 3
|
||||
* @return particle with minimal stddev in fitness over the last 3
|
||||
* iterations
|
||||
*/
|
||||
protected AbstractEAIndividual getIndyWithMinStdDev() {
|
||||
@ -1510,11 +1458,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* plotting
|
||||
*/
|
||||
/**
|
||||
* @tested inits a new Topoplot
|
||||
* Inits a new Topoplot
|
||||
*/
|
||||
protected void initPlotSwarm() {
|
||||
double[] a = new double[2];
|
||||
@ -1528,7 +1472,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested clean everything except topology colors
|
||||
* Clean everything except topology colors
|
||||
*/
|
||||
protected void cleanPlotSwarm() {
|
||||
// delete all previous points
|
||||
@ -1544,7 +1488,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested plots the std dev of all particles in the main swarm
|
||||
* Plots the std dev of all particles in the main swarm
|
||||
*/
|
||||
protected void plotAllStdDevsInMainSwarm() {
|
||||
//add further information to MainSwarm-Plot point by point
|
||||
@ -1569,7 +1513,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested plots only the minimal std dev for the respective particle
|
||||
* Plots only the minimal std dev for the respective particle
|
||||
*/
|
||||
protected void plotMinStdDevInMainSwarm() {
|
||||
//add further information to MainSwarm-Plot (minimal stddev)
|
||||
@ -1588,7 +1532,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @param boundary
|
||||
* @tested plots all std devs < boundary for the respective particles
|
||||
* Plots all std devs < boundary for the respective particles
|
||||
*/
|
||||
protected void plotBoundStdDevInMainSwarm(double boundary) {
|
||||
InterfaceDataTypeDouble tmpIndy1;
|
||||
@ -1616,7 +1560,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
/**
|
||||
* @param index index of the particle
|
||||
* @param text information to be added
|
||||
* @tested plots a circle around the individual and adds some information
|
||||
* Plots a circle around the individual and adds some information
|
||||
*/
|
||||
protected void plotCircleForIndy(int index, String text) {
|
||||
AbstractEAIndividual indy = getIndyByParticleIndex(index);
|
||||
@ -1631,7 +1575,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
/**
|
||||
* @param indy invidual
|
||||
* @param text information to be added
|
||||
* @tested plots a circle around the individual and adds some information
|
||||
* Plots a circle around the individual and adds some information
|
||||
*/
|
||||
protected void plotCircleForIndy(AbstractEAIndividual indy, String text) {
|
||||
InterfaceDataTypeDouble tmpIndy1 = (InterfaceDataTypeDouble) indy;
|
||||
@ -1643,7 +1587,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested cleans the previous plot and plots the mainswarm as points
|
||||
* Cleans the previous plot and plots the mainswarm as points
|
||||
*/
|
||||
protected void plotMainSwarm(boolean withIDs) {
|
||||
if (this.optimizationProblem instanceof Interface2DBorderProblem) {
|
||||
@ -1750,7 +1694,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested plots all subswarms as connected lines to their respective best
|
||||
* Plots all subswarms as connected lines to their respective best
|
||||
* individual
|
||||
*/
|
||||
protected void plotSubSwarms() {
|
||||
@ -1823,7 +1767,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested plots information about merging, absorbtion and subswarm-creation
|
||||
* Plots information about merging, absorption and subswarm-creation
|
||||
*/
|
||||
protected void plotAdditionalInfo() {
|
||||
// from merging
|
||||
@ -1872,7 +1816,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested @param particleIndex
|
||||
* @param particleIndex
|
||||
*/
|
||||
protected void plotTraceIndy(int particleIndex) {
|
||||
AbstractEAIndividual indy = getIndyByParticleIndex(particleIndex);
|
||||
@ -1890,7 +1834,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
|
||||
/**
|
||||
* @param indy
|
||||
* @tested plots the old position, new position, personal best position and
|
||||
* Plots the old position, new position, personal best position and
|
||||
* neighborhood best position for a given individual
|
||||
*/
|
||||
protected void plotStatusForIndy(AbstractEAIndividual indy) {
|
||||
@ -1991,7 +1935,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Niche PSO with parameters as to Brits, Engelbrecht & Bergh: A
|
||||
* Create a Niche PSO with parameters as to Brits, Engelbrecht & Bergh: A
|
||||
* Niching Particle Swarm Optimizer. SEAL 2002. Exeption: the swarm size is
|
||||
* 200 by default, because 30 (of the orig. paper) seems way too low.
|
||||
* <p>
|
||||
@ -2015,7 +1959,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameters as to Brits, Engelbrecht & Bergh: A Niching Particle Swarm
|
||||
* Set parameters as to Brits, Engelbrecht & Bergh: A Niching Particle Swarm
|
||||
* Optimizer. SEAL 2002. Exception: the swarm size is 100 by default, because
|
||||
* 30 (of the orig. paper) seems way too low.
|
||||
*
|
||||
@ -2065,8 +2009,8 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameters as to Brits, Engelbrecht & Bergh: A Niching Particle Swarm
|
||||
* Optimizer. SEAL 2002. Exeption: the swarm size is 200 by default, because
|
||||
* Set parameters as to Brits, Engelbrecht & Bergh: A Niching Particle Swarm
|
||||
* Optimizer. SEAL 2002. Exception: the swarm size is 200 by default, because
|
||||
* 30 (of the orig. paper) seems way too low.
|
||||
*
|
||||
* @param npso an already existing NichePSO instance or null to create a new one
|
||||
|
@ -31,10 +31,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
private int particleIndexCounter; // used to give each particle a unique index (for debbugging and plotting)
|
||||
private int fitnessArchiveSize = 15; // maximal number of fitnessvalues remembered from former iterations
|
||||
|
||||
/**
|
||||
* @tested ps
|
||||
* ctor
|
||||
*/
|
||||
public ParticleSubSwarmOptimization() {
|
||||
updateMaxPosDist();
|
||||
this.maxAllowedSwarmRadiusNormal = 0.1; // set similar to "particle swarms for multimodal optimization" by Oezcan and Yilmaz
|
||||
@ -43,9 +39,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
// setInitialVelocity(1.);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested cpyctor
|
||||
*/
|
||||
public ParticleSubSwarmOptimization(ParticleSubSwarmOptimization a) {
|
||||
super(a);
|
||||
if (a.bestIndividual != null) {
|
||||
@ -60,22 +53,12 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
fitnessArchiveSize = a.fitnessArchiveSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#clone()
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new ParticleSubSwarmOptimization(this);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* inits
|
||||
*/
|
||||
/**
|
||||
* @tested ps
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#initialize()
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
@ -88,10 +71,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
// setInertnessOrChi(inertnessAging.getStartValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested ps
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#initializeByPopulation(javaeva.server.oa.go.Populations.Population, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void initializeByPopulation(Population pop, boolean reset) {
|
||||
super.initializeByPopulation(pop, reset);
|
||||
@ -103,7 +82,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit&
|
||||
* adds a vector for fitnessvalues to all individuals in the swarm
|
||||
* and sets the current fitness as the first value
|
||||
*/
|
||||
@ -129,7 +107,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested emp
|
||||
* adds a std deviation value to an individual
|
||||
* and initially sets this value to infinity.
|
||||
*/
|
||||
@ -143,7 +120,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit
|
||||
* adds a representation of the personal best to an individual
|
||||
* and initially sets the current individual as its personal best.
|
||||
*/
|
||||
@ -153,13 +129,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
indy.putData("PersonalBestKey", newpbest);
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* Optimization
|
||||
*/
|
||||
/**
|
||||
* @tested ps
|
||||
* (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#optimize()
|
||||
*/
|
||||
@Override
|
||||
public void optimize() {
|
||||
super.optimize();
|
||||
@ -230,11 +199,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* updates
|
||||
*/
|
||||
/**
|
||||
* @tested ps
|
||||
* when particles enter or leave the population,
|
||||
* call this method to update the status of the population
|
||||
*/
|
||||
@ -243,7 +208,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit&
|
||||
* updates the bestIndividual member which represents the gbest individual
|
||||
* (i.e. the best position and fitness encountered by any particle of the swarm)
|
||||
* Beware: if a particle enters the swarm its knowledge about its pbest enters the swarm,
|
||||
@ -271,7 +235,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit, dbg
|
||||
* adds the current fitnessvalue to the fitnessarchive for every individual in the swarm.
|
||||
* Keeps the fitnessarchive at a limited size (lim+1).
|
||||
*/
|
||||
@ -299,7 +262,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit
|
||||
* sets the std dev value of all individuals in the swarm
|
||||
* to the std deviation over the last 3 fitness values
|
||||
*/
|
||||
@ -315,7 +277,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit&, junit
|
||||
* update the personal best representation if the current individual is better than the pbest
|
||||
*/
|
||||
public void updatePersonalBest() {
|
||||
@ -336,7 +297,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit ..
|
||||
* updates the member representing the maximal possible distance in the current searchspace
|
||||
*/
|
||||
public void updateMaxPosDist() {
|
||||
@ -385,7 +345,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
* @param indy1
|
||||
* @param indy2
|
||||
* @return
|
||||
* @tested junit
|
||||
* returns the euclidean distance in the search space between indy1 and indy2.
|
||||
*/
|
||||
public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) {
|
||||
@ -397,9 +356,8 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
* @param vec
|
||||
* @param range number of values (beginning at the end of vec!) considered to compute the mean
|
||||
* @return
|
||||
* @tested junit
|
||||
* returns the mean value for the provided data vec but only for a given number of values.
|
||||
* If range > vec.size() the mean is computed only for the available data.
|
||||
* If range > vec.size() the mean is computed only for the available data.
|
||||
*/
|
||||
protected static double mean(Vector<Double> vec, int range) {
|
||||
if (vec.size() < range) {
|
||||
@ -416,7 +374,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
* @param vec data
|
||||
* @param range number of values (beginning at the end of vec!) considered to compute the std deviation
|
||||
* @return
|
||||
* @tested junit
|
||||
* returns the std deviation for the provided data vec but only for a given number of values
|
||||
*/
|
||||
public static double stdDev(Vector<Double> vec, int range) {
|
||||
@ -443,11 +400,10 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
/**
|
||||
* @param normalisedRadius
|
||||
* @return
|
||||
* @tested ps
|
||||
* Interpretes the given maximal radius as normalised according to the current search space.
|
||||
* Values from [0,1], 1 means the radius can be as large as the maximal possible distance
|
||||
* (between any two points) in the search space.
|
||||
* Because the swarmradius and distances (e.g. in merging and absortion) are given in a standard euclidean metric,
|
||||
* Because the swarmradius and distances (e.g. in merging and absorption) are given in a standard euclidean metric,
|
||||
* this function converts the normalised distance into the standard euclidean distance.
|
||||
*/
|
||||
public double interpreteAsNormalisedSwarmRadius(double normalisedRadius) {
|
||||
@ -458,13 +414,8 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
return normalisedRadius * maxPosDist;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* addNewParticlesToPopulation ...
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param particleIndices set of indices that should be used for the added particles, if null new indices are created
|
||||
* @tested junit ...
|
||||
* adds new particles to this swarm, rndly inited over the search space by the problem
|
||||
*/
|
||||
private void addNewParticlesToPopulation(int[] particleIndices) {
|
||||
@ -510,7 +461,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
*/
|
||||
/**
|
||||
* @param pop
|
||||
* @tested nn
|
||||
* adds a population and its function calls to this.population
|
||||
*/
|
||||
public void addPopulation(ParticleSubSwarmOptimization pop) {
|
||||
@ -519,7 +469,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @param pop
|
||||
* @tested junit& ..
|
||||
* adds a population and its function calls to this.population
|
||||
*/
|
||||
public void addPopulation(Population pop) {
|
||||
@ -532,7 +481,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
/**
|
||||
* @param ind
|
||||
* @return
|
||||
* @tested nn
|
||||
* adss an inidividual
|
||||
*/
|
||||
public boolean addIndividual(IndividualInterface ind) {
|
||||
@ -544,7 +492,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
/**
|
||||
* @param o
|
||||
* @return
|
||||
* @tested nn
|
||||
*/
|
||||
public boolean add(Object o) {
|
||||
return addIndividual((IndividualInterface) o);
|
||||
@ -552,7 +499,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @param indy
|
||||
* @tested nn
|
||||
* adds indy to the swarm
|
||||
*/
|
||||
public void add(AbstractEAIndividual indy) {
|
||||
@ -561,7 +507,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @param ind
|
||||
* @tested nn
|
||||
* removes an individual
|
||||
*/
|
||||
public boolean removeSubIndividual(IndividualInterface ind) {
|
||||
@ -579,22 +524,8 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void removeNIndividuals(int n) {
|
||||
}
|
||||
public void removeDoubleInstances() {
|
||||
}
|
||||
public void removeDoubleInstancesUsingFitness() {
|
||||
}
|
||||
public void removeIndexSwitched(int index) {
|
||||
}*/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* getter, setter
|
||||
*/
|
||||
/**
|
||||
* @param problem
|
||||
* @tested ps
|
||||
* This method will set the problem that is to be optimized
|
||||
*/
|
||||
@Override
|
||||
@ -605,7 +536,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @return the maximal euclidean distance between the swarms gbest and any other particle in the swarm.
|
||||
* @tested junit
|
||||
*/
|
||||
public double getSwarmRadius() {
|
||||
if (getPopulation().size() == 0 || getPopulation().size() == 1) {
|
||||
@ -631,7 +561,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @tested ps
|
||||
* returns the maximal distance between the gbest position and any individual in the swarm
|
||||
* this distance is not allowed to exceed a given threshold
|
||||
*/
|
||||
@ -680,7 +609,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @param maxAllowedSwarmRadius value from the intervall [0,1]
|
||||
* @tested nn
|
||||
* binds the swarmradius to the given normalised value
|
||||
* (f.e. 1 means, that the swarmradius is allowed to take the maximal possible range in the search space)
|
||||
*/
|
||||
@ -690,7 +618,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @tested nn
|
||||
*/
|
||||
public double getMaxAllowedSwarmRadius() {
|
||||
return this.maxAllowedSwarmRadiusNormal;
|
||||
@ -698,7 +625,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @param active
|
||||
* @tested nn
|
||||
* marks the swarm as active or inactive
|
||||
*/
|
||||
public void SetActive(boolean active) {
|
||||
@ -707,7 +633,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @tested nn
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
@ -728,7 +653,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
/**
|
||||
* @param indy particle should be from this swarm
|
||||
* @return null if there is no neighbor else neighbor
|
||||
* @tested junit
|
||||
* returns the particle with the minimal distance to indy
|
||||
*/
|
||||
public AbstractEAIndividual getMemberNeighbor(AbstractEAIndividual indy) {
|
||||
|
@ -585,8 +585,8 @@ public class ParticleSwarmOptimization extends AbstractOptimizer implements java
|
||||
* This method will update a given individual according to the PSO method
|
||||
*
|
||||
* @param index The individual to update.
|
||||
* @param indy An individual
|
||||
* @param pop The current population.
|
||||
* @param best The best individual found so far.
|
||||
*/
|
||||
protected void updateIndividual(int index, AbstractEAIndividual indy, Population pop) {
|
||||
if (indy instanceof InterfaceDataTypeDouble) {
|
||||
@ -845,7 +845,6 @@ public class ParticleSwarmOptimization extends AbstractOptimizer implements java
|
||||
*
|
||||
* @param index index of the individual for which to check
|
||||
* @param pop the current swarm
|
||||
* @param best the currently best individual
|
||||
* @return a copy of the position of the best remembered individual in the
|
||||
* neigbourhood
|
||||
*/
|
||||
@ -1558,7 +1557,7 @@ public class ParticleSwarmOptimization extends AbstractOptimizer implements java
|
||||
* usually set to 2.05. The sum tau1 and tau2 must be greater than 4. The
|
||||
* Chi parameter (constriction) is set as in 2 Chi =
|
||||
* ------------------------ |2-tau-sqrt(tau^2-4 tau)| where tau = tau1 +
|
||||
* tau2 See Clerc&Kennedy: The Particle Swarm: Explosion, stability and
|
||||
* tau2 See Clerc&Kennedy: The Particle Swarm: Explosion, stability and
|
||||
* convergence, 2002.
|
||||
*
|
||||
* @param tau1
|
||||
@ -1744,7 +1743,7 @@ public class ParticleSwarmOptimization extends AbstractOptimizer implements java
|
||||
}
|
||||
|
||||
/**
|
||||
* @param set swarm visualization (2D)
|
||||
* @param show
|
||||
*/
|
||||
public void setShow(boolean show) {
|
||||
this.show = show;
|
||||
|
@ -28,13 +28,9 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
||||
|
||||
protected int getAccelerationForGlobalBestParticleCounter = 0; // only for testing
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* ctors, inits
|
||||
*/
|
||||
/**
|
||||
* @tested ps
|
||||
* ctor - sets default values according to
|
||||
* "An Analyis of Paricle Swarm Optimizers" by Franz van den Bergh
|
||||
* Sets default values according to
|
||||
* "An Analysis of Particle Swarm Optimizers" by Franz van den Bergh
|
||||
*/
|
||||
public ParticleSwarmOptimizationGCPSO() {
|
||||
setGcpso(true);
|
||||
@ -52,7 +48,6 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
||||
|
||||
/**
|
||||
* @param a
|
||||
* @tested ps
|
||||
*/
|
||||
public ParticleSwarmOptimizationGCPSO(ParticleSwarmOptimizationGCPSO a) {
|
||||
super(a);
|
||||
@ -73,12 +68,6 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
||||
this.SetRhoDecreaseFactor(a.getRhoDecreaseFactor());
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* overwritten
|
||||
*/
|
||||
/**
|
||||
* @tested (non-Javadoc) @see javaeva.server.go.strategies.ParticleSwarmOptimization#optimize()
|
||||
*/
|
||||
@Override
|
||||
public void optimize() {
|
||||
super.optimize(); //updatePopulation->updateIndividual->updateVelocity (s.u.)
|
||||
@ -86,7 +75,6 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
||||
}
|
||||
|
||||
/**
|
||||
* @tested junit&
|
||||
* (non-Javadoc) @see javaeva.server.go.strategies.ParticleSwarmOptimization#updateVelocity(int, double[], double[], double[], double[], double[][])
|
||||
* uses a special velocity update strategy for the gobal best particle.
|
||||
*/
|
||||
@ -138,7 +126,6 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
||||
/**
|
||||
* @return the index of the particle with the best personal best position
|
||||
* (i.e. the index of the global best particle)
|
||||
* @tested junit
|
||||
*/
|
||||
protected int getIndexOfGlobalBestParticle() {
|
||||
if (getPopulation().size() == 0) {
|
||||
@ -158,11 +145,7 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
||||
return index;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* updateGCPSOMember
|
||||
*/
|
||||
/**
|
||||
* @tested junit
|
||||
* updates: gbestParticleIndex,gbestParticleHasChanged,numOfSuccesses,numOfFailures,gbestParticle,rho
|
||||
*/
|
||||
protected void updateGCPSOMember() {
|
||||
|
@ -39,10 +39,7 @@ import java.util.List;
|
||||
* though.
|
||||
*
|
||||
* @author Maurice Clerc, Marcel Kronfeld
|
||||
* @author Maurice.Clerc@WriteMe.com {@link http://mauriceclerc.net}
|
||||
* {@link http://clerc.maurice.free.fr/pso/}
|
||||
* @version 2006-02 21
|
||||
* @date 2007-09-13
|
||||
* @author Maurice.Clerc@WriteMe.com
|
||||
* <p>
|
||||
* Original notes:
|
||||
*/
|
||||
@ -461,21 +458,21 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
|
||||
* save("\n" + iter + " " + evalF + " " + swarm.Best.position.totalError + "
|
||||
* " + swarm.size, runSave);
|
||||
*
|
||||
* // Evaluate the stop criterion stop = evalF >= pb.maxEval || pb.accuracy
|
||||
* // Evaluate the stop criterion stop = evalF >= pb.maxEval || pb.accuracy
|
||||
* > swarm.Best.position.totalError;
|
||||
*
|
||||
* if (Tribes.adaptOption == 0) { continue iterations; }
|
||||
*
|
||||
* if (Tribes.adaptOption == 1) { // Just reinitialize the swarm
|
||||
* adaptThreshold = iter - adapt; // adaptMax=swarmSize; adaptMax =
|
||||
* swarm.linkNb(swarm); if (adaptThreshold >= adaptMax) { if
|
||||
* (swarm.Best.positionPrev.totalError <= swarm.Best.position.totalError) {
|
||||
* swarm.linkNb(swarm); if (adaptThreshold >= adaptMax) { if
|
||||
* (swarm.Best.positionPrev.totalError <= swarm.Best.position.totalError) {
|
||||
* adapt = iter; // Memorize at which iteration adaptation occurs
|
||||
*
|
||||
* for (n = 0; n < swarm.tribeNb; n++) {
|
||||
* evalF=swarm.tribes[n].reinitTribe(pb,evalF); } } } continue iterations; }
|
||||
*
|
||||
* // if(swarm.Best.positionPrev.totalError<=swarm.Best.position.totalError)
|
||||
* // if(swarm.Best.positionPrev.totalError<=swarm.Best.position.totalError)
|
||||
* { // Structural adaptations
|
||||
*
|
||||
* //swarmSize = swarm.swarmSize(swarm);
|
||||
@ -490,7 +487,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
|
||||
* adaptThreshold = iter - adapt; // adaptMax=swarmSize; adaptMax =
|
||||
* swarm.linkNb(swarm);
|
||||
*
|
||||
* if (adaptThreshold >= adaptMax) { adapt = iter; // Memorize at which
|
||||
* if (adaptThreshold >= adaptMax) { adapt = iter; // Memorize at which
|
||||
* iteration adaptation occurs evalF=swarm.adaptSwarm(pb,
|
||||
* Tribes.adaptOption, swarm, displayPb,evalF); // Réalise l'adaptation
|
||||
*
|
||||
|
@ -8,7 +8,7 @@ import java.util.Comparator;
|
||||
* Comparator implementation which compares two double arrays.
|
||||
* It assigns -1 if first is pareto dominant (smaller), 1 if second is pareto dominant (larger), 0 if the two ind.s
|
||||
* are not comparable.
|
||||
* If a criterion>=0 is specified, only the thereby indexed entry of any array
|
||||
* If a criterion>=0 is specified, only the thereby indexed entry of any array
|
||||
* will be used for comparison (single criterion case).
|
||||
*/
|
||||
public class DoubleArrayComparator implements Comparator<Object> {
|
||||
|
@ -251,7 +251,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
|
||||
|
||||
/**
|
||||
* Implement an indicator for when changes in the problem environment are necessary. If it returns
|
||||
* <code>true</code>, the <code>changeProblemAt(double problemTime)</code> will be called.
|
||||
* {@code true}, the {@code changeProblemAt(double problemTime)} will be called.
|
||||
*
|
||||
* @param problemTime the current simulation time of the problem
|
||||
* @return true, if the problem is to change at the given time, else false
|
||||
|
@ -308,7 +308,7 @@ public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDoub
|
||||
/**
|
||||
* Calculates the maximum peak ratio based on the given fitness values.
|
||||
* This is the standard formulation of MPR which assumes that all fitness
|
||||
* values are positive (and for a corresponding pair, foundFits[i]<realFits[i]).
|
||||
* values are positive (and for a corresponding pair, foundFits[i] < realFits[i]).
|
||||
* If these assumptions hold, the MPR lies in [0,1].
|
||||
*
|
||||
* @param realFits
|
||||
|
@ -337,7 +337,7 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
||||
|
||||
/**
|
||||
* This method allows you to request a graphical representation for a given individual.
|
||||
* The additional informations generation and funCalls are shown if they are >= 0.
|
||||
* The additional informations generation and funCalls are shown if they are >= 0.
|
||||
* individual.
|
||||
*
|
||||
* @param generation generation of the individual or -1
|
||||
@ -446,9 +446,9 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
||||
* @param orig individual that is to be tested
|
||||
* @param epsilon maximal allowed improvement before considered premature (given as distance in the search space)
|
||||
* @param mutationStepSize step size used to mutate the individual in one step
|
||||
* (if < 0 a default value of 0.0001 is used)
|
||||
* (if < 0 a default value of 0.0001 is used)
|
||||
* @param numOfFailures number of unsuccessful improvement steps in a row before an individual is considered to be locally unimproveable
|
||||
* (if < 0 a default value of 100*problem dimensions is used )
|
||||
* (if < 0 a default value of 100*problem dimensions is used )
|
||||
* @return estimation if the given individual is within epsilon of an optimum (local or global)
|
||||
*/
|
||||
public boolean isPotentialOptimum(AbstractEAIndividual orig, double epsilon, double mutationStepSize, int numOfFailures) {
|
||||
|
@ -28,7 +28,7 @@ public class ERPStarter {
|
||||
/**
|
||||
* Start an external runtime problem with some basic configs. The
|
||||
* default variant uses equally weighs all objectives through an equally weighted sum.
|
||||
* Arguments: --csv <path-to-csv-config-file> --cmd <command-with-full-path> --maxEvals <maxEvals> [--multiObjective] [--gui]
|
||||
* Arguments: {@code --csv path-to-csv-config-file> --cmd <command-with-full-path> --maxEvals <maxEvals> [--multiObjective] [--gui]}
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
@ -40,7 +40,7 @@ public class ERPStarter {
|
||||
// prefix for data output file - set null to deactivate
|
||||
String outputFilePrefix = "erpTest";
|
||||
|
||||
/** Argument handling ****************/
|
||||
// Argument handling
|
||||
String[] keys = new String[]{"--gui", "--multiObjective", "--csv", "--cmd", "--maxEvals"};
|
||||
int[] arities = new int[]{0, 0, 1, 1, 1};
|
||||
Object[] values = new Object[6];
|
||||
|
@ -5,7 +5,7 @@ import eva2.util.annotation.Description;
|
||||
|
||||
/**
|
||||
* Bohachevsky function, numerous optima on an oval hyperparabola with similar attractor sizes
|
||||
* but decreasing fitness towards the bounds. Described e.g. in Shir&Bäck, PPSN 2006,
|
||||
* but decreasing fitness towards the bounds. Described e.g. in Shir&Bäck, PPSN 2006,
|
||||
* "Niche radius adaption in the CMA-ES Niching Algorithm".
|
||||
* f_B(\vec{x})=\sum_{i=1}^{n-1} x_i^2+2(x_{i+1}^2)+0.7-0.3 cos (3 \pi x_i)-0.4 cos (4 \pi x_{i+1})
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@ package eva2.problems;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
/**
|
||||
* N-Function from Shir&Baeck, PPSN 2006.
|
||||
* N-Function from Shir&Baeck, PPSN 2006.
|
||||
*/
|
||||
@Description("N-Function from Shir&Baeck, PPSN 2006")
|
||||
public class F18Problem extends AbstractProblemDouble implements
|
||||
|
@ -8,7 +8,7 @@ import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Fletcher-Powell function with up to 2^n optima from Shir&Baeck, PPSN 2006,
|
||||
* Fletcher-Powell function with up to 2^n optima from Shir&Baeck, PPSN 2006,
|
||||
* after Bäck 1996. Alphas and Matrices A and B are randomly created with a fixed seed.
|
||||
*
|
||||
*/
|
||||
|
@ -7,7 +7,7 @@ import eva2.util.annotation.Description;
|
||||
/**
|
||||
* Sphere Problem
|
||||
*/
|
||||
@Description(value ="Sphere Problem")
|
||||
@Description(value = "Sphere Problem")
|
||||
public class F1Problem extends AbstractProblemDoubleOffset implements Interface2DBorderProblem, InterfaceHasInitRange, java.io.Serializable, InterfaceFirstOrderDerivableProblem {
|
||||
private double initialRangeRatio = 1.; // reduce to initialize in a smaller subrange of the original range (in the corner box)
|
||||
|
||||
@ -103,7 +103,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
}
|
||||
|
||||
/**
|
||||
* If initialRangeRatio<1, produce a reduced initial range in the negative corner of the range.
|
||||
* If initialRangeRatio < 1, produce a reduced initial range in the negative corner of the range.
|
||||
*/
|
||||
@Override
|
||||
public Object getInitializationRange() {
|
||||
|
@ -89,7 +89,7 @@ public class F22Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
}
|
||||
|
||||
/**
|
||||
* If initialRangeRatio<1, produce a reduced initial range in the negative corner of the range.
|
||||
* If initialRangeRatio < 1, produce a reduced initial range in the negative corner of the range.
|
||||
*/
|
||||
@Override
|
||||
public Object getInitializationRange() {
|
||||
|
@ -90,7 +90,7 @@ public class F23Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
}
|
||||
|
||||
/**
|
||||
* If initialRangeRatio<1, produce a reduced initial range in the negative corner of the range.
|
||||
* If initialRangeRatio < 1, produce a reduced initial range in the negative corner of the range.
|
||||
*/
|
||||
@Override
|
||||
public Object getInitializationRange() {
|
||||
|
@ -10,7 +10,7 @@ import eva2.tools.EVAERROR;
|
||||
* A helper problem class which takes a GP program as argument and serves as target function
|
||||
* for evaluating the GP function in optimization. A scaling option is implemented to flatten the
|
||||
* function by scaling it logarithmically. This avoids ugly functions in GP. To activate scaling,
|
||||
* set the scStart and scLimit parameters to positive values. Function values y with |y|>scStart
|
||||
* set the scStart and scLimit parameters to positive values. Function values y with |y| > scStart
|
||||
* will be rescaled to values below scLimit.
|
||||
*/
|
||||
public class GPFunctionProblem extends AbstractProblemDouble implements InterfaceProgramProblem {
|
||||
|
@ -48,7 +48,6 @@ import java.util.zip.ZipInputStream;
|
||||
* @author wegnerj
|
||||
* @author Robin Friedman, rfriedman@TriadTherapeutics.com
|
||||
* @author Gerd Mueller
|
||||
* @license GPL
|
||||
*/
|
||||
public class BasicResourceLoader implements ResourceLoader {
|
||||
/**
|
||||
|
@ -21,9 +21,9 @@ import java.awt.print.PageFormat;
|
||||
import java.awt.print.Printable;
|
||||
|
||||
/**
|
||||
* DArea is the crossing of the <code>JComponent</code>s and the
|
||||
* <code>DComponent</code>s. It's the <code>DParent</code> which can be added to
|
||||
* <code>JComponent</code>s
|
||||
* DArea is the crossing of the {@code JComponent}s and the
|
||||
* {@code DComponent}s. It's the {@code DParent} which can be added to
|
||||
* {@code JComponent}s
|
||||
*/
|
||||
public class DArea extends JComponent implements DParent, Printable {
|
||||
/**
|
||||
@ -282,8 +282,8 @@ public class DArea extends JComponent implements DParent, Printable {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if the grid is visible <code>true</code> if the grid is visible
|
||||
* or <code>false</code> if not
|
||||
* returns if the grid is visible {@code true} if the grid is visible
|
||||
* or {@code false} if not
|
||||
*
|
||||
* @return true or false
|
||||
*/
|
||||
@ -294,7 +294,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
||||
/**
|
||||
* returns whether the DArea's auto focus is on or not
|
||||
*
|
||||
* @return <code>true</code> or <code>false</code>
|
||||
* @return {@code true} or {@code false}
|
||||
*/
|
||||
public boolean isOnAutoFocus() {
|
||||
return autoFocus;
|
||||
@ -347,7 +347,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
||||
|
||||
/**
|
||||
* method paints the grid how the method paints the grid depends on whether
|
||||
* the area is wrapped in a <code>ScaledBorder</code> or not and on the
|
||||
* the area is wrapped in a {@code ScaledBorder} or not and on the
|
||||
* autoGrid option
|
||||
*/
|
||||
private void paintGrid(DMeasures m) {
|
||||
@ -586,7 +586,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
||||
|
||||
/**
|
||||
* sets the grid to the front that means that the grid is painted as last
|
||||
* element default value is <code>false</code>
|
||||
* element default value is {@code false}
|
||||
*
|
||||
* @param aFlag grid t front or not
|
||||
*/
|
||||
@ -669,7 +669,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
||||
/**
|
||||
* sets the minimal rectangle
|
||||
*
|
||||
* @param rect the visible <code>DRectangle</code> in DArea coordinates
|
||||
* @param rect the visible {@code DRectangle} in DArea coordinates
|
||||
*/
|
||||
public void setMinRectangle(DRectangle rect) {
|
||||
if (rect.isEmpty()) {
|
||||
@ -724,7 +724,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
||||
/**
|
||||
* sets the visible rectangle
|
||||
*
|
||||
* @param rect the visible <code>DRectangle</code> in DArea coordinates
|
||||
* @param rect the visible {@code DRectangle} in DArea coordinates
|
||||
*/
|
||||
public void setVisibleRectangle(DRectangle rect) {
|
||||
if (rect.isEmpty()) {
|
||||
|
@ -97,9 +97,9 @@ public class DArray implements DIntDoubleMap {
|
||||
* the given image value becomes the image of (highest source value + 1)
|
||||
*
|
||||
* @param image the new image value
|
||||
* @return <code>true</code> when the minimal or the maximal image value
|
||||
* @return {@code true} when the minimal or the maximal image value
|
||||
* has been changed by this method call, else it returns
|
||||
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
|
||||
* {@code false} @see #getMinImageValue(), #getMaxImageValue()
|
||||
*/
|
||||
@Override
|
||||
public boolean addImage(double image) {
|
||||
@ -150,7 +150,7 @@ public class DArray implements DIntDoubleMap {
|
||||
/**
|
||||
* this method checks if the minimal and the maximal image value has changed
|
||||
*
|
||||
* @return <code>true</code> if one of them changed
|
||||
* @return {@code true} if one of them changed
|
||||
*/
|
||||
@Override
|
||||
public boolean restore() {
|
||||
@ -230,7 +230,7 @@ public class DArray implements DIntDoubleMap {
|
||||
* It looks for differences in the stored image values
|
||||
*
|
||||
* @param o the object to compare with
|
||||
* @return <code>true</code> when the object is an DArray object, containing
|
||||
* @return {@code true} when the object is an DArray object, containing
|
||||
* the same values
|
||||
*/
|
||||
@Override
|
||||
|
@ -3,9 +3,9 @@ package eva2.tools.chart2d;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* <code>DComponent</code> is the mother of all objects which can be displayed
|
||||
* by a <code>DArea</code> object, even when it would be also enough to
|
||||
* implement the <code>DElement</code> interface to an class
|
||||
* {@code DComponent} is the mother of all objects which can be displayed
|
||||
* by a {@code DArea} object, even when it would be also enough to
|
||||
* implement the {@code DElement} interface to an class
|
||||
* <p>
|
||||
* DComponent is abstract because the paint method has to be overridden
|
||||
*/
|
||||
|
@ -65,7 +65,7 @@ public class DGrid extends DComponent {
|
||||
/**
|
||||
* paints the grid...
|
||||
*
|
||||
* @param m the <code>DMeasures</code> object to paint the grid
|
||||
* @param m the {@code DMeasures} object to paint the grid
|
||||
*/
|
||||
@Override
|
||||
public void paint(DMeasures m) {
|
||||
|
@ -16,9 +16,9 @@ public interface DIntDoubleMap {
|
||||
*
|
||||
* @param source the preimage of the image
|
||||
* @param image the new image of the source value
|
||||
* @return <code>true</code> when the minimal or the maximal image value
|
||||
* @return {@code true} when the minimal or the maximal image value
|
||||
* has been changed by this method call, else it returns
|
||||
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
|
||||
* {@code false} @see #getMinImageValue(), #getMaxImageValue()
|
||||
*/
|
||||
boolean setImage(int source, double image);
|
||||
|
||||
@ -34,9 +34,9 @@ public interface DIntDoubleMap {
|
||||
* the image of the highest source value + 1 should be the given image value
|
||||
*
|
||||
* @param image the new image value
|
||||
* @return <code>true</code> when the minimal or the maximal image value
|
||||
* @return {@code true} when the minimal or the maximal image value
|
||||
* has been changed by this method call, else it returns
|
||||
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
|
||||
* {@code false} @see #getMinImageValue(), #getMaxImageValue()
|
||||
*/
|
||||
boolean addImage(double image);
|
||||
|
||||
@ -72,10 +72,10 @@ public interface DIntDoubleMap {
|
||||
double getMinPositiveImageValue();
|
||||
|
||||
/**
|
||||
* checks the minimal and the maximal image values and returns <code>true</code>
|
||||
* checks the minimal and the maximal image values and returns {@code true}
|
||||
* when at least one of them has changed
|
||||
*
|
||||
* @return <code>true</code> when either the maximal image value or the
|
||||
* @return {@code true} when either the maximal image value or the
|
||||
* minimal image value has changed
|
||||
*/
|
||||
boolean restore();
|
||||
|
@ -41,7 +41,7 @@ public class DMeasures implements Serializable {
|
||||
/**
|
||||
* method returns the pixel-point which belongs to the given D-coordinates
|
||||
* it says where to paint a certain DPoint
|
||||
* returns <code>null</code> if the double coordinates do not belong to the
|
||||
* returns {@code null} if the double coordinates do not belong to the
|
||||
* image of the scale functions
|
||||
*
|
||||
* @param x the double x D-coordinate
|
||||
@ -74,7 +74,7 @@ public class DMeasures implements Serializable {
|
||||
/**
|
||||
* method returns the point in D-coordinates which corresponds to the
|
||||
* given pixel-coordinates
|
||||
* returns <code>null</code> if the given coordinates can not be calculated to
|
||||
* returns {@code null} if the given coordinates can not be calculated to
|
||||
* the double coordinates, when they represent a point outside of the definition
|
||||
* area of the scale functions
|
||||
*
|
||||
@ -168,7 +168,7 @@ public class DMeasures implements Serializable {
|
||||
* method returns the image rectangle of the given rectangle
|
||||
* they differ if there are scale functions selected which are not the identity
|
||||
* if the given rectangle does not belong to the definition area of the scale
|
||||
* functions, the method returns <code>null</code>
|
||||
* functions, the method returns {@code null}
|
||||
*
|
||||
* @return the source of it
|
||||
*/
|
||||
@ -201,7 +201,7 @@ public class DMeasures implements Serializable {
|
||||
* method returns the source rectangle of the given rectangle
|
||||
* they differ if there are scale functions selected which are not the identity
|
||||
* if the given rectangle does not belong to the image area of the scale
|
||||
* functions, the method returns <code>null</code>
|
||||
* functions, the method returns {@code null}
|
||||
* <p>
|
||||
* Tuning: rect must not be empty
|
||||
*
|
||||
|
@ -238,12 +238,12 @@ public class DPointSet extends DComponent {
|
||||
|
||||
/**
|
||||
* method returns the index to the nearest
|
||||
* <code>DPoint</code> in this
|
||||
* <code>DPointSet</code>.
|
||||
* {@code DPoint} in this
|
||||
* {@code DPointSet}.
|
||||
*
|
||||
* @return the index to the nearest
|
||||
* <code>DPoint</code>. -1 if no nearest
|
||||
* <code>DPoint</code> was found.
|
||||
* {@code DPoint}. -1 if no nearest
|
||||
* {@code DPoint} was found.
|
||||
*/
|
||||
public int getNearestDPointIndex(DPoint point) {
|
||||
double minValue = Double.MAX_VALUE;
|
||||
@ -262,11 +262,11 @@ public class DPointSet extends DComponent {
|
||||
|
||||
/**
|
||||
* method returns the nearest
|
||||
* <code>DPoint</code> in this
|
||||
* <code>DPointSet</code>.
|
||||
* {@code DPoint} in this
|
||||
* {@code DPointSet}.
|
||||
*
|
||||
* @return the nearest
|
||||
* <code>DPoint</code>
|
||||
* {@code DPoint}
|
||||
*/
|
||||
public DPoint getNearestDPoint(DPoint point) {
|
||||
int minIndex = getNearestDPointIndex(point);
|
||||
|
@ -145,8 +145,8 @@ public class ScaledBorder implements Border {
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor creates a new <code>ScaledBorder</code>
|
||||
* surrounded by the specified <code>Border</code>
|
||||
* constructor creates a new {@code ScaledBorder}
|
||||
* surrounded by the specified {@code Border}
|
||||
*/
|
||||
public ScaledBorder(Border outer) {
|
||||
outerBorder = outer;
|
||||
|
@ -39,6 +39,8 @@ public class ColorBarCalculator {
|
||||
/**
|
||||
* Returns color for the given float-value, which must be in the range from 0 to 1.
|
||||
* Warning: Creates new color object, better use the method 'getRGB' if possible.
|
||||
*
|
||||
* @param value Value to be converted into RGB color.
|
||||
*/
|
||||
public Color getColor(float value) {
|
||||
return new Color(getRGB(value));
|
||||
@ -46,6 +48,8 @@ public class ColorBarCalculator {
|
||||
|
||||
/**
|
||||
* Returns color RGB-value for the given float-value, which must be in the range from 0 to 1.
|
||||
*
|
||||
* @param value Value to be converted into RGB color.
|
||||
*/
|
||||
public int getRGB(float value) {
|
||||
int rgbValue = 0;
|
||||
@ -82,7 +86,7 @@ public class ColorBarCalculator {
|
||||
/**
|
||||
* Reverts color scale (e.g. black will be white and vice versa).
|
||||
*
|
||||
* @param isInverse Color scale is inverted, if <code>isInverse</code> is set to true.
|
||||
* @param isInverse Color scale is inverted, if {@code isInverse} is set to true.
|
||||
*/
|
||||
public void setInverseScale(boolean isInverse) {
|
||||
inverseScale = isInverse;
|
||||
@ -91,7 +95,7 @@ public class ColorBarCalculator {
|
||||
/**
|
||||
* Returns current scale mode.
|
||||
*
|
||||
* @return <code>true</code> if scale is inverted, else <code>false</code>.
|
||||
* @return {@code true} if scale is inverted, else {@code false}.
|
||||
*/
|
||||
public boolean isInverseScale() {
|
||||
return inverseScale;
|
||||
|
@ -90,15 +90,15 @@ public final class Mathematics {
|
||||
* @param y another vector
|
||||
* @param root what kind of distance function
|
||||
* @return the distance of x and y
|
||||
* @throws Exception if x and y have different dimensions an exception is thrown.
|
||||
* @throws IllegalArgumentException if x and y have different dimensions an exception is thrown.
|
||||
*/
|
||||
public static double dist(double[] x, double[] y, int root) {
|
||||
if (x.length != y.length) {
|
||||
throw new RuntimeException(
|
||||
throw new IllegalArgumentException(
|
||||
"The vectors x and y must have the same dimension");
|
||||
}
|
||||
if (root == 0) {
|
||||
throw new RuntimeException("There is no 0-root!");
|
||||
throw new IllegalArgumentException("There is no 0-root!");
|
||||
}
|
||||
double d = 0;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
@ -108,12 +108,12 @@ public final class Mathematics {
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the euclidian distance function.
|
||||
* Computes the euclidean distance function.
|
||||
*
|
||||
* @param x a vector
|
||||
* @param y another vector
|
||||
* @return the distance of x and y
|
||||
* @throws Exception if x and y have different dimensions an exception is thrown.
|
||||
* @throws IllegalArgumentException if x and y have different dimensions an exception is thrown.
|
||||
*/
|
||||
public static double euclideanDist(double[] x, double[] y) {
|
||||
if (x.length != y.length) {
|
||||
@ -787,7 +787,6 @@ public final class Mathematics {
|
||||
* Normalize the given vector to a euclidean length of 1.
|
||||
*
|
||||
* @param v
|
||||
* @return
|
||||
*/
|
||||
public static void normVect(double[] v, double[] res) {
|
||||
svDiv(norm(v), v, res);
|
||||
@ -910,8 +909,8 @@ public final class Mathematics {
|
||||
|
||||
/**
|
||||
* Simple version of reflection of a value moving by a step and bouncing of
|
||||
* min and max values like a pool ball. Precondition is min <= val <= max,
|
||||
* post condition is min <= retVal <= max.
|
||||
* min and max values like a pool ball. Precondition is min <= val <= max,
|
||||
* post condition is min <= retVal <= max.
|
||||
*
|
||||
* @param val
|
||||
* @param step
|
||||
@ -1051,7 +1050,7 @@ public final class Mathematics {
|
||||
|
||||
/**
|
||||
* Scale a range by the given factor, meaning that the interval in each
|
||||
* dimension is extended (fact>1) or reduced (fact < 1) by the defined ratio
|
||||
* dimension is extended (fact > 1) or reduced (fact < 1) by the defined ratio
|
||||
* around the center.
|
||||
*
|
||||
* @param rangeScaleFact
|
||||
@ -1075,7 +1074,6 @@ public final class Mathematics {
|
||||
*
|
||||
* @param range
|
||||
* @param dist
|
||||
* @return
|
||||
*/
|
||||
public static void shiftRange(double[][] range, double dist) {
|
||||
for (int i = 0; i < range.length; i++) {
|
||||
@ -1088,7 +1086,6 @@ public final class Mathematics {
|
||||
* dimensions as the range.
|
||||
*
|
||||
* @param range
|
||||
* @return
|
||||
*/
|
||||
public static void shiftRange(double[][] range, double[] dists) {
|
||||
for (int i = 0; i < range.length; i++) {
|
||||
@ -1174,7 +1171,6 @@ public final class Mathematics {
|
||||
*
|
||||
* @param s Scalar
|
||||
* @param v Vector
|
||||
* @return
|
||||
*/
|
||||
public static void svAdd(double s, double[] v, double[] res) {
|
||||
for (int i = 0; i < v.length; i++) {
|
||||
@ -1200,7 +1196,6 @@ public final class Mathematics {
|
||||
*
|
||||
* @param s
|
||||
* @param v
|
||||
* @return
|
||||
*/
|
||||
public static void svDiv(double s, double[] v, double[] res) {
|
||||
for (int i = 0; i < v.length; i++) {
|
||||
@ -1240,7 +1235,6 @@ public final class Mathematics {
|
||||
* @param s Scaling factor
|
||||
* @param v
|
||||
* @param w
|
||||
* @return
|
||||
*/
|
||||
public static void svvAddScaled(double s, double[] v, double[] w,
|
||||
double[] res) {
|
||||
@ -1255,7 +1249,6 @@ public final class Mathematics {
|
||||
* @param s
|
||||
* @param v
|
||||
* @param w
|
||||
* @return
|
||||
*/
|
||||
public static void svvAddAndScale(double s, double[] v, double[] w,
|
||||
double[] res) {
|
||||
@ -1284,7 +1277,6 @@ public final class Mathematics {
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
* @return vector addition
|
||||
*/
|
||||
public static void vvAdd(double[] v1, double[] v2, double[] res) {
|
||||
vvAddOffs(v1, 0, v2, 0, res, 0, v1.length);
|
||||
@ -1311,7 +1303,6 @@ public final class Mathematics {
|
||||
*
|
||||
* @param v1
|
||||
* @param v2
|
||||
* @return vector addition
|
||||
*/
|
||||
public static void vvAddOffs(double[] v1, int v1Offs, double[] v2,
|
||||
int v2Offs, double[] res, int resOffs, int len) {
|
||||
@ -1338,9 +1329,9 @@ public final class Mathematics {
|
||||
/**
|
||||
* Component wise multiplication of vectors: res[i]=u[i]*v[i]
|
||||
*
|
||||
* @param s
|
||||
* @param u
|
||||
* @param v
|
||||
* @return
|
||||
* @param res The result vector
|
||||
*/
|
||||
public static void vvMultCw(double[] u, double[] v, double[] res) {
|
||||
for (int i = 0; i < res.length; i++) {
|
||||
@ -1366,7 +1357,7 @@ public final class Mathematics {
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @return a new vector c = a - b
|
||||
* @param res Result vector c = a - b
|
||||
*/
|
||||
public static void vvSub(double[] a, double[] b, double[] res) {
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
|
@ -393,8 +393,8 @@ public final class RNG {
|
||||
/**
|
||||
* Returns a vector denoting a random point around the center - inside a
|
||||
* hypersphere of uniform distribution if nonUnif=0, - inside a hypersphere
|
||||
* of non-uniform distribution if nonUnif > 0, - inside a D-Gaussian if
|
||||
* nonUnif < 0. For case 2, the nonUnif parameter is used as standard
|
||||
* of non-uniform distribution if nonUnif > 0, - inside a D-Gaussian if
|
||||
* nonUnif < 0. For case 2, the nonUnif parameter is used as standard
|
||||
* deviation (instead of 1/D), the parameter is not further used in the
|
||||
* other two cases. Original code by Maurice Clerc, from the TRIBES package
|
||||
*
|
||||
|
@ -236,7 +236,7 @@ public final class SpecialFunction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param x a double value
|
||||
* @param xx a double value
|
||||
* @return the hyperbolic arc sine of the argument
|
||||
*/
|
||||
static public double asinh(double xx) throws ArithmeticException {
|
||||
@ -504,7 +504,7 @@ public final class SpecialFunction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param x an integer value
|
||||
* @param j an integer value
|
||||
* @return the factorial of the argument
|
||||
*/
|
||||
static public int fac(int j) throws ArithmeticException {
|
||||
@ -528,7 +528,6 @@ public final class SpecialFunction {
|
||||
* @param x a double value
|
||||
* @return the Gamma function of the value.
|
||||
* <p>
|
||||
* <FONT size=2>
|
||||
* Converted to Java from<BR>
|
||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||
@ -626,7 +625,7 @@ public final class SpecialFunction {
|
||||
}
|
||||
|
||||
/* Gamma function computed by Stirling's formula.
|
||||
* The polynomial STIR is valid for 33 <= x <= 172.
|
||||
* The polynomial STIR is valid for 33 <= x <= 172.
|
||||
|
||||
Cephes Math Library Release 2.2: July, 1992
|
||||
Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier
|
||||
@ -663,7 +662,6 @@ public final class SpecialFunction {
|
||||
* @param x double value
|
||||
* @return the Complemented Incomplete Gamma function.
|
||||
* <p>
|
||||
* <FONT size=2>
|
||||
* Converted to Java from<BR>
|
||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||
@ -738,7 +736,6 @@ public final class SpecialFunction {
|
||||
* @param x double value
|
||||
* @return the Incomplete Gamma function.
|
||||
* <p>
|
||||
* <FONT size=2>
|
||||
* Converted to Java from<BR>
|
||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||
@ -894,7 +891,6 @@ public final class SpecialFunction {
|
||||
* @param a double value
|
||||
* @return The complementary Error function
|
||||
* <p>
|
||||
* <FONT size=2>
|
||||
* Converted to Java from<BR>
|
||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||
@ -995,10 +991,9 @@ public final class SpecialFunction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param a double value
|
||||
* @param x double value
|
||||
* @return The Error function
|
||||
* <p>
|
||||
* <FONT size=2>
|
||||
* Converted to Java from<BR>
|
||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||
@ -1175,7 +1170,6 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
|
||||
* @param xx double value
|
||||
* @return The Incomplete Beta Function evaluated from zero to xx.
|
||||
* <p>
|
||||
* <FONT size=2>
|
||||
* Converted to Java from<BR>
|
||||
* Cephes Math Library Release 2.3: July, 1995<BR>
|
||||
* Copyright 1984, 1995 by Stephen L. Moshier<BR>
|
||||
|
Loading…
x
Reference in New Issue
Block a user