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
|
* optimization procedures in EvA2. The arguments passed to the methods
|
||||||
* initialize the respective optimization procedure. To perform an optimization
|
* initialize the respective optimization procedure. To perform an optimization
|
||||||
* one has to do the following:
|
* one has to do the following:
|
||||||
* <code>
|
* {@code
|
||||||
* InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments);
|
* InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments);
|
||||||
* EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls);
|
* EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls);
|
||||||
* while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize();
|
* while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize();
|
||||||
* </code>
|
* }
|
||||||
*/
|
*/
|
||||||
public class OptimizerFactory {
|
public class OptimizerFactory {
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ public class OptimizerFactory {
|
|||||||
* This method creates a Hill Climber algorithm with a default fixed-size
|
* This method creates a Hill Climber algorithm with a default fixed-size
|
||||||
* mutation.
|
* mutation.
|
||||||
*
|
*
|
||||||
* @param pop The size of the population
|
* @param popSize The size of the population
|
||||||
* @param problem The problem to be optimized
|
* @param problem The problem to be optimized
|
||||||
* @param listener
|
* @param listener
|
||||||
* @return An optimization procedure that performs hill climbing.
|
* @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.
|
* Use default random seed and the population size of the optimizer.
|
||||||
*
|
*
|
||||||
* @param opt
|
* @param opt
|
||||||
* @param popSize
|
|
||||||
* @param problem
|
* @param problem
|
||||||
|
* @param term
|
||||||
* @return
|
* @return
|
||||||
* @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem,
|
* @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem,
|
||||||
* long, InterfaceTerminator)
|
* long, InterfaceTerminator)
|
||||||
@ -1117,7 +1117,7 @@ public class OptimizerFactory {
|
|||||||
/**
|
/**
|
||||||
* Add a new InterfaceTerminator to the current user-defined optimizer in a
|
* Add a new InterfaceTerminator to the current user-defined optimizer in a
|
||||||
* boolean combination. The old and the given terminator will be combined as
|
* 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)
|
* false. If there was no user-defined terminator (or it was set to null)
|
||||||
* the new one is used without conjunction.
|
* the new one is used without conjunction.
|
||||||
*
|
*
|
||||||
@ -1327,7 +1327,6 @@ public class OptimizerFactory {
|
|||||||
* @param evalCycle
|
* @param evalCycle
|
||||||
* @param popSize
|
* @param popSize
|
||||||
* @param minImprovement
|
* @param minImprovement
|
||||||
* @param method
|
|
||||||
* @param sigmaClust
|
* @param sigmaClust
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -1500,7 +1499,7 @@ public class OptimizerFactory {
|
|||||||
* A standard niching ES which employs predefined values and standard ES
|
* A standard niching ES which employs predefined values and standard ES
|
||||||
* variation operators.
|
* variation operators.
|
||||||
*
|
*
|
||||||
* @param problem
|
* @param prob
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static OptimizationParameters standardNichingEs(AbstractOptimizationProblem prob) {
|
public static OptimizationParameters standardNichingEs(AbstractOptimizationProblem prob) {
|
||||||
@ -1513,7 +1512,7 @@ public class OptimizerFactory {
|
|||||||
/**
|
/**
|
||||||
* A niching ES.
|
* A niching ES.
|
||||||
*
|
*
|
||||||
* @param problem
|
* @param prob
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static OptimizationParameters createNichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) {
|
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
|
* Once this method returns, the splash screen is realized, which means
|
||||||
* that almost all work on the splash screen should proceed through the
|
* that almost all work on the splash screen should proceed through the
|
||||||
* event dispatch thread. In particular, any call to
|
* 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.
|
* dispatch thread.
|
||||||
*/
|
*/
|
||||||
public void splash() {
|
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();
|
public abstract Object construct();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on the event dispatching thread (not on the worker thread)
|
* 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() {
|
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
|
* Returns null if either the constructing thread or the current
|
||||||
* thread was interrupted before a value was produced.
|
* 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() {
|
public Object get() {
|
||||||
while (true) {
|
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.
|
* and then exit.
|
||||||
*/
|
*/
|
||||||
public SwingWorker() {
|
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) {
|
public DPoint getNearestDPoint(DPoint point) {
|
||||||
int minIndex = getNearestDPointIndex(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) {
|
public int getNearestDPointIndex(DPoint point) {
|
||||||
double minValue = Double.MAX_VALUE;
|
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.
|
* Allows marking an individual as infeasible if fitness penalty is used.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public void setMarkPenalized(boolean p) {
|
public void setMarkPenalized(boolean p) {
|
||||||
isPenalized = 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.
|
* 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
|
* @param fitnessCriterion
|
||||||
*/
|
*/
|
||||||
@ -59,7 +59,7 @@ public class EAIndividualComparator implements Comparator<Object>, Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a specific fitness criterion in the multi-objective case.
|
* 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.
|
* If preferFeasible is true, feasible individuals will always be prefered.
|
||||||
*
|
*
|
||||||
* @param fitIndex
|
* @param fitIndex
|
||||||
|
@ -274,7 +274,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
|||||||
* This method allows you to set the double data.
|
* This method allows you to set the double data.
|
||||||
*
|
*
|
||||||
* @param doubleData The new double data.
|
* @param doubleData The new double data.
|
||||||
* @see InterfaceDataTypeDouble.SetDoubleData()
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setDoublePhenotype(double[] doubleData) {
|
public void setDoublePhenotype(double[] doubleData) {
|
||||||
@ -286,7 +285,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
|||||||
* memetic algorithms.
|
* memetic algorithms.
|
||||||
*
|
*
|
||||||
* @param doubleData The new double data.
|
* @param doubleData The new double data.
|
||||||
* @see InterfaceDataTypeDouble.SetDoubleDataLamarckian()
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setDoubleGenotype(double[] doubleData) {
|
public void setDoubleGenotype(double[] doubleData) {
|
||||||
@ -341,7 +339,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
|||||||
* This method allows you to set the binary data.
|
* This method allows you to set the binary data.
|
||||||
*
|
*
|
||||||
* @param binaryData The new binary data.
|
* @param binaryData The new binary data.
|
||||||
* @see InterfaceDataTypeBinary.SetBinaryData()
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setBinaryPhenotype(BitSet binaryData) {
|
public void setBinaryPhenotype(BitSet binaryData) {
|
||||||
@ -353,16 +350,12 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
|||||||
* memetic algorithms.
|
* memetic algorithms.
|
||||||
*
|
*
|
||||||
* @param binaryData The new binary data.
|
* @param binaryData The new binary data.
|
||||||
* @see InterfaceBinaryData.setBinaryDataLamarckian()
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setBinaryGenotype(BitSet binaryData) {
|
public void setBinaryGenotype(BitSet binaryData) {
|
||||||
this.binaryIndividual.setBinaryGenotype(binaryData);
|
this.binaryIndividual.setBinaryGenotype(binaryData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* These are for GUI
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* This method allows the CommonJavaObjectEditorPanel to read the
|
* This method allows the CommonJavaObjectEditorPanel to read the
|
||||||
* name to the current object.
|
* 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.
|
* which are not dominated by other individuals within distance rho.
|
||||||
* Note that the returned set may be smaller than q.
|
* 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 q the number of peaks to be identified
|
||||||
* @param rho the niche radius
|
* @param rho the niche radius
|
||||||
* @return the dynamic peak set
|
* @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.:
|
* 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}},
|
* title = {{A Real Coded Genetic Algorithm for Function Optimization Using Unimodal Normal Distributed Crossover}},
|
||||||
* booktitle = {ICGA},
|
* booktitle = {ICGA},
|
||||||
* year = {1997},
|
* year = {1997},
|
||||||
|
@ -21,7 +21,7 @@ import java.util.BitSet;
|
|||||||
* elements to a certain type and all to a subset of the range).
|
* elements to a certain type and all to a subset of the range).
|
||||||
* <p>
|
* <p>
|
||||||
* The initialization may be parameterized in two ways, where each takes a fixed
|
* 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.
|
* so each segment has equal cardinality.
|
||||||
* Secondly, an int-array can be specified which defines possibly varying k_i for
|
* 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
|
* 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
|
* ES mutation with path length control. The step size (single sigma) is
|
||||||
* adapted using the evolution path length by adapting the real path length
|
* adapted using the evolution path length by adapting the real path length
|
||||||
* to the expected path length in for uncorrelated single steps.
|
* 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.")
|
@Description("The single step size is controlled using the evolution path.")
|
||||||
public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Serializable {
|
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:
|
* 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
|
* - 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.
|
* 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>
|
* <p>
|
||||||
* The implementation uses a structure for keeping all adaptive parameters, CMAParamSet, which is stored
|
* 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.
|
* 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.
|
* 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
|
* The evolution path is deduced from the center of the selected population compared to the old
|
||||||
* mean value.
|
* mean value.
|
||||||
* See Hansen&Kern 04 for further information.
|
* See Hansen&Kern 04 for further information.
|
||||||
*
|
*
|
||||||
* @param oldGen
|
* @param oldGen
|
||||||
* @param selectedP
|
* @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
|
* @param tolX
|
||||||
* @return
|
* @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 d
|
||||||
* @param gen
|
* @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
|
* @param d
|
||||||
* @return
|
* @return
|
||||||
@ -760,11 +760,11 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test condition of C (Auger&Hansen, CEC '05, stopping criterion conditioncov).
|
* Test condition of C (Auger&Hansen, CEC '05, stopping criterion conditioncov).
|
||||||
* Return true, if a diagonal entry is <= 0 or >= d.
|
* Return true, if a diagonal entry is <= 0 or >= d.
|
||||||
*
|
*
|
||||||
* @param 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) {
|
public boolean testCCondition(Population pop, double d) {
|
||||||
CMAParamSet params = (CMAParamSet) pop.getData(cmaParamsKey);
|
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
|
* 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.
|
* times.
|
||||||
*
|
*
|
||||||
* @param maxTries
|
* @param maxTries
|
||||||
* @param genotype
|
* @param genotype
|
||||||
* @param maybePreferedValue
|
* @param avoidValue
|
||||||
* @param iMin
|
* @param iMin
|
||||||
* @param iMax
|
* @param iMax
|
||||||
* @return
|
* @return
|
||||||
@ -182,11 +182,6 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab
|
|||||||
return k;
|
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) {
|
protected Object valueAt(Object genotype, int k) {
|
||||||
if (genotype instanceof BitSet) {
|
if (genotype instanceof BitSet) {
|
||||||
return ((BitSet) genotype).get(k);
|
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.
|
* Swap two random bits of a GA individual within subsequences (segments) of fixed length.
|
||||||
* If preferPairs is true, unequal pairs
|
* 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).
|
* segment length).
|
||||||
* Multiple mutations per segment can occur if the boolean switch is activated, meaning
|
* 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
|
* that further mutations are performed recursively with p_mut. Thus, the probability
|
||||||
|
@ -15,7 +15,7 @@ import eva2.util.annotation.Description;
|
|||||||
* <br><br>
|
* <br><br>
|
||||||
* <b>Example: </b>
|
* <b>Example: </b>
|
||||||
* <pre>
|
* <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
|
* 1 2 | 5 4 3 | 6 7 8 9
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@ -30,8 +30,10 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat
|
|||||||
return this;
|
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.
|
* are actually the same.
|
||||||
|
*
|
||||||
* @param mutator The other mutation operator
|
* @param mutator The other mutation operator
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,15 +35,11 @@ public class EuclideanDiversityAbsorptionStrategy extends StandardAbsorptionStra
|
|||||||
epsilon = eps;
|
epsilon = eps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* shouldAbsorbParticleIntoSubswarm
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @tested true if
|
* true if
|
||||||
* the subswarm is active and
|
* the sub-swarm is active and
|
||||||
* the particle lies in the radius of the subswarm and
|
* the particle lies in the radius of the sub-swarm and
|
||||||
* the diversity (mean distance from the gbest) of the subswarm < epsilon
|
* the diversity (mean distance from the gbest) of the sub-swarm < epsilon
|
||||||
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.StandardAbsorptionStrategy#shouldAbsorbParticleIntoSubswarm(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||||
@ -58,10 +54,6 @@ public class EuclideanDiversityAbsorptionStrategy extends StandardAbsorptionStra
|
|||||||
return meanDistanceFromGBestPos < getEpsilon();
|
return meanDistanceFromGBestPos < getEpsilon();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* *******************************************************************************************************************
|
|
||||||
* setter, getter
|
|
||||||
*/
|
|
||||||
public void setEpsilon(double epsilon) {
|
public void setEpsilon(double epsilon) {
|
||||||
this.epsilon = epsilon;
|
this.epsilon = epsilon;
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,11 @@ import eva2.optimization.strategies.ParticleSubSwarmOptimization;
|
|||||||
public interface InterfaceAbsorptionStrategy {
|
public interface InterfaceAbsorptionStrategy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indy
|
* @param indy Individual
|
||||||
* @param subswarm the swarm indy will be absorbed from
|
* @param subswarm the swarm indy will be absorbed from
|
||||||
* @param mainswarm the swarm indy currently belongs to
|
* @param mainswarm the swarm indy currently belongs to
|
||||||
* (population statistics from that swarm may be used to decide whether indy should be absorbed)
|
* (population statistics from that swarm may be used to decide whether indy should be absorbed)
|
||||||
* @return
|
* @return Decides whether indy should be absorbed into the sub-swarm according to the absorption strategy
|
||||||
* @tested decides whether indy should be absorbed into the subswarm according to the absorption strategie
|
|
||||||
*/
|
*/
|
||||||
boolean shouldAbsorbParticleIntoSubswarm(
|
boolean shouldAbsorbParticleIntoSubswarm(
|
||||||
AbstractEAIndividual indy,
|
AbstractEAIndividual indy,
|
||||||
@ -22,10 +21,11 @@ public interface InterfaceAbsorptionStrategy {
|
|||||||
ParticleSubSwarmOptimization mainswarm);
|
ParticleSubSwarmOptimization mainswarm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indy
|
* Absorbs indy according to the absorption strategy
|
||||||
|
*
|
||||||
|
* @param indy Individual
|
||||||
* @param subswarm the swarm indy will be absorbed from
|
* @param subswarm the swarm indy will be absorbed from
|
||||||
* @param mainswarm the swarm indy currently belongs to
|
* @param mainswarm the swarm indy currently belongs to
|
||||||
* @tested absorbs indy according to the absorbtion strategy
|
|
||||||
*/
|
*/
|
||||||
void absorbParticle(
|
void absorbParticle(
|
||||||
AbstractEAIndividual indy,
|
AbstractEAIndividual indy,
|
||||||
|
@ -22,10 +22,9 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tested true if
|
* tested true if
|
||||||
* the subswarm is active and
|
* the subswarm is active and
|
||||||
* the particle lies in the radius of the subswarm
|
* 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
|
@Override
|
||||||
public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||||
@ -43,20 +42,13 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy,
|
|||||||
return dist <= R;
|
return dist <= R;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* absorbParticle
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tested junit
|
* Adds indy to an active sub-swarm, then removes indy from the main-swarm.
|
||||||
* 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)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void absorbParticle(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
public void absorbParticle(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||||
if (!subswarm.isActive()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
subswarm.add(indy);
|
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
|
* True if the subswarm is active and all particles are completely converged
|
||||||
* (i.e. the stddev over the past 3 iterations is < epsilson)
|
* (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)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) {
|
public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) {
|
||||||
@ -98,14 +97,9 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr
|
|||||||
return (isConverged(subswarm.getPopulation()));
|
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.
|
* 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
|
@Override
|
||||||
public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||||
@ -126,11 +120,6 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr
|
|||||||
return particleIndices;
|
return particleIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* *******************************************************************************************************************
|
|
||||||
* getter, setter
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void setEpsilon(double epsilon) {
|
public void setEpsilon(double epsilon) {
|
||||||
this.epsilon = epsilon;
|
this.epsilon = epsilon;
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,20 @@ import eva2.optimization.strategies.ParticleSubSwarmOptimization;
|
|||||||
public interface InterfaceDeactivationStrategy {
|
public interface InterfaceDeactivationStrategy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Decides whether a subswarm should be deactivated according to the deactivation strategy
|
||||||
|
*
|
||||||
* @param subswarm
|
* @param subswarm
|
||||||
* @return
|
* @return
|
||||||
* @tested decides whether a subswarm should be deacitvated according to the deactivation strategy
|
|
||||||
*/
|
*/
|
||||||
boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm);
|
boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Deactivates a given subswarm.
|
||||||
|
* What happens to the particles in this subswarm depends on the concrete strategy.
|
||||||
|
*
|
||||||
* @param subswarm
|
* @param subswarm
|
||||||
* @param mainswarm
|
* @param mainswarm
|
||||||
* @tested deactivates a given subswarm.
|
* @return the list of indices to be reinitialized or null.
|
||||||
* What happens to the particles in this subswarm depends on the concrete strategy.
|
|
||||||
* Return the list of indices to be reinitialized or null.
|
|
||||||
*/
|
*/
|
||||||
int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm);
|
int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm);
|
||||||
|
|
||||||
|
@ -21,10 +21,6 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
|||||||
private double epsilon = 0.0001;
|
private double epsilon = 0.0001;
|
||||||
private int stdDevHorizon = 3;
|
private int stdDevHorizon = 3;
|
||||||
|
|
||||||
/**
|
|
||||||
* *******************************************************************************************************************
|
|
||||||
* ctors
|
|
||||||
*/
|
|
||||||
public StandardDeactivationStrategy() {
|
public StandardDeactivationStrategy() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -51,7 +47,6 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
|||||||
/**
|
/**
|
||||||
* @param pop
|
* @param pop
|
||||||
* @return
|
* @return
|
||||||
* @tested
|
|
||||||
*/
|
*/
|
||||||
public boolean areAllConverged(Population pop) {
|
public boolean areAllConverged(Population pop) {
|
||||||
for (int i = 0; i < pop.size(); ++i) {
|
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
|
* True if the subswarm is active and all particles are completely converged
|
||||||
* (i.e. the stddev over the past 3 iterations is < epsilson)
|
* (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)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) {
|
public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) {
|
||||||
@ -87,14 +81,10 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
|||||||
return (areAllConverged(subswarm.getPopulation()));
|
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.
|
* 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
|
@Override
|
||||||
public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) {
|
||||||
@ -115,11 +105,6 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate
|
|||||||
return particleIndices;
|
return particleIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* *******************************************************************************************************************
|
|
||||||
* getter, setter
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void setEpsilon(double epsilon) {
|
public void setEpsilon(double epsilon) {
|
||||||
this.epsilon = epsilon;
|
this.epsilon = epsilon;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class ScatterMergingStrategy extends StandardMergingStrategy {
|
|||||||
/**
|
/**
|
||||||
* @param i
|
* @param i
|
||||||
* @param j
|
* @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.
|
* if both inactive: adds population of subswarm j to population of subswarm i, then deletes subswarm j.
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* 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)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldMergeSubswarms(ParticleSubSwarmOptimization subswarm1, ParticleSubSwarmOptimization subswarm2) {
|
public boolean shouldMergeSubswarms(ParticleSubSwarmOptimization subswarm1, ParticleSubSwarmOptimization subswarm2) {
|
||||||
@ -108,7 +107,6 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i
|
|||||||
/**
|
/**
|
||||||
* @param i
|
* @param i
|
||||||
* @param j
|
* @param j
|
||||||
* @tested junit
|
|
||||||
* adds population of subswarm j to population of subswarm i, then deletes subswarm j.
|
* adds population of subswarm j to population of subswarm i, then deletes subswarm j.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,7 @@ public class GenerateNeighborSubswarmCreationStrategy extends
|
|||||||
private double mu = 0.1;
|
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.
|
* If the neighbors pbest is better than the particles pbest, a new neighbor is generated.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,22 +9,25 @@ import eva2.optimization.strategies.ParticleSubSwarmOptimization;
|
|||||||
public interface InterfaceSubswarmCreationStrategy {
|
public interface InterfaceSubswarmCreationStrategy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Decides whether a subswarm should be created for the given indy and mainswarm according to the creation strategy
|
||||||
|
*
|
||||||
* @param indy
|
* @param indy
|
||||||
* @param mainswarm
|
* @param mainswarm
|
||||||
* @return
|
* @return
|
||||||
* @tested decides whether a subswarm should be created for the given indy and mainswarm according to the creation strategie
|
|
||||||
*/
|
*/
|
||||||
boolean shouldCreateSubswarm(
|
boolean shouldCreateSubswarm(
|
||||||
AbstractEAIndividual indy,
|
AbstractEAIndividual indy,
|
||||||
ParticleSubSwarmOptimization mainswarm);
|
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")
|
* (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 indy a particle from which a subswarm should be created
|
||||||
* @param mainSwarm the main swarm which contains indy
|
* @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(
|
void createSubswarm(
|
||||||
ParticleSubSwarmOptimization preparedSubswarm,
|
ParticleSubSwarmOptimization preparedSubswarm,
|
||||||
|
@ -36,9 +36,7 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indy main swarm particle
|
* @param indy main swarm particle
|
||||||
* @return
|
* @return true if the stddev of the particles fitness < delta and no constraints are violated
|
||||||
* @tested junit
|
|
||||||
* true if the stddev of the particles fitness < delta and no constraints are violated
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldCreateSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization mainswarm) {
|
public boolean shouldCreateSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization mainswarm) {
|
||||||
@ -54,9 +52,8 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indy main swarm particle
|
* @param indy main swarm particle
|
||||||
* @return
|
* @return true, if reasons exist why no subswarm should be created from indy.
|
||||||
* @tested junit
|
*
|
||||||
* true, if reasons exist why no subswarm should be created from indy.
|
|
||||||
* Reasons like:
|
* Reasons like:
|
||||||
* poor fitness (not implemented),
|
* poor fitness (not implemented),
|
||||||
* convergence on plateau (not implemented),
|
* convergence on plateau (not implemented),
|
||||||
@ -74,14 +71,10 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
|
|||||||
return result;
|
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.
|
* 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
|
@Override
|
||||||
public void createSubswarm(ParticleSubSwarmOptimization preparedSubswarm, AbstractEAIndividual indy, ParticleSubSwarmOptimization mainSwarm) {
|
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!
|
* 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
|
* 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.
|
* 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.
|
* 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,
|
* 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.
|
* or the single best and random n-1, or all n random.
|
||||||
*
|
*
|
||||||
* @param pop
|
* @param pop
|
||||||
@ -238,9 +238,9 @@ public class PostProcess {
|
|||||||
* Filter the individuals of a population which have a fitness norm below a given value.
|
* Filter the individuals of a population which have a fitness norm below a given value.
|
||||||
* Returns shallow copies!
|
* Returns shallow copies!
|
||||||
*
|
*
|
||||||
* @param pop
|
* @param pop Population
|
||||||
* @param fitNorm
|
* @param fitNorm The fitness threshold
|
||||||
* @param bSmaller if true, return individuals with lower or equal, else with higher fitness norm only
|
* @param bSmallerEq if true, return individuals with lower or equal, else with higher fitness norm only
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Population filterFitnessNormed(Population pop, double fitNorm, boolean bSmallerEq) {
|
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
|
* 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
|
* processing was aborted by the user. Sets the number of function calls
|
||||||
* in the population back to the original count.
|
* 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.
|
* number of evaluations before the optimization using the given terminator.
|
||||||
*
|
*
|
||||||
* @param pop
|
* @param pop
|
||||||
@ -471,7 +471,7 @@ public class PostProcess {
|
|||||||
* meaning that typically only one best is returned.
|
* 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
|
* 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
|
* 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
|
* then the number of evaluations is set as
|
||||||
* number of evaluations before the optimization using the given terminator.
|
* number of evaluations before the optimization using the given terminator.
|
||||||
*
|
*
|
||||||
@ -525,7 +525,7 @@ public class PostProcess {
|
|||||||
* @param initPerturbation
|
* @param initPerturbation
|
||||||
* @param prob
|
* @param prob
|
||||||
* @return
|
* @return
|
||||||
* @see NelderMeadSimplex#createNMSPopulation(candidate, perturbRatio, range, includeCand)
|
* @see NelderMeadSimplex#createNMSPopulation
|
||||||
*/
|
*/
|
||||||
public static Pair<AbstractEAIndividual, Integer> localSolverNMS(AbstractEAIndividual cand, int hcSteps,
|
public static Pair<AbstractEAIndividual, Integer> localSolverNMS(AbstractEAIndividual cand, int hcSteps,
|
||||||
double initPerturbation, AbstractOptimizationProblem prob) {
|
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 index index of the individual for which to produce the sub population
|
||||||
* @param maxRelativePerturbation
|
* @param maxRelativePerturbation
|
||||||
* @param includeCand
|
* @param includeCand
|
||||||
* @see #createPopInSubRange(double, AbstractOptimizationProblem, AbstractEAIndividual)
|
* @see #createPopInSubRange
|
||||||
* @see NelderMeadSimplex#createNMSPopulation(AbstractEAIndividual, double, double[][], boolean)
|
* @see NelderMeadSimplex#createNMSPopulation(AbstractEAIndividual, double, double[][], boolean)
|
||||||
*/
|
*/
|
||||||
public static Population createLSSupPopulation(PostProcessMethod method, AbstractOptimizationProblem problem, Population candidates, int index, double maxRelativePerturbation, boolean includeCand) {
|
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 searchBoxLen
|
||||||
* @param indy
|
* @param indy
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void createPopInSubRange(Population destPop, double searchBoxLen,
|
public static void createPopInSubRange(Population destPop, double searchBoxLen,
|
||||||
int targetSize, AbstractEAIndividual indy) {
|
int targetSize, AbstractEAIndividual indy) {
|
||||||
@ -1133,8 +1132,8 @@ public class PostProcess {
|
|||||||
* @param treatAsUnknown
|
* @param treatAsUnknown
|
||||||
* @param listener
|
* @param listener
|
||||||
* @return
|
* @return
|
||||||
* @see {@link AbstractOptimizationProblem#extractPotentialOptima}
|
* @see AbstractOptimizationProblem#extractPotentialOptima
|
||||||
* @see AbstractOptimizationProblem#isPotentialOptimumNMS(AbstractEAIndividual, double, double, int)
|
* @see AbstractOptimizationProblem#isPotentialOptimumNMS
|
||||||
*/
|
*/
|
||||||
public static int[] checkAccuracy(AbstractOptimizationProblem prob, Population sols, double[] epsilonPhenoSpace,
|
public static int[] checkAccuracy(AbstractOptimizationProblem prob, Population sols, double[] epsilonPhenoSpace,
|
||||||
double extrOptEpsFitConf, double extrOptClustSig, int maxEvals, SolutionHistogram[] solHists, boolean treatAsUnknown,
|
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.
|
* 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.
|
* The specific search method may interpret the search range differently.
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method
|
||||||
@ -1254,7 +1253,7 @@ public class PostProcess {
|
|||||||
/**
|
/**
|
||||||
* Select a perturbation for individual i fitting to the population - avoiding overlap.
|
* 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.
|
* 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 candidates population of solutions to look at
|
||||||
* @param i index of the individual in the population 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 upperBound upper bound of the fitness interval
|
||||||
* @param nBins number of bins
|
* @param nBins number of bins
|
||||||
* @return an integer array with the number of individuals in each bin
|
* @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) {
|
public static SolutionHistogram createFitNormHistogram(Population pop, double lowerBound, double upperBound, int nBins, int crit) {
|
||||||
SolutionHistogram res = new SolutionHistogram(lowerBound, upperBound, nBins);
|
SolutionHistogram res = new SolutionHistogram(lowerBound, upperBound, nBins);
|
||||||
|
@ -34,7 +34,7 @@ public interface InterfaceSelection {
|
|||||||
void prepareSelection(Population population);
|
void prepareSelection(Population population);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will select >size< individuals from the given
|
* This method will select *size* individuals from the given
|
||||||
* Population.
|
* Population.
|
||||||
*
|
*
|
||||||
* @param population The source population where to select from
|
* @param population The source population where to select from
|
||||||
@ -44,7 +44,7 @@ public interface InterfaceSelection {
|
|||||||
Population selectFrom(Population population, int size);
|
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 dad The already seleceted parent
|
||||||
* @param availablePartners The mating pool.
|
* @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.
|
* Population.
|
||||||
*
|
*
|
||||||
* @param population The source population where to select from
|
* @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 dad The already selected parent
|
||||||
* @param availablePartners The mating pool.
|
* @param availablePartners The mating pool.
|
||||||
|
@ -20,7 +20,7 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ
|
|||||||
|
|
||||||
private boolean obeyDebsConstViolationPrinciple = true;
|
private boolean obeyDebsConstViolationPrinciple = true;
|
||||||
/**
|
/**
|
||||||
* Comment for <code>serialVersionUID</code>
|
* Comment for {@code serialVersionUID}
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private InterfaceSelectionProbability selProbCalculator = new SelProbStandard();
|
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
|
* 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
|
* 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 population The source population where to select from
|
||||||
* @param size The number of Individuals to select
|
* @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
|
* This method computes the selection probability for each individual
|
||||||
* in the population. Note: Summed over the complete population the selection
|
* 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
|
* 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 population The population to compute.
|
||||||
* @param data The input data as double[][].
|
* @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
|
* This method computes the selection probability for each individual
|
||||||
* in the population. Note: Summed over the complete population the selection
|
* 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
|
* 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 population The population to compute.
|
||||||
* @param data The input data as double[][].
|
* @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";
|
public static final String NEXT_GENERATION_PERFORMED = "NextGenerationPerformed";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* With <code>autoAging = true</code> #incrGeneration automatically
|
* With {@code autoAging = true} #incrGeneration automatically
|
||||||
* ages individuals.
|
* ages individuals.
|
||||||
*/
|
*/
|
||||||
private boolean autoAging = true;
|
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
|
* Create a population instance which distributes the individuals according
|
||||||
* to a random latin hypercube sampling.
|
* to a random latin hypercube sampling.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void createRLHSampling(Population pop, boolean fillPop) {
|
public static void createRLHSampling(Population pop, boolean fillPop) {
|
||||||
if (pop.size() <= 0) {
|
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 cardinality an integer giving the number of (random) bits to set
|
||||||
* @param stdDev standard deviation of the cardinality variation (can be
|
* @param stdDev standard deviation of the cardinality variation (can be
|
||||||
* zero to fix the cardinality)
|
* zero to fix the cardinality)
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void createBinCardinality(Population pop, boolean fillPop, int cardinality, int stdDev) {
|
public static void createBinCardinality(Population pop, boolean fillPop, int cardinality, int stdDev) {
|
||||||
if (pop.size() <= 0) {
|
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
|
* 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.
|
* if a notifyEvalInterval is set.
|
||||||
*
|
*
|
||||||
* @param d The number of function calls to increment by.
|
* @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
|
* This method will return the index of the current best individual from the
|
||||||
* population in the given fitness component (or using dominance when
|
* 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.
|
* @return The index of the best individual.
|
||||||
* @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
|
* @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
|
* This method will return the index of the current best individual from the
|
||||||
* population in the given fitness component (or using dominance when
|
* population in the given fitness component (or using dominance when
|
||||||
* fitIndex < 0).
|
* fitIndex < 0).
|
||||||
*
|
*
|
||||||
* @return The index of the best individual.
|
* @return The index of the best individual.
|
||||||
* @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
|
* @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,
|
* This method returns the n current best individuals from the population,
|
||||||
* where the sorting criterion is delivered by an
|
* where the sorting criterion is delivered by an
|
||||||
* AbstractEAIndividualComparator. There are less than n individuals
|
* 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
|
* individuals are returned and effectively just sorted by fitness. This
|
||||||
* does not check constraints!
|
* does not check constraints!
|
||||||
*
|
*
|
||||||
* @param n number of individuals to look out for
|
* @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) {
|
public Population getBestNIndividuals(int n, int fitIndex) {
|
||||||
if (n <= 0 || (n > super.size())) {
|
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,
|
* This method returns the n current worst individuals from the population,
|
||||||
* where the sorting criterion is delivered by an
|
* where the sorting criterion is delivered by an
|
||||||
* AbstractEAIndividualComparator. There are less than n individuals
|
* 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
|
* individuals are returned and effectively just sorted by fitness. This
|
||||||
* does not check constraints!
|
* does not check constraints!
|
||||||
*
|
*
|
||||||
* @param n number of individuals to look out for
|
* @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) {
|
public Population getWorstNIndividuals(int n, int fitIndex) {
|
||||||
Population pop = new Population(n);
|
Population pop = new Population(n);
|
||||||
@ -1222,7 +1219,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
|||||||
* individuals
|
* individuals
|
||||||
* @param res sorted result population, will be cleared
|
* @param res sorted result population, will be cleared
|
||||||
* @param comp the Comparator to use with individuals
|
* @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) {
|
public void getSortedNIndividuals(int n, boolean bBestOrWorst, Population res, Comparator<Object> comp) {
|
||||||
if ((n < 0) || (n > super.size())) {
|
if ((n < 0) || (n > super.size())) {
|
||||||
@ -2082,7 +2079,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
|
|||||||
* @param indy
|
* @param indy
|
||||||
* @param d
|
* @param d
|
||||||
* @param metric
|
* @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) {
|
public boolean isWithinPopDist(AbstractEAIndividual indy, double d, InterfaceDistanceMetric metric) {
|
||||||
Pair<Integer, Double> closest = Population.getClosestFarthestIndy(indy, this, metric, true);
|
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.
|
* the upper limit if the clustering parameter is controlled.
|
||||||
*
|
*
|
||||||
* @param prob
|
* @param prob
|
||||||
* @param q
|
|
||||||
*/
|
*/
|
||||||
public void setUpperBoundClustDiff(InterfaceProblemDouble prob) {
|
public void setUpperBoundClustDiff(InterfaceProblemDouble prob) {
|
||||||
if (caForSpeciesDifferentation instanceof ClusteringDensityBased) {
|
if (caForSpeciesDifferentation instanceof ClusteringDensityBased) {
|
||||||
|
@ -33,7 +33,7 @@ import java.util.Formatter;
|
|||||||
* predefined, and lambda new samples are drawn for every peak in every
|
* 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.
|
* 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
|
* 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>
|
* <p>
|
||||||
* Unfortunately the algorithm was not described in every detail. It remained
|
* Unfortunately the algorithm was not described in every detail. It remained
|
||||||
* unclear how exactly the peak population where filled and esp. what happens if
|
* 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.
|
* framework which is still used to optimize the single peak populations.
|
||||||
* <p>
|
* <p>
|
||||||
* This class should also cover "Dynamic niching in evolution strategies with
|
* 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.
|
* SelectBest as parent selection and muPerPeak=1.
|
||||||
* <p>
|
* <p>
|
||||||
* Some notes:
|
* 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,
|
* 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
|
* is disabled. This provides for semi-sequential niching with DPI-ES
|
||||||
*
|
*
|
||||||
* @param threshold
|
* @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.
|
* calculate the population size accordingly.
|
||||||
*/
|
*/
|
||||||
protected void checkPopulationConstraints() {
|
protected void checkPopulationConstraints() {
|
||||||
|
@ -30,9 +30,9 @@ import java.util.LinkedList;
|
|||||||
* Lambda is increased multiplicatively for every restart, and typical initial values are
|
* Lambda is increased multiplicatively for every restart, and typical initial values are
|
||||||
* mu=5, lambda=10, incFact=2.
|
* mu=5, lambda=10, incFact=2.
|
||||||
* The IPOP-CMA-ES won the CEC 2005 benchmark challenge.
|
* 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>
|
* <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.")
|
@Description("An ES with increasing population size.")
|
||||||
public class EvolutionStrategyIPOP extends EvolutionStrategies implements InterfacePopulationChangedEventListener, InterfaceAdditionalPopulationInformer {
|
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.
|
* Test for the IPOP stopping criteria.
|
||||||
*
|
*
|
||||||
* @param population
|
* @param term
|
||||||
|
* @param pop
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean testIPOPStopCrit(InterfaceTerminator term, Population pop) {
|
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
|
* This method allows you to toggle between a truly parallel and a serial
|
||||||
* implementation.
|
* 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.
|
// Instead, the new direct problem parallelization can be used.
|
||||||
// public boolean isLocalOnly() {
|
// public boolean isLocalOnly() {
|
||||||
// return this.numLocalOnly;
|
// return this.numLocalOnly;
|
||||||
|
@ -66,7 +66,7 @@ import java.util.Vector;
|
|||||||
* subswarm can formally have, but it does not affect the actual radius. This
|
* 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
|
* adjustment is proposed in [2] in order to improve the performance of the
|
||||||
* NichePSO. Experiments showed a good performance for relatively small values
|
* 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.
|
* dimensional problems, larger values may be preferable.
|
||||||
* <p>
|
* <p>
|
||||||
* [1] R. Brits, A. P. Engelbrecht and B. Bergh. A Niching Particle Swarm
|
* [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
|
// by default, calculate the individuals fitness std dev using this number of past fitness values
|
||||||
public static final int defaultFitStdDevHorizon = 3;
|
public static final int defaultFitStdDevHorizon = 3;
|
||||||
|
|
||||||
/**
|
|
||||||
* ********************************************************************************************************************
|
|
||||||
* ctors, clone
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested
|
|
||||||
*/
|
|
||||||
public NichePSO() {
|
public NichePSO() {
|
||||||
if (log) {
|
if (log) {
|
||||||
initLogFile();
|
initLogFile();
|
||||||
@ -177,9 +170,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
GenericObjectEditor.setHideProperty(getClass(), "maxAllowedSwarmRadius", false);
|
GenericObjectEditor.setHideProperty(getClass(), "maxAllowedSwarmRadius", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @tested @param a
|
|
||||||
*/
|
|
||||||
public NichePSO(NichePSO a) {
|
public NichePSO(NichePSO a) {
|
||||||
this.mainSwarmSize = a.mainSwarmSize;
|
this.mainSwarmSize = a.mainSwarmSize;
|
||||||
this.maxAllowedSwarmRadius = a.maxAllowedSwarmRadius;
|
this.maxAllowedSwarmRadius = a.maxAllowedSwarmRadius;
|
||||||
@ -213,17 +203,13 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
|
this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @tested (non-Javadoc)
|
|
||||||
* @see java.lang.Object#clone()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
return new NichePSO(this);
|
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()
|
* called via initialize()
|
||||||
*/
|
*/
|
||||||
protected void initMainSwarm() {
|
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
|
* called in the ctor not via initialize() (would overwrite changes set from
|
||||||
* outside for the next run)
|
* 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
|
* @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
|
* subswarm
|
||||||
*/
|
*/
|
||||||
public ParticleSubSwarmOptimization getNewSubSwarmOptimizer() {
|
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()
|
* @see eva2.optimization.strategies.InterfaceOptimizer#initialize()
|
||||||
*/
|
*/
|
||||||
@Override
|
@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)
|
* velocity vectors (if reset == false)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -335,11 +320,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ********************************************************************************************************************
|
|
||||||
* Optimization
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested (non-Javadoc)
|
|
||||||
* @see eva2.optimization.strategies.InterfaceOptimizer#optimize()
|
* @see eva2.optimization.strategies.InterfaceOptimizer#optimize()
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* strategy
|
||||||
*/
|
*/
|
||||||
protected void deactivateSubSwarmsIfPossible() {
|
protected void deactivateSubSwarmsIfPossible() {
|
||||||
@ -546,10 +526,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
return actCnt;
|
return actCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ********************************************************************************************************************
|
|
||||||
* Merging
|
|
||||||
*/
|
|
||||||
protected void mergingEventFor(int i, int j) {
|
protected void mergingEventFor(int i, int j) {
|
||||||
if (isVerbose()) {
|
if (isVerbose()) {
|
||||||
System.out.print("merge condition \n");
|
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() {
|
protected void mergeSubswarmsIfPossible() {
|
||||||
boolean runagain = false;
|
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
|
* to the absorbtion strategy
|
||||||
*/
|
*/
|
||||||
protected void absorbParticlesIfPossible() {
|
protected void absorbParticlesIfPossible() {
|
||||||
@ -636,10 +612,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ********************************************************************************************************************
|
|
||||||
* Subswarm Creation
|
|
||||||
*/
|
|
||||||
protected void subswarmCreationEventFor(AbstractEAIndividual currentindy, ParticleSubSwarmOptimization subswarm) {
|
protected void subswarmCreationEventFor(AbstractEAIndividual currentindy, ParticleSubSwarmOptimization subswarm) {
|
||||||
if (isVerbose()) {
|
if (isVerbose()) {
|
||||||
System.out.print("creating subswarm\n");
|
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
|
* that meets the convergence-criteria of the creation strategy
|
||||||
*/
|
*/
|
||||||
protected void createSubswarmIfPossible() {
|
protected void createSubswarmIfPossible() {
|
||||||
@ -679,13 +651,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ********************************************************************************************************************
|
|
||||||
* setter, getter: population and solutions
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested nn (non-Javadoc)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setPopulation(Population pop) {
|
public void setPopulation(Population pop) {
|
||||||
//pass on to mainswarm optimizer
|
//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
|
* @return a population consisting of copies from the mainswarm and all
|
||||||
* active subswarms
|
* active subswarms
|
||||||
* @tested junit, junit&
|
|
||||||
*/
|
*/
|
||||||
public Population getActivePopulation() {
|
public Population getActivePopulation() {
|
||||||
// construct a metapop with clones from the mainswarm and all active subswarms
|
// 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
|
* @return a population consisting of copies from the mainswarm and all
|
||||||
* subswarms.
|
* 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
|
* mainswarm and all subswarms (active and inactive, so the size of this
|
||||||
* Population is not necessarily constant). (Especially important for the
|
* Population is not necessarily constant). (Especially important for the
|
||||||
* call back regarding the output file... ) Beware:
|
* 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
|
* @return a population consisting of the personal best solutions of every
|
||||||
* particle in the mainswarm and all subswarms
|
* particle in the mainswarm and all subswarms
|
||||||
* @tested junit (non-Javadoc)
|
|
||||||
* @see eva2.optimization.strategies.InterfaceOptimizer#getAllSolutions()
|
* @see eva2.optimization.strategies.InterfaceOptimizer#getAllSolutions()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -819,7 +782,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the best solution found by any particle in any swarm
|
* @return the best solution found by any particle in any swarm
|
||||||
* @tested junit
|
|
||||||
*/
|
*/
|
||||||
public AbstractEAIndividual getGlobalBestSolution() {
|
public AbstractEAIndividual getGlobalBestSolution() {
|
||||||
Population metapop = getPopulation();
|
Population metapop = getPopulation();
|
||||||
@ -839,7 +801,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array with copies of the gbest individuals
|
* @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
|
* time) from every subswarm and the main swarm
|
||||||
*/
|
*/
|
||||||
public Population getSubswarmRepresentatives(boolean onlyInactive) {
|
public Population getSubswarmRepresentatives(boolean onlyInactive) {
|
||||||
@ -859,7 +821,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param size
|
* @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()
|
* instead of getPopulation.setPopulationSize()
|
||||||
*/
|
*/
|
||||||
public void setMainSwarmSize(int size) {
|
public void setMainSwarmSize(int size) {
|
||||||
@ -871,7 +833,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the !initial! size of the mainswarm population
|
* @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() {
|
public int getMainSwarmSize() {
|
||||||
return this.mainSwarmSize;
|
return this.mainSwarmSize;
|
||||||
@ -883,7 +845,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param val
|
* @param val
|
||||||
* @tested ps defines the maximal allowed subswarm radius for absorption and
|
* defines the maximal allowed subswarm radius for absorption and
|
||||||
* merging
|
* merging
|
||||||
*/
|
*/
|
||||||
public void setMaxAllowedSwarmRadius(double val) {
|
public void setMaxAllowedSwarmRadius(double val) {
|
||||||
@ -899,7 +861,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* @tested nn
|
|
||||||
*/
|
*/
|
||||||
public double getMaxAllowedSwarmRadius() {
|
public double getMaxAllowedSwarmRadius() {
|
||||||
return this.maxAllowedSwarmRadius;
|
return this.maxAllowedSwarmRadius;
|
||||||
@ -1002,7 +963,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param val
|
* @param val
|
||||||
* @tested nn
|
|
||||||
*/
|
*/
|
||||||
public void SetPartlyInactive(boolean val) {
|
public void SetPartlyInactive(boolean val) {
|
||||||
this.partlyInactive = val;
|
this.partlyInactive = val;
|
||||||
@ -1010,7 +970,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* @tested nn
|
|
||||||
*/
|
*/
|
||||||
public boolean isPartlyInactive() {
|
public boolean isPartlyInactive() {
|
||||||
return partlyInactive;
|
return partlyInactive;
|
||||||
@ -1186,7 +1145,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param problem
|
* @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
|
@Override
|
||||||
@Hidden
|
@Hidden
|
||||||
@ -1221,7 +1180,6 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
/**
|
/**
|
||||||
* @param vals
|
* @param vals
|
||||||
* @return
|
* @return
|
||||||
* @tested junit
|
|
||||||
*/
|
*/
|
||||||
public double getMedian(double[] vals) {
|
public double getMedian(double[] vals) {
|
||||||
java.util.Arrays.sort(vals);
|
java.util.Arrays.sort(vals);
|
||||||
@ -1299,13 +1257,9 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
return meanDiv;
|
return meanDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ********************************************************************************************************************
|
|
||||||
* setter, getter: infostrings
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @return The name of the algorithm
|
* @return The name of the algorithm
|
||||||
* @tested nn This method will return a naming String
|
* This method will return a naming String
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -1314,7 +1268,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A descriptive string
|
* @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.
|
* the optimizer and the applied methods.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -1327,7 +1281,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return descriptive string of the elite
|
* @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
|
* best of all time) from every subswarm
|
||||||
*/
|
*/
|
||||||
public String getSubswarmRepresentativesAsString(boolean onlyInactive) {
|
public String getSubswarmRepresentativesAsString(boolean onlyInactive) {
|
||||||
@ -1342,7 +1296,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* @tested emp
|
* emp
|
||||||
*/
|
*/
|
||||||
public String getPerformanceAsString() {
|
public String getPerformanceAsString() {
|
||||||
if (!(optimizationProblem instanceof InterfaceMultimodalProblem)) {
|
if (!(optimizationProblem instanceof InterfaceMultimodalProblem)) {
|
||||||
@ -1390,7 +1344,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
* for the logfile
|
* for the logfile
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @tested emp generates the NichePSO_date file
|
* emp generates the NichePSO_date file
|
||||||
*/
|
*/
|
||||||
protected void initLogFile() {
|
protected void initLogFile() {
|
||||||
// opening output file...
|
// opening output file...
|
||||||
@ -1426,7 +1380,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param line string to be written
|
* @param line string to be written
|
||||||
* @tested emp writes something to the LogFile
|
* emp writes something to the LogFile
|
||||||
*/
|
*/
|
||||||
protected void writeToLogFile(String line) {
|
protected void writeToLogFile(String line) {
|
||||||
String write = line + "\n";
|
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
|
* @param index
|
||||||
* @return particle with given index
|
* @return particle with given index
|
||||||
* @tested @param pop
|
* @param pop
|
||||||
*/
|
*/
|
||||||
public AbstractEAIndividual getIndyByParticleIndexAndPopulation(Population pop, Integer index) {
|
public AbstractEAIndividual getIndyByParticleIndexAndPopulation(Population pop, Integer index) {
|
||||||
for (int i = 0; i < pop.size(); ++i) {
|
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
|
* @return main swarm particle with given index
|
||||||
* @tested @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
public AbstractEAIndividual getIndyByParticleIndex(Integer index) {
|
public AbstractEAIndividual getIndyByParticleIndex(Integer index) {
|
||||||
AbstractEAIndividual indy = null;
|
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
|
* iterations
|
||||||
*/
|
*/
|
||||||
protected AbstractEAIndividual getIndyWithMinStdDev() {
|
protected AbstractEAIndividual getIndyWithMinStdDev() {
|
||||||
@ -1510,11 +1458,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ********************************************************************************************************************
|
* Inits a new Topoplot
|
||||||
* plotting
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested inits a new Topoplot
|
|
||||||
*/
|
*/
|
||||||
protected void initPlotSwarm() {
|
protected void initPlotSwarm() {
|
||||||
double[] a = new double[2];
|
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() {
|
protected void cleanPlotSwarm() {
|
||||||
// delete all previous points
|
// 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() {
|
protected void plotAllStdDevsInMainSwarm() {
|
||||||
//add further information to MainSwarm-Plot point by point
|
//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() {
|
protected void plotMinStdDevInMainSwarm() {
|
||||||
//add further information to MainSwarm-Plot (minimal stddev)
|
//add further information to MainSwarm-Plot (minimal stddev)
|
||||||
@ -1588,7 +1532,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param boundary
|
* @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) {
|
protected void plotBoundStdDevInMainSwarm(double boundary) {
|
||||||
InterfaceDataTypeDouble tmpIndy1;
|
InterfaceDataTypeDouble tmpIndy1;
|
||||||
@ -1616,7 +1560,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
/**
|
/**
|
||||||
* @param index index of the particle
|
* @param index index of the particle
|
||||||
* @param text information to be added
|
* @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) {
|
protected void plotCircleForIndy(int index, String text) {
|
||||||
AbstractEAIndividual indy = getIndyByParticleIndex(index);
|
AbstractEAIndividual indy = getIndyByParticleIndex(index);
|
||||||
@ -1631,7 +1575,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
/**
|
/**
|
||||||
* @param indy invidual
|
* @param indy invidual
|
||||||
* @param text information to be added
|
* @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) {
|
protected void plotCircleForIndy(AbstractEAIndividual indy, String text) {
|
||||||
InterfaceDataTypeDouble tmpIndy1 = (InterfaceDataTypeDouble) indy;
|
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) {
|
protected void plotMainSwarm(boolean withIDs) {
|
||||||
if (this.optimizationProblem instanceof Interface2DBorderProblem) {
|
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
|
* individual
|
||||||
*/
|
*/
|
||||||
protected void plotSubSwarms() {
|
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() {
|
protected void plotAdditionalInfo() {
|
||||||
// from merging
|
// from merging
|
||||||
@ -1872,7 +1816,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tested @param particleIndex
|
* @param particleIndex
|
||||||
*/
|
*/
|
||||||
protected void plotTraceIndy(int particleIndex) {
|
protected void plotTraceIndy(int particleIndex) {
|
||||||
AbstractEAIndividual indy = getIndyByParticleIndex(particleIndex);
|
AbstractEAIndividual indy = getIndyByParticleIndex(particleIndex);
|
||||||
@ -1890,7 +1834,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indy
|
* @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
|
* neighborhood best position for a given individual
|
||||||
*/
|
*/
|
||||||
protected void plotStatusForIndy(AbstractEAIndividual indy) {
|
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
|
* Niching Particle Swarm Optimizer. SEAL 2002. Exeption: the swarm size is
|
||||||
* 200 by default, because 30 (of the orig. paper) seems way too low.
|
* 200 by default, because 30 (of the orig. paper) seems way too low.
|
||||||
* <p>
|
* <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
|
* Optimizer. SEAL 2002. Exception: the swarm size is 100 by default, because
|
||||||
* 30 (of the orig. paper) seems way too low.
|
* 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
|
* Set parameters as to Brits, Engelbrecht & Bergh: A Niching Particle Swarm
|
||||||
* Optimizer. SEAL 2002. Exeption: the swarm size is 200 by default, because
|
* Optimizer. SEAL 2002. Exception: the swarm size is 200 by default, because
|
||||||
* 30 (of the orig. paper) seems way too low.
|
* 30 (of the orig. paper) seems way too low.
|
||||||
*
|
*
|
||||||
* @param npso an already existing NichePSO instance or null to create a new one
|
* @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 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
|
private int fitnessArchiveSize = 15; // maximal number of fitnessvalues remembered from former iterations
|
||||||
|
|
||||||
/**
|
|
||||||
* @tested ps
|
|
||||||
* ctor
|
|
||||||
*/
|
|
||||||
public ParticleSubSwarmOptimization() {
|
public ParticleSubSwarmOptimization() {
|
||||||
updateMaxPosDist();
|
updateMaxPosDist();
|
||||||
this.maxAllowedSwarmRadiusNormal = 0.1; // set similar to "particle swarms for multimodal optimization" by Oezcan and Yilmaz
|
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.);
|
// setInitialVelocity(1.);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @tested cpyctor
|
|
||||||
*/
|
|
||||||
public ParticleSubSwarmOptimization(ParticleSubSwarmOptimization a) {
|
public ParticleSubSwarmOptimization(ParticleSubSwarmOptimization a) {
|
||||||
super(a);
|
super(a);
|
||||||
if (a.bestIndividual != null) {
|
if (a.bestIndividual != null) {
|
||||||
@ -60,22 +53,12 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
fitnessArchiveSize = a.fitnessArchiveSize;
|
fitnessArchiveSize = a.fitnessArchiveSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @tested (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#clone()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
return new ParticleSubSwarmOptimization(this);
|
return new ParticleSubSwarmOptimization(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* inits
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested ps
|
|
||||||
* (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#initialize()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
@ -88,10 +71,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
// setInertnessOrChi(inertnessAging.getStartValue());
|
// setInertnessOrChi(inertnessAging.getStartValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @tested ps
|
|
||||||
* (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#initializeByPopulation(javaeva.server.oa.go.Populations.Population, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeByPopulation(Population pop, boolean reset) {
|
public void initializeByPopulation(Population pop, boolean reset) {
|
||||||
super.initializeByPopulation(pop, 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
|
* adds a vector for fitnessvalues to all individuals in the swarm
|
||||||
* and sets the current fitness as the first value
|
* 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
|
* adds a std deviation value to an individual
|
||||||
* and initially sets this value to infinity.
|
* 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
|
* adds a representation of the personal best to an individual
|
||||||
* and initially sets the current individual as its personal best.
|
* and initially sets the current individual as its personal best.
|
||||||
*/
|
*/
|
||||||
@ -153,13 +129,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
indy.putData("PersonalBestKey", newpbest);
|
indy.putData("PersonalBestKey", newpbest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* Optimization
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested ps
|
|
||||||
* (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#optimize()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void optimize() {
|
public void optimize() {
|
||||||
super.optimize();
|
super.optimize();
|
||||||
@ -230,11 +199,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* updates
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @tested ps
|
|
||||||
* when particles enter or leave the population,
|
* when particles enter or leave the population,
|
||||||
* call this method to update the status of 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
|
* updates the bestIndividual member which represents the gbest individual
|
||||||
* (i.e. the best position and fitness encountered by any particle of the swarm)
|
* (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,
|
* 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.
|
* adds the current fitnessvalue to the fitnessarchive for every individual in the swarm.
|
||||||
* Keeps the fitnessarchive at a limited size (lim+1).
|
* 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
|
* sets the std dev value of all individuals in the swarm
|
||||||
* to the std deviation over the last 3 fitness values
|
* 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
|
* update the personal best representation if the current individual is better than the pbest
|
||||||
*/
|
*/
|
||||||
public void updatePersonalBest() {
|
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
|
* updates the member representing the maximal possible distance in the current searchspace
|
||||||
*/
|
*/
|
||||||
public void updateMaxPosDist() {
|
public void updateMaxPosDist() {
|
||||||
@ -385,7 +345,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
* @param indy1
|
* @param indy1
|
||||||
* @param indy2
|
* @param indy2
|
||||||
* @return
|
* @return
|
||||||
* @tested junit
|
|
||||||
* returns the euclidean distance in the search space between indy1 and indy2.
|
* returns the euclidean distance in the search space between indy1 and indy2.
|
||||||
*/
|
*/
|
||||||
public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) {
|
public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) {
|
||||||
@ -397,9 +356,8 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
* @param vec
|
* @param vec
|
||||||
* @param range number of values (beginning at the end of vec!) considered to compute the mean
|
* @param range number of values (beginning at the end of vec!) considered to compute the mean
|
||||||
* @return
|
* @return
|
||||||
* @tested junit
|
|
||||||
* returns the mean value for the provided data vec but only for a given number of values.
|
* 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) {
|
protected static double mean(Vector<Double> vec, int range) {
|
||||||
if (vec.size() < range) {
|
if (vec.size() < range) {
|
||||||
@ -416,7 +374,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
* @param vec data
|
* @param vec data
|
||||||
* @param range number of values (beginning at the end of vec!) considered to compute the std deviation
|
* @param range number of values (beginning at the end of vec!) considered to compute the std deviation
|
||||||
* @return
|
* @return
|
||||||
* @tested junit
|
|
||||||
* returns the std deviation for the provided data vec but only for a given number of values
|
* 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) {
|
public static double stdDev(Vector<Double> vec, int range) {
|
||||||
@ -443,11 +400,10 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
/**
|
/**
|
||||||
* @param normalisedRadius
|
* @param normalisedRadius
|
||||||
* @return
|
* @return
|
||||||
* @tested ps
|
|
||||||
* Interpretes the given maximal radius as normalised according to the current search space.
|
* 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
|
* 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.
|
* (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.
|
* this function converts the normalised distance into the standard euclidean distance.
|
||||||
*/
|
*/
|
||||||
public double interpreteAsNormalisedSwarmRadius(double normalisedRadius) {
|
public double interpreteAsNormalisedSwarmRadius(double normalisedRadius) {
|
||||||
@ -458,13 +414,8 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
return normalisedRadius * maxPosDist;
|
return normalisedRadius * maxPosDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* addNewParticlesToPopulation ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param particleIndices set of indices that should be used for the added particles, if null new indices are created
|
* @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
|
* adds new particles to this swarm, rndly inited over the search space by the problem
|
||||||
*/
|
*/
|
||||||
private void addNewParticlesToPopulation(int[] particleIndices) {
|
private void addNewParticlesToPopulation(int[] particleIndices) {
|
||||||
@ -510,7 +461,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @param pop
|
* @param pop
|
||||||
* @tested nn
|
|
||||||
* adds a population and its function calls to this.population
|
* adds a population and its function calls to this.population
|
||||||
*/
|
*/
|
||||||
public void addPopulation(ParticleSubSwarmOptimization pop) {
|
public void addPopulation(ParticleSubSwarmOptimization pop) {
|
||||||
@ -519,7 +469,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pop
|
* @param pop
|
||||||
* @tested junit& ..
|
|
||||||
* adds a population and its function calls to this.population
|
* adds a population and its function calls to this.population
|
||||||
*/
|
*/
|
||||||
public void addPopulation(Population pop) {
|
public void addPopulation(Population pop) {
|
||||||
@ -532,7 +481,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
/**
|
/**
|
||||||
* @param ind
|
* @param ind
|
||||||
* @return
|
* @return
|
||||||
* @tested nn
|
|
||||||
* adss an inidividual
|
* adss an inidividual
|
||||||
*/
|
*/
|
||||||
public boolean addIndividual(IndividualInterface ind) {
|
public boolean addIndividual(IndividualInterface ind) {
|
||||||
@ -544,7 +492,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
/**
|
/**
|
||||||
* @param o
|
* @param o
|
||||||
* @return
|
* @return
|
||||||
* @tested nn
|
|
||||||
*/
|
*/
|
||||||
public boolean add(Object o) {
|
public boolean add(Object o) {
|
||||||
return addIndividual((IndividualInterface) o);
|
return addIndividual((IndividualInterface) o);
|
||||||
@ -552,7 +499,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indy
|
* @param indy
|
||||||
* @tested nn
|
|
||||||
* adds indy to the swarm
|
* adds indy to the swarm
|
||||||
*/
|
*/
|
||||||
public void add(AbstractEAIndividual indy) {
|
public void add(AbstractEAIndividual indy) {
|
||||||
@ -561,7 +507,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ind
|
* @param ind
|
||||||
* @tested nn
|
|
||||||
* removes an individual
|
* removes an individual
|
||||||
*/
|
*/
|
||||||
public boolean removeSubIndividual(IndividualInterface ind) {
|
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
|
* @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
|
@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.
|
* @return the maximal euclidean distance between the swarms gbest and any other particle in the swarm.
|
||||||
* @tested junit
|
|
||||||
*/
|
*/
|
||||||
public double getSwarmRadius() {
|
public double getSwarmRadius() {
|
||||||
if (getPopulation().size() == 0 || getPopulation().size() == 1) {
|
if (getPopulation().size() == 0 || getPopulation().size() == 1) {
|
||||||
@ -631,7 +561,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* @tested ps
|
|
||||||
* returns the maximal distance between the gbest position and any individual in the swarm
|
* returns the maximal distance between the gbest position and any individual in the swarm
|
||||||
* this distance is not allowed to exceed a given threshold
|
* 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]
|
* @param maxAllowedSwarmRadius value from the intervall [0,1]
|
||||||
* @tested nn
|
|
||||||
* binds the swarmradius to the given normalised value
|
* 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)
|
* (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
|
* @return
|
||||||
* @tested nn
|
|
||||||
*/
|
*/
|
||||||
public double getMaxAllowedSwarmRadius() {
|
public double getMaxAllowedSwarmRadius() {
|
||||||
return this.maxAllowedSwarmRadiusNormal;
|
return this.maxAllowedSwarmRadiusNormal;
|
||||||
@ -698,7 +625,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param active
|
* @param active
|
||||||
* @tested nn
|
|
||||||
* marks the swarm as active or inactive
|
* marks the swarm as active or inactive
|
||||||
*/
|
*/
|
||||||
public void SetActive(boolean active) {
|
public void SetActive(boolean active) {
|
||||||
@ -707,7 +633,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
* @tested nn
|
|
||||||
*/
|
*/
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
@ -728,7 +653,6 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
|||||||
/**
|
/**
|
||||||
* @param indy particle should be from this swarm
|
* @param indy particle should be from this swarm
|
||||||
* @return null if there is no neighbor else neighbor
|
* @return null if there is no neighbor else neighbor
|
||||||
* @tested junit
|
|
||||||
* returns the particle with the minimal distance to indy
|
* returns the particle with the minimal distance to indy
|
||||||
*/
|
*/
|
||||||
public AbstractEAIndividual getMemberNeighbor(AbstractEAIndividual 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
|
* This method will update a given individual according to the PSO method
|
||||||
*
|
*
|
||||||
* @param index The individual to update.
|
* @param index The individual to update.
|
||||||
|
* @param indy An individual
|
||||||
* @param pop The current population.
|
* @param pop The current population.
|
||||||
* @param best The best individual found so far.
|
|
||||||
*/
|
*/
|
||||||
protected void updateIndividual(int index, AbstractEAIndividual indy, Population pop) {
|
protected void updateIndividual(int index, AbstractEAIndividual indy, Population pop) {
|
||||||
if (indy instanceof InterfaceDataTypeDouble) {
|
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 index index of the individual for which to check
|
||||||
* @param pop the current swarm
|
* @param pop the current swarm
|
||||||
* @param best the currently best individual
|
|
||||||
* @return a copy of the position of the best remembered individual in the
|
* @return a copy of the position of the best remembered individual in the
|
||||||
* neigbourhood
|
* 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
|
* 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 =
|
* Chi parameter (constriction) is set as in 2 Chi =
|
||||||
* ------------------------ |2-tau-sqrt(tau^2-4 tau)| where tau = tau1 +
|
* ------------------------ |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.
|
* convergence, 2002.
|
||||||
*
|
*
|
||||||
* @param tau1
|
* @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) {
|
public void setShow(boolean show) {
|
||||||
this.show = show;
|
this.show = show;
|
||||||
|
@ -28,13 +28,9 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
|||||||
|
|
||||||
protected int getAccelerationForGlobalBestParticleCounter = 0; // only for testing
|
protected int getAccelerationForGlobalBestParticleCounter = 0; // only for testing
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* ctors, inits
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @tested ps
|
* Sets default values according to
|
||||||
* ctor - sets default values according to
|
* "An Analysis of Particle Swarm Optimizers" by Franz van den Bergh
|
||||||
* "An Analyis of Paricle Swarm Optimizers" by Franz van den Bergh
|
|
||||||
*/
|
*/
|
||||||
public ParticleSwarmOptimizationGCPSO() {
|
public ParticleSwarmOptimizationGCPSO() {
|
||||||
setGcpso(true);
|
setGcpso(true);
|
||||||
@ -52,7 +48,6 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param a
|
* @param a
|
||||||
* @tested ps
|
|
||||||
*/
|
*/
|
||||||
public ParticleSwarmOptimizationGCPSO(ParticleSwarmOptimizationGCPSO a) {
|
public ParticleSwarmOptimizationGCPSO(ParticleSwarmOptimizationGCPSO a) {
|
||||||
super(a);
|
super(a);
|
||||||
@ -73,12 +68,6 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
|||||||
this.SetRhoDecreaseFactor(a.getRhoDecreaseFactor());
|
this.SetRhoDecreaseFactor(a.getRhoDecreaseFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* overwritten
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @tested (non-Javadoc) @see javaeva.server.go.strategies.ParticleSwarmOptimization#optimize()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void optimize() {
|
public void optimize() {
|
||||||
super.optimize(); //updatePopulation->updateIndividual->updateVelocity (s.u.)
|
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[][])
|
* (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.
|
* 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
|
* @return the index of the particle with the best personal best position
|
||||||
* (i.e. the index of the global best particle)
|
* (i.e. the index of the global best particle)
|
||||||
* @tested junit
|
|
||||||
*/
|
*/
|
||||||
protected int getIndexOfGlobalBestParticle() {
|
protected int getIndexOfGlobalBestParticle() {
|
||||||
if (getPopulation().size() == 0) {
|
if (getPopulation().size() == 0) {
|
||||||
@ -158,11 +145,7 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
|
||||||
* updateGCPSOMember
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @tested junit
|
|
||||||
* updates: gbestParticleIndex,gbestParticleHasChanged,numOfSuccesses,numOfFailures,gbestParticle,rho
|
* updates: gbestParticleIndex,gbestParticleHasChanged,numOfSuccesses,numOfFailures,gbestParticle,rho
|
||||||
*/
|
*/
|
||||||
protected void updateGCPSOMember() {
|
protected void updateGCPSOMember() {
|
||||||
|
@ -39,10 +39,7 @@ import java.util.List;
|
|||||||
* though.
|
* though.
|
||||||
*
|
*
|
||||||
* @author Maurice Clerc, Marcel Kronfeld
|
* @author Maurice Clerc, Marcel Kronfeld
|
||||||
* @author Maurice.Clerc@WriteMe.com {@link http://mauriceclerc.net}
|
* @author Maurice.Clerc@WriteMe.com
|
||||||
* {@link http://clerc.maurice.free.fr/pso/}
|
|
||||||
* @version 2006-02 21
|
|
||||||
* @date 2007-09-13
|
|
||||||
* <p>
|
* <p>
|
||||||
* Original notes:
|
* Original notes:
|
||||||
*/
|
*/
|
||||||
@ -461,21 +458,21 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
* save("\n" + iter + " " + evalF + " " + swarm.Best.position.totalError + "
|
* save("\n" + iter + " " + evalF + " " + swarm.Best.position.totalError + "
|
||||||
* " + swarm.size, runSave);
|
* " + 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;
|
* > swarm.Best.position.totalError;
|
||||||
*
|
*
|
||||||
* if (Tribes.adaptOption == 0) { continue iterations; }
|
* if (Tribes.adaptOption == 0) { continue iterations; }
|
||||||
*
|
*
|
||||||
* if (Tribes.adaptOption == 1) { // Just reinitialize the swarm
|
* if (Tribes.adaptOption == 1) { // Just reinitialize the swarm
|
||||||
* adaptThreshold = iter - adapt; // adaptMax=swarmSize; adaptMax =
|
* adaptThreshold = iter - adapt; // adaptMax=swarmSize; adaptMax =
|
||||||
* swarm.linkNb(swarm); if (adaptThreshold >= adaptMax) { if
|
* swarm.linkNb(swarm); if (adaptThreshold >= adaptMax) { if
|
||||||
* (swarm.Best.positionPrev.totalError <= swarm.Best.position.totalError) {
|
* (swarm.Best.positionPrev.totalError <= swarm.Best.position.totalError) {
|
||||||
* adapt = iter; // Memorize at which iteration adaptation occurs
|
* adapt = iter; // Memorize at which iteration adaptation occurs
|
||||||
*
|
*
|
||||||
* for (n = 0; n < swarm.tribeNb; n++) {
|
* for (n = 0; n < swarm.tribeNb; n++) {
|
||||||
* evalF=swarm.tribes[n].reinitTribe(pb,evalF); } } } continue iterations; }
|
* 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
|
* { // Structural adaptations
|
||||||
*
|
*
|
||||||
* //swarmSize = swarm.swarmSize(swarm);
|
* //swarmSize = swarm.swarmSize(swarm);
|
||||||
@ -490,7 +487,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
* adaptThreshold = iter - adapt; // adaptMax=swarmSize; adaptMax =
|
* adaptThreshold = iter - adapt; // adaptMax=swarmSize; adaptMax =
|
||||||
* swarm.linkNb(swarm);
|
* 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,
|
* iteration adaptation occurs evalF=swarm.adaptSwarm(pb,
|
||||||
* Tribes.adaptOption, swarm, displayPb,evalF); // Réalise l'adaptation
|
* Tribes.adaptOption, swarm, displayPb,evalF); // Réalise l'adaptation
|
||||||
*
|
*
|
||||||
|
@ -8,7 +8,7 @@ import java.util.Comparator;
|
|||||||
* Comparator implementation which compares two double arrays.
|
* 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
|
* 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.
|
* 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).
|
* will be used for comparison (single criterion case).
|
||||||
*/
|
*/
|
||||||
public class DoubleArrayComparator implements Comparator<Object> {
|
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
|
* 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
|
* @param problemTime the current simulation time of the problem
|
||||||
* @return true, if the problem is to change at the given time, else false
|
* @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.
|
* Calculates the maximum peak ratio based on the given fitness values.
|
||||||
* This is the standard formulation of MPR which assumes that all fitness
|
* 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].
|
* If these assumptions hold, the MPR lies in [0,1].
|
||||||
*
|
*
|
||||||
* @param realFits
|
* @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.
|
* 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.
|
* individual.
|
||||||
*
|
*
|
||||||
* @param generation generation of the individual or -1
|
* @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 orig individual that is to be tested
|
||||||
* @param epsilon maximal allowed improvement before considered premature (given as distance in the search space)
|
* @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
|
* @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
|
* @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)
|
* @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) {
|
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
|
* Start an external runtime problem with some basic configs. The
|
||||||
* default variant uses equally weighs all objectives through an equally weighted sum.
|
* 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
|
* @param args
|
||||||
*/
|
*/
|
||||||
@ -40,7 +40,7 @@ public class ERPStarter {
|
|||||||
// prefix for data output file - set null to deactivate
|
// prefix for data output file - set null to deactivate
|
||||||
String outputFilePrefix = "erpTest";
|
String outputFilePrefix = "erpTest";
|
||||||
|
|
||||||
/** Argument handling ****************/
|
// Argument handling
|
||||||
String[] keys = new String[]{"--gui", "--multiObjective", "--csv", "--cmd", "--maxEvals"};
|
String[] keys = new String[]{"--gui", "--multiObjective", "--csv", "--cmd", "--maxEvals"};
|
||||||
int[] arities = new int[]{0, 0, 1, 1, 1};
|
int[] arities = new int[]{0, 0, 1, 1, 1};
|
||||||
Object[] values = new Object[6];
|
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
|
* 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".
|
* "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})
|
* 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;
|
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")
|
@Description("N-Function from Shir&Baeck, PPSN 2006")
|
||||||
public class F18Problem extends AbstractProblemDouble implements
|
public class F18Problem extends AbstractProblemDouble implements
|
||||||
|
@ -8,7 +8,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Random;
|
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.
|
* 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
|
* Sphere Problem
|
||||||
*/
|
*/
|
||||||
@Description(value ="Sphere Problem")
|
@Description(value = "Sphere Problem")
|
||||||
public class F1Problem extends AbstractProblemDoubleOffset implements Interface2DBorderProblem, InterfaceHasInitRange, java.io.Serializable, InterfaceFirstOrderDerivableProblem {
|
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)
|
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
|
@Override
|
||||||
public Object getInitializationRange() {
|
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
|
@Override
|
||||||
public Object getInitializationRange() {
|
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
|
@Override
|
||||||
public Object getInitializationRange() {
|
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
|
* 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
|
* 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,
|
* 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.
|
* will be rescaled to values below scLimit.
|
||||||
*/
|
*/
|
||||||
public class GPFunctionProblem extends AbstractProblemDouble implements InterfaceProgramProblem {
|
public class GPFunctionProblem extends AbstractProblemDouble implements InterfaceProgramProblem {
|
||||||
|
@ -48,7 +48,6 @@ import java.util.zip.ZipInputStream;
|
|||||||
* @author wegnerj
|
* @author wegnerj
|
||||||
* @author Robin Friedman, rfriedman@TriadTherapeutics.com
|
* @author Robin Friedman, rfriedman@TriadTherapeutics.com
|
||||||
* @author Gerd Mueller
|
* @author Gerd Mueller
|
||||||
* @license GPL
|
|
||||||
*/
|
*/
|
||||||
public class BasicResourceLoader implements ResourceLoader {
|
public class BasicResourceLoader implements ResourceLoader {
|
||||||
/**
|
/**
|
||||||
|
@ -21,9 +21,9 @@ import java.awt.print.PageFormat;
|
|||||||
import java.awt.print.Printable;
|
import java.awt.print.Printable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DArea is the crossing of the <code>JComponent</code>s and the
|
* DArea is the crossing of the {@code JComponent}s and the
|
||||||
* <code>DComponent</code>s. It's the <code>DParent</code> which can be added to
|
* {@code DComponent}s. It's the {@code DParent} which can be added to
|
||||||
* <code>JComponent</code>s
|
* {@code JComponent}s
|
||||||
*/
|
*/
|
||||||
public class DArea extends JComponent implements DParent, Printable {
|
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
|
* returns if the grid is visible {@code true} if the grid is visible
|
||||||
* or <code>false</code> if not
|
* or {@code false} if not
|
||||||
*
|
*
|
||||||
* @return true or false
|
* @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
|
* 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() {
|
public boolean isOnAutoFocus() {
|
||||||
return autoFocus;
|
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
|
* 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
|
* autoGrid option
|
||||||
*/
|
*/
|
||||||
private void paintGrid(DMeasures m) {
|
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
|
* 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
|
* @param aFlag grid t front or not
|
||||||
*/
|
*/
|
||||||
@ -669,7 +669,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
|||||||
/**
|
/**
|
||||||
* sets the minimal rectangle
|
* 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) {
|
public void setMinRectangle(DRectangle rect) {
|
||||||
if (rect.isEmpty()) {
|
if (rect.isEmpty()) {
|
||||||
@ -724,7 +724,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
|||||||
/**
|
/**
|
||||||
* sets the visible rectangle
|
* 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) {
|
public void setVisibleRectangle(DRectangle rect) {
|
||||||
if (rect.isEmpty()) {
|
if (rect.isEmpty()) {
|
||||||
|
@ -97,9 +97,9 @@ public class DArray implements DIntDoubleMap {
|
|||||||
* the given image value becomes the image of (highest source value + 1)
|
* the given image value becomes the image of (highest source value + 1)
|
||||||
*
|
*
|
||||||
* @param image the new 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
|
* has been changed by this method call, else it returns
|
||||||
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
|
* {@code false} @see #getMinImageValue(), #getMaxImageValue()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean addImage(double image) {
|
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
|
* 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
|
@Override
|
||||||
public boolean restore() {
|
public boolean restore() {
|
||||||
@ -230,7 +230,7 @@ public class DArray implements DIntDoubleMap {
|
|||||||
* It looks for differences in the stored image values
|
* It looks for differences in the stored image values
|
||||||
*
|
*
|
||||||
* @param o the object to compare with
|
* @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
|
* the same values
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,9 +3,9 @@ package eva2.tools.chart2d;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>DComponent</code> is the mother of all objects which can be displayed
|
* {@code DComponent} is the mother of all objects which can be displayed
|
||||||
* by a <code>DArea</code> object, even when it would be also enough to
|
* by a {@code DArea} object, even when it would be also enough to
|
||||||
* implement the <code>DElement</code> interface to an class
|
* implement the {@code DElement} interface to an class
|
||||||
* <p>
|
* <p>
|
||||||
* DComponent is abstract because the paint method has to be overridden
|
* DComponent is abstract because the paint method has to be overridden
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +65,7 @@ public class DGrid extends DComponent {
|
|||||||
/**
|
/**
|
||||||
* paints the grid...
|
* 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
|
@Override
|
||||||
public void paint(DMeasures m) {
|
public void paint(DMeasures m) {
|
||||||
|
@ -16,9 +16,9 @@ public interface DIntDoubleMap {
|
|||||||
*
|
*
|
||||||
* @param source the preimage of the image
|
* @param source the preimage of the image
|
||||||
* @param image the new image of the source value
|
* @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
|
* 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);
|
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
|
* the image of the highest source value + 1 should be the given image value
|
||||||
*
|
*
|
||||||
* @param image the new 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
|
* 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);
|
boolean addImage(double image);
|
||||||
|
|
||||||
@ -72,10 +72,10 @@ public interface DIntDoubleMap {
|
|||||||
double getMinPositiveImageValue();
|
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
|
* 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
|
* minimal image value has changed
|
||||||
*/
|
*/
|
||||||
boolean restore();
|
boolean restore();
|
||||||
|
@ -41,7 +41,7 @@ public class DMeasures implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* method returns the pixel-point which belongs to the given D-coordinates
|
* method returns the pixel-point which belongs to the given D-coordinates
|
||||||
* it says where to paint a certain DPoint
|
* 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
|
* image of the scale functions
|
||||||
*
|
*
|
||||||
* @param x the double x D-coordinate
|
* @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
|
* method returns the point in D-coordinates which corresponds to the
|
||||||
* given pixel-coordinates
|
* 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
|
* the double coordinates, when they represent a point outside of the definition
|
||||||
* area of the scale functions
|
* area of the scale functions
|
||||||
*
|
*
|
||||||
@ -168,7 +168,7 @@ public class DMeasures implements Serializable {
|
|||||||
* method returns the image rectangle of the given rectangle
|
* method returns the image rectangle of the given rectangle
|
||||||
* they differ if there are scale functions selected which are not the identity
|
* 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
|
* 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
|
* @return the source of it
|
||||||
*/
|
*/
|
||||||
@ -201,7 +201,7 @@ public class DMeasures implements Serializable {
|
|||||||
* method returns the source rectangle of the given rectangle
|
* method returns the source rectangle of the given rectangle
|
||||||
* they differ if there are scale functions selected which are not the identity
|
* 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
|
* 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>
|
* <p>
|
||||||
* Tuning: rect must not be empty
|
* Tuning: rect must not be empty
|
||||||
*
|
*
|
||||||
|
@ -238,12 +238,12 @@ public class DPointSet extends DComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* method returns the index to the nearest
|
* method returns the index to the nearest
|
||||||
* <code>DPoint</code> in this
|
* {@code DPoint} in this
|
||||||
* <code>DPointSet</code>.
|
* {@code DPointSet}.
|
||||||
*
|
*
|
||||||
* @return the index to the nearest
|
* @return the index to the nearest
|
||||||
* <code>DPoint</code>. -1 if no nearest
|
* {@code DPoint}. -1 if no nearest
|
||||||
* <code>DPoint</code> was found.
|
* {@code DPoint} was found.
|
||||||
*/
|
*/
|
||||||
public int getNearestDPointIndex(DPoint point) {
|
public int getNearestDPointIndex(DPoint point) {
|
||||||
double minValue = Double.MAX_VALUE;
|
double minValue = Double.MAX_VALUE;
|
||||||
@ -262,11 +262,11 @@ public class DPointSet extends DComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* method returns the nearest
|
* method returns the nearest
|
||||||
* <code>DPoint</code> in this
|
* {@code DPoint} in this
|
||||||
* <code>DPointSet</code>.
|
* {@code DPointSet}.
|
||||||
*
|
*
|
||||||
* @return the nearest
|
* @return the nearest
|
||||||
* <code>DPoint</code>
|
* {@code DPoint}
|
||||||
*/
|
*/
|
||||||
public DPoint getNearestDPoint(DPoint point) {
|
public DPoint getNearestDPoint(DPoint point) {
|
||||||
int minIndex = getNearestDPointIndex(point);
|
int minIndex = getNearestDPointIndex(point);
|
||||||
|
@ -145,8 +145,8 @@ public class ScaledBorder implements Border {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor creates a new <code>ScaledBorder</code>
|
* constructor creates a new {@code ScaledBorder}
|
||||||
* surrounded by the specified <code>Border</code>
|
* surrounded by the specified {@code Border}
|
||||||
*/
|
*/
|
||||||
public ScaledBorder(Border outer) {
|
public ScaledBorder(Border outer) {
|
||||||
outerBorder = 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.
|
* 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.
|
* 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) {
|
public Color getColor(float value) {
|
||||||
return new Color(getRGB(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.
|
* 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) {
|
public int getRGB(float value) {
|
||||||
int rgbValue = 0;
|
int rgbValue = 0;
|
||||||
@ -82,7 +86,7 @@ public class ColorBarCalculator {
|
|||||||
/**
|
/**
|
||||||
* Reverts color scale (e.g. black will be white and vice versa).
|
* 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) {
|
public void setInverseScale(boolean isInverse) {
|
||||||
inverseScale = isInverse;
|
inverseScale = isInverse;
|
||||||
@ -91,7 +95,7 @@ public class ColorBarCalculator {
|
|||||||
/**
|
/**
|
||||||
* Returns current scale mode.
|
* 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() {
|
public boolean isInverseScale() {
|
||||||
return inverseScale;
|
return inverseScale;
|
||||||
|
@ -90,15 +90,15 @@ public final class Mathematics {
|
|||||||
* @param y another vector
|
* @param y another vector
|
||||||
* @param root what kind of distance function
|
* @param root what kind of distance function
|
||||||
* @return the distance of x and y
|
* @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) {
|
public static double dist(double[] x, double[] y, int root) {
|
||||||
if (x.length != y.length) {
|
if (x.length != y.length) {
|
||||||
throw new RuntimeException(
|
throw new IllegalArgumentException(
|
||||||
"The vectors x and y must have the same dimension");
|
"The vectors x and y must have the same dimension");
|
||||||
}
|
}
|
||||||
if (root == 0) {
|
if (root == 0) {
|
||||||
throw new RuntimeException("There is no 0-root!");
|
throw new IllegalArgumentException("There is no 0-root!");
|
||||||
}
|
}
|
||||||
double d = 0;
|
double d = 0;
|
||||||
for (int i = 0; i < x.length; i++) {
|
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 x a vector
|
||||||
* @param y another vector
|
* @param y another vector
|
||||||
* @return the distance of x and y
|
* @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) {
|
public static double euclideanDist(double[] x, double[] y) {
|
||||||
if (x.length != y.length) {
|
if (x.length != y.length) {
|
||||||
@ -787,7 +787,6 @@ public final class Mathematics {
|
|||||||
* Normalize the given vector to a euclidean length of 1.
|
* Normalize the given vector to a euclidean length of 1.
|
||||||
*
|
*
|
||||||
* @param v
|
* @param v
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void normVect(double[] v, double[] res) {
|
public static void normVect(double[] v, double[] res) {
|
||||||
svDiv(norm(v), v, 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
|
* 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,
|
* min and max values like a pool ball. Precondition is min <= val <= max,
|
||||||
* post condition is min <= retVal <= max.
|
* post condition is min <= retVal <= max.
|
||||||
*
|
*
|
||||||
* @param val
|
* @param val
|
||||||
* @param step
|
* @param step
|
||||||
@ -1051,7 +1050,7 @@ public final class Mathematics {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale a range by the given factor, meaning that the interval in each
|
* 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.
|
* around the center.
|
||||||
*
|
*
|
||||||
* @param rangeScaleFact
|
* @param rangeScaleFact
|
||||||
@ -1075,7 +1074,6 @@ public final class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param range
|
* @param range
|
||||||
* @param dist
|
* @param dist
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void shiftRange(double[][] range, double dist) {
|
public static void shiftRange(double[][] range, double dist) {
|
||||||
for (int i = 0; i < range.length; i++) {
|
for (int i = 0; i < range.length; i++) {
|
||||||
@ -1088,7 +1086,6 @@ public final class Mathematics {
|
|||||||
* dimensions as the range.
|
* dimensions as the range.
|
||||||
*
|
*
|
||||||
* @param range
|
* @param range
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void shiftRange(double[][] range, double[] dists) {
|
public static void shiftRange(double[][] range, double[] dists) {
|
||||||
for (int i = 0; i < range.length; i++) {
|
for (int i = 0; i < range.length; i++) {
|
||||||
@ -1174,7 +1171,6 @@ public final class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param s Scalar
|
* @param s Scalar
|
||||||
* @param v Vector
|
* @param v Vector
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void svAdd(double s, double[] v, double[] res) {
|
public static void svAdd(double s, double[] v, double[] res) {
|
||||||
for (int i = 0; i < v.length; i++) {
|
for (int i = 0; i < v.length; i++) {
|
||||||
@ -1200,7 +1196,6 @@ public final class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param s
|
* @param s
|
||||||
* @param v
|
* @param v
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void svDiv(double s, double[] v, double[] res) {
|
public static void svDiv(double s, double[] v, double[] res) {
|
||||||
for (int i = 0; i < v.length; i++) {
|
for (int i = 0; i < v.length; i++) {
|
||||||
@ -1240,7 +1235,6 @@ public final class Mathematics {
|
|||||||
* @param s Scaling factor
|
* @param s Scaling factor
|
||||||
* @param v
|
* @param v
|
||||||
* @param w
|
* @param w
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void svvAddScaled(double s, double[] v, double[] w,
|
public static void svvAddScaled(double s, double[] v, double[] w,
|
||||||
double[] res) {
|
double[] res) {
|
||||||
@ -1255,7 +1249,6 @@ public final class Mathematics {
|
|||||||
* @param s
|
* @param s
|
||||||
* @param v
|
* @param v
|
||||||
* @param w
|
* @param w
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void svvAddAndScale(double s, double[] v, double[] w,
|
public static void svvAddAndScale(double s, double[] v, double[] w,
|
||||||
double[] res) {
|
double[] res) {
|
||||||
@ -1284,7 +1277,6 @@ public final class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param v1
|
* @param v1
|
||||||
* @param v2
|
* @param v2
|
||||||
* @return vector addition
|
|
||||||
*/
|
*/
|
||||||
public static void vvAdd(double[] v1, double[] v2, double[] res) {
|
public static void vvAdd(double[] v1, double[] v2, double[] res) {
|
||||||
vvAddOffs(v1, 0, v2, 0, res, 0, v1.length);
|
vvAddOffs(v1, 0, v2, 0, res, 0, v1.length);
|
||||||
@ -1311,7 +1303,6 @@ public final class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param v1
|
* @param v1
|
||||||
* @param v2
|
* @param v2
|
||||||
* @return vector addition
|
|
||||||
*/
|
*/
|
||||||
public static void vvAddOffs(double[] v1, int v1Offs, double[] v2,
|
public static void vvAddOffs(double[] v1, int v1Offs, double[] v2,
|
||||||
int v2Offs, double[] res, int resOffs, int len) {
|
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]
|
* Component wise multiplication of vectors: res[i]=u[i]*v[i]
|
||||||
*
|
*
|
||||||
* @param s
|
* @param u
|
||||||
* @param v
|
* @param v
|
||||||
* @return
|
* @param res The result vector
|
||||||
*/
|
*/
|
||||||
public static void vvMultCw(double[] u, double[] v, double[] res) {
|
public static void vvMultCw(double[] u, double[] v, double[] res) {
|
||||||
for (int i = 0; i < res.length; i++) {
|
for (int i = 0; i < res.length; i++) {
|
||||||
@ -1366,7 +1357,7 @@ public final class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param a
|
* @param a
|
||||||
* @param b
|
* @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) {
|
public static void vvSub(double[] a, double[] b, double[] res) {
|
||||||
for (int i = 0; i < a.length; i++) {
|
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
|
* Returns a vector denoting a random point around the center - inside a
|
||||||
* hypersphere of uniform distribution if nonUnif=0, - inside a hypersphere
|
* hypersphere of uniform distribution if nonUnif=0, - inside a hypersphere
|
||||||
* of non-uniform distribution if nonUnif > 0, - inside a D-Gaussian if
|
* of non-uniform distribution if nonUnif > 0, - inside a D-Gaussian if
|
||||||
* nonUnif < 0. For case 2, the nonUnif parameter is used as standard
|
* 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
|
* 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
|
* 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
|
* @return the hyperbolic arc sine of the argument
|
||||||
*/
|
*/
|
||||||
static public double asinh(double xx) throws ArithmeticException {
|
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
|
* @return the factorial of the argument
|
||||||
*/
|
*/
|
||||||
static public int fac(int j) throws ArithmeticException {
|
static public int fac(int j) throws ArithmeticException {
|
||||||
@ -528,7 +528,6 @@ public final class SpecialFunction {
|
|||||||
* @param x a double value
|
* @param x a double value
|
||||||
* @return the Gamma function of the value.
|
* @return the Gamma function of the value.
|
||||||
* <p>
|
* <p>
|
||||||
* <FONT size=2>
|
|
||||||
* Converted to Java from<BR>
|
* Converted to Java from<BR>
|
||||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<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.
|
/* 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
|
Cephes Math Library Release 2.2: July, 1992
|
||||||
Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier
|
Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier
|
||||||
@ -663,7 +662,6 @@ public final class SpecialFunction {
|
|||||||
* @param x double value
|
* @param x double value
|
||||||
* @return the Complemented Incomplete Gamma function.
|
* @return the Complemented Incomplete Gamma function.
|
||||||
* <p>
|
* <p>
|
||||||
* <FONT size=2>
|
|
||||||
* Converted to Java from<BR>
|
* Converted to Java from<BR>
|
||||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||||
@ -738,7 +736,6 @@ public final class SpecialFunction {
|
|||||||
* @param x double value
|
* @param x double value
|
||||||
* @return the Incomplete Gamma function.
|
* @return the Incomplete Gamma function.
|
||||||
* <p>
|
* <p>
|
||||||
* <FONT size=2>
|
|
||||||
* Converted to Java from<BR>
|
* Converted to Java from<BR>
|
||||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR>
|
||||||
@ -894,7 +891,6 @@ public final class SpecialFunction {
|
|||||||
* @param a double value
|
* @param a double value
|
||||||
* @return The complementary Error function
|
* @return The complementary Error function
|
||||||
* <p>
|
* <p>
|
||||||
* <FONT size=2>
|
|
||||||
* Converted to Java from<BR>
|
* Converted to Java from<BR>
|
||||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<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
|
* @return The Error function
|
||||||
* <p>
|
* <p>
|
||||||
* <FONT size=2>
|
|
||||||
* Converted to Java from<BR>
|
* Converted to Java from<BR>
|
||||||
* Cephes Math Library Release 2.2: July, 1992<BR>
|
* Cephes Math Library Release 2.2: July, 1992<BR>
|
||||||
* Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<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
|
* @param xx double value
|
||||||
* @return The Incomplete Beta Function evaluated from zero to xx.
|
* @return The Incomplete Beta Function evaluated from zero to xx.
|
||||||
* <p>
|
* <p>
|
||||||
* <FONT size=2>
|
|
||||||
* Converted to Java from<BR>
|
* Converted to Java from<BR>
|
||||||
* Cephes Math Library Release 2.3: July, 1995<BR>
|
* Cephes Math Library Release 2.3: July, 1995<BR>
|
||||||
* Copyright 1984, 1995 by Stephen L. Moshier<BR>
|
* Copyright 1984, 1995 by Stephen L. Moshier<BR>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user