JavaDoc fixes and larger code cleanup.

This commit is contained in:
Fabian Becker 2014-11-11 16:58:43 +01:00
parent 7c896fea8d
commit 837c4fea32
69 changed files with 321 additions and 377 deletions

View File

@ -37,11 +37,11 @@ import java.util.BitSet;
import java.util.List; import java.util.List;
/** /**
* <p> The OptimizerFactory allows quickly creating some optimizers without * The OptimizerFactory allows quickly creating some optimizers without
* thinking much about parameters. You can access a runnable Optimization thread * thinking much about parameters. You can access a runnable Optimization thread
* and directly start it, or access its fully prepared OptimizationParameter instance, * and directly start it, or access its fully prepared OptimizationParameter instance,
* change some parameters, and start it then. * change some parameters, and start it then.
* </p> <p> * <p>
* On the other hand this * On the other hand this
* class provides an almost complete list of all currently available * class provides an almost complete list of all currently available
* optimization procedures in EvA2. The arguments passed to the methods * optimization procedures in EvA2. The arguments passed to the methods
@ -51,7 +51,7 @@ import java.util.List;
* 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> </p> * </code>
*/ */
public class OptimizerFactory { public class OptimizerFactory {

View File

@ -14,7 +14,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
/** /**
* @author becker * The About dialog used in the EvA2 GUI.
*/ */
class AboutDialog extends JDialog { class AboutDialog extends JDialog {
private JLabel imageLabel; private JLabel imageLabel;

View File

@ -28,8 +28,8 @@ class SplashScreen extends JWindow {
/** /**
* Show the splash screen to the end user. * Show the splash screen to the end user.
* <p/> * <p>
* <P>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</code> for the splash screen must be performed in the event

View File

@ -7,11 +7,11 @@ import javax.swing.*;
* SwingWorker 3), an abstract class that you subclass to * SwingWorker 3), an abstract class that you subclass to
* perform GUI-related work in a dedicated thread. For * perform GUI-related work in a dedicated thread. For
* instructions on using this class, see: * instructions on using this class, see:
* </p><p> * <p>
* http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html * http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
* or * or
* http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html * http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
* </p><p> * <p>
* Note that the API changed slightly in the 3rd version: * Note that the API changed slightly in the 3rd version:
* You must now invoke start() on the SwingWorker after * You must now invoke start() on the SwingWorker after
* creating it. * creating it.

View File

@ -299,7 +299,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** /**
* ******************************************************************************************************************* * *******************************************************************************************************************
* These are for InterfaceDataTypeBinary * These are for InterfaceDataTypeBinary
* <p/> * <p>
* /** This method allows you to request a certain amount of binary data * /** This method allows you to request a certain amount of binary data
* *
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized

View File

@ -192,7 +192,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** /**
* ******************************************************************************************************************* * *******************************************************************************************************************
* These are for InterfaceDataTypeDouble * These are for InterfaceDataTypeDouble
* <p/> * <p>
* /** This method allows you to request a certain amount of double data * /** This method allows you to request a certain amount of double data
* *
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized

View File

@ -196,7 +196,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** /**
* ******************************************************************************************************************* * *******************************************************************************************************************
* These are for InterfaceDataTypeInteger * These are for InterfaceDataTypeInteger
* <p/> * <p>
* /** This method allows you to request a certain amount of int data * /** This method allows you to request a certain amount of int data
* *
* @param length The lenght of the int[] that is to be optimized * @param length The lenght of the int[] that is to be optimized

View File

@ -3,13 +3,6 @@ package eva2.optimization.individuals;
/** /**
* This interface gives access to a permutation genotype and should * This interface gives access to a permutation genotype and should
* only be used by mutation and crossover operators. * only be used by mutation and crossover operators.
* <p>Title: EvA2</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
*
* @author planatsc
* @version 1.0
*/ */
public interface InterfaceOBGAIndividual { public interface InterfaceOBGAIndividual {

View File

@ -131,10 +131,8 @@ public class GAStandardCodingDouble implements InterfaceGADoubleCoding, java.io.
/** /**
* A eva2.problems.simple test function without arguments * A eva2.problems.simple test function without arguments
*
* @param args
*/ */
public static void main(String[] args) { public static void main() {
GAStandardCodingDouble t = new GAStandardCodingDouble(); GAStandardCodingDouble t = new GAStandardCodingDouble();
String test = "01100010001000110010000011111101"; String test = "01100010001000110010000011111101";
//String test = "11000000000000000000000000000000"; //String test = "11000000000000000000000000000000";

View File

@ -19,7 +19,7 @@ import java.util.logging.Level;
/** /**
* OptimizationParameters for configuration of an * OptimizationParameters for configuration of an
* optimization run. * optimization run.
* </p><p> * <p>
* This class is used to generate the default GUI * This class is used to generate the default GUI
* configuration panel for optimizations. * configuration panel for optimizations.
*/ */

View File

@ -33,7 +33,7 @@ import java.util.logging.Logger;
/** /**
* The Processor may run as a thread permanently (GenericModuleAdapter) and is * The Processor may run as a thread permanently (GenericModuleAdapter) and is
* then stopped and started by a switch in startOptimization/stopOptimization. * then stopped and started by a switch in startOptimization/stopOptimization.
* <p/> * <p>
* Processor also handles adaptive parameter control by checking for the method * Processor also handles adaptive parameter control by checking for the method
* getParamControl in (so far) Optimizer and Problem instances. The return-value * getParamControl in (so far) Optimizer and Problem instances. The return-value
* may be InterfaceParameterControl or an array of Objects. If it is a control * may be InterfaceParameterControl or an array of Objects. If it is a control

View File

@ -18,7 +18,7 @@ import java.util.Vector;
/** /**
* Hierarchical clustering after Preuss et al., "Counteracting Genetic Drift and Disruptive Recombination * Hierarchical clustering after Preuss et al., "Counteracting Genetic Drift and Disruptive Recombination
* in (mu+,lambda)-EA on Multimodal Fitness Landscapes", GECCO '05. * in (mu+,lambda)-EA on Multimodal Fitness Landscapes", GECCO '05.
* <p/> * <p>
* A tree is produced by assigning each individual the closest individual with better fitness. * A tree is produced by assigning each individual the closest individual with better fitness.
* Connections with a distance above a certain threshold are cut. After that, each interconnected subtree forms a cluster. * Connections with a distance above a certain threshold are cut. After that, each interconnected subtree forms a cluster.
* In the paper, the threshold is deduced as 2*d_p for d_p: the mean distance in the population. * In the paper, the threshold is deduced as 2*d_p for d_p: the mean distance in the population.

View File

@ -7,6 +7,7 @@ import eva2.problems.AbstractProblemDouble;
import eva2.tools.EVAERROR; import eva2.tools.EVAERROR;
import java.io.Serializable; import java.io.Serializable;
import java.util.logging.Logger;
/** /**
* An abstract constraint contains a penalty factor with control strategy (for dynamic penalties) * An abstract constraint contains a penalty factor with control strategy (for dynamic penalties)
@ -15,7 +16,7 @@ import java.io.Serializable;
* @author mkron * @author mkron
*/ */
public abstract class AbstractConstraint implements InterfaceDoubleConstraint, Serializable { public abstract class AbstractConstraint implements InterfaceDoubleConstraint, Serializable {
// private transient GPFunctionProblem func = null; private static final Logger LOGGER = Logger.getLogger(AbstractConstraint.class.getName());
protected ConstraintRelationEnum relation = ConstraintRelationEnum.lessEqZero; protected ConstraintRelationEnum relation = ConstraintRelationEnum.lessEqZero;
protected ConstraintHandlingEnum handling = ConstraintHandlingEnum.specificTag; protected ConstraintHandlingEnum handling = ConstraintHandlingEnum.specificTag;
@ -104,7 +105,7 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S
* Some constraints require further information on the individual or work on the * Some constraints require further information on the individual or work on the
* raw fitness which can be requested using this method. * raw fitness which can be requested using this method.
* *
* @return * @return The individuals raw fitness
*/ */
protected double[] getIndyRawFit(String key) { protected double[] getIndyRawFit(String key) {
return getIndyDblData(AbstractProblemDouble.rawFitKey); return getIndyDblData(AbstractProblemDouble.rawFitKey);
@ -115,7 +116,8 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S
* additional individual data. This method uses getData of AbstractEAIndividual * additional individual data. This method uses getData of AbstractEAIndividual
* to try to retrieve a double array. * to try to retrieve a double array.
* *
* @return * @param key The key used for the data
* @return A specific double array identified by key
*/ */
protected double[] getIndyDblData(String key) { protected double[] getIndyDblData(String key) {
if (currentIndy != null) { if (currentIndy != null) {
@ -123,11 +125,11 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S
if (dat != null && (dat instanceof double[])) { if (dat != null && (dat instanceof double[])) {
return (double[]) dat; return (double[]) dat;
} else { } else {
System.err.println("Error, invalid call to AbstractConstraint.getRawFitness(). Individual had no raw fitness set."); LOGGER.finest("Error, invalid call to AbstractConstraint.getRawFitness(). Individual had no raw fitness set.");
return null; return null;
} }
} else { } else {
System.err.println("Error, invalid call to AbstractConstraint.getRawFitness(). Individual was unknown."); LOGGER.finest("Error, invalid call to AbstractConstraint.getRawFitness(). Individual was unknown.");
return null; return null;
} }
} }
@ -137,22 +139,20 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S
* additional individual data. This method uses getData of AbstractEAIndividual * additional individual data. This method uses getData of AbstractEAIndividual
* to try to retrieve a stored object. * to try to retrieve a stored object.
* *
* @return * @return An object identified by the key
*/ */
protected Object getIndyData(String key) { protected Object getIndyData(String key) {
if (currentIndy != null) { if (currentIndy != null) {
return currentIndy.getData(key); return currentIndy.getData(key);
} else { } else {
System.err.println("Error, invalid call to AbstractConstraint.getRawFitness(). Individual was unknown."); LOGGER.finest("Error, invalid call to AbstractConstraint.getRawFitness(). Individual was unknown.");
return null; return null;
} }
} }
private double getViolationConsideringRelation(double val) { private double getViolationConsideringRelation(double val) {
// System.out.println("Penalty is " + penaltyFactor);
val *= penaltyFactor; val *= penaltyFactor;
switch (relation) { switch (relation) {
// case linearLessEqZero:
case lessEqZero: case lessEqZero:
return (val <= 0.) ? 0 : val; return (val <= 0.) ? 0 : val;
case eqZero: case eqZero:

View File

@ -12,7 +12,7 @@ import eva2.util.annotation.Description;
* The flat crossover inits values randomly within the extreme values of * The flat crossover inits values randomly within the extreme values of
* all parents, namely * all parents, namely
* c[i]=rand(min_j(p_ij), max_j(p_ij)). * c[i]=rand(min_j(p_ij), max_j(p_ij)).
* </p><p> * <p>
* where c[i] is the i-th child component and p_ij is the i-th component * where c[i] is the i-th child component and p_ij is the i-th component
* of parent j. * of parent j.
*/ */

View File

@ -240,13 +240,10 @@ public class TestESCrossover implements java.io.Serializable {
/** /**
* This method will test the crossover operator * This method will test the crossover operator
*
* @param args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
TestESCrossover t = new TestESCrossover(); TestESCrossover t = new TestESCrossover();
t.initFrame(); t.initFrame();
} }
public void setCrossover(InterfaceCrossover NumberOfCrossovers) { public void setCrossover(InterfaceCrossover NumberOfCrossovers) {

View File

@ -10,7 +10,7 @@ import java.io.Serializable;
/** /**
* Calculate the euclidean difference between discrete integrals, which is * Calculate the euclidean difference between discrete integrals, which is
* d(x,y)=sqrt(sum_i=1^n(((sum_j=1^i(x_j))-(sum_j=1^i(y_j)))^2)). * d(x,y)=sqrt(sum_i=1^n(((sum_j=1^i(x_j))-(sum_j=1^i(y_j)))^2)).
* <p/> * <p>
* This can be used with any individual type that implements getDoublePositionShallow. * This can be used with any individual type that implements getDoublePositionShallow.
* *
* @see AbstractEAIndividual#getDoublePositionShallow(AbstractEAIndividual) * @see AbstractEAIndividual#getDoublePositionShallow(AbstractEAIndividual)

View File

@ -5,6 +5,7 @@ import eva2.optimization.operator.distancemetric.InterfaceDistanceMetric;
import eva2.optimization.operator.distancemetric.PhenotypeMetric; import eva2.optimization.operator.distancemetric.PhenotypeMetric;
import eva2.optimization.population.Population; import eva2.optimization.population.Population;
import eva2.util.annotation.Description; import eva2.util.annotation.Description;
import eva2.util.annotation.Parameter;
/** /**
* The fitness modifier are defunct and are to be moved to * The fitness modifier are defunct and are to be moved to
@ -69,34 +70,28 @@ public class FitnessSharing implements java.io.Serializable, InterfaceFitnessMod
/** /**
* These methods allows you to set/get the Sharing Distance * These methods allows you to set/get the Sharing Distance
* *
* @param SharingDistance * @param sharingDistance The sharing distance
*/ */
public void setSharingDistance(double SharingDistance) { @Parameter(description = "The threshold for the similarity penalty.")
this.sharingDistance = SharingDistance; public void setSharingDistance(double sharingDistance) {
this.sharingDistance = sharingDistance;
} }
public double getSharingDistance() { public double getSharingDistance() {
return this.sharingDistance; return this.sharingDistance;
} }
public String sharingDistanceTipText() {
return "The threshold for the similarity penalty.";
}
/** /**
* These methods allows you to set/get the type of Distance Metric. * These methods allows you to set/get the type of Distance Metric.
* *
* @param Metric * @param metric The distance metric to use
*/ */
public void setMetric(InterfaceDistanceMetric Metric) { @Parameter(name = "metric", description = "The distance metric used. Note: This depends on the type of EAIndividual used!")
this.distanceMetric = Metric; public void setMetric(InterfaceDistanceMetric metric) {
this.distanceMetric = metric;
} }
public InterfaceDistanceMetric getMetric() { public InterfaceDistanceMetric getMetric() {
return this.distanceMetric; return this.distanceMetric;
} }
public String metricTipText() {
return "The distance metric used. Note: This depends on the type of EAIndividual used!";
}
} }

View File

@ -19,7 +19,7 @@ import java.util.BitSet;
* integer individuals, it allows to control the number of occurrences of a certain integer * integer individuals, it allows to control the number of occurrences of a certain integer
* per segment. It may also be used to initialize with subsets of integers (by setting 0 * per segment. It may also be used to initialize with subsets of integers (by setting 0
* 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> * <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.

View File

@ -16,7 +16,7 @@ import java.util.ArrayList;
* updates the velocity by rotation and scaling, and then mutates the individual * updates the velocity by rotation and scaling, and then mutates the individual
* by adding the velocity. This was used for a particle filter localization problem * by adding the velocity. This was used for a particle filter localization problem
* and is less useful in general. * and is less useful in general.
* </p><p> * <p>
* Rotation vectors are normal distributed with mean zero, scaling factors are * Rotation vectors are normal distributed with mean zero, scaling factors are
* log-normally distributed around mean 1. This means that the averaged expected change * log-normally distributed around mean 1. This means that the averaged expected change
* of the mutation vector is zero. The smaller the deviations, the higher the correlations * of the mutation vector is zero. The smaller the deviations, the higher the correlations

View File

@ -24,7 +24,7 @@ import java.io.Serializable;
* - 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.
* This of course requires proper handling of the generational cycle, i.e., new generations should be cloned from * This of course requires proper handling of the generational cycle, i.e., new generations should be cloned from

View File

@ -10,7 +10,7 @@ import eva2.util.annotation.Description;
/** /**
* <p/> * <p>
* Mutates a permutation by inversion a part of the permutation. * Mutates a permutation by inversion a part of the permutation.
* <br><br> * <br><br>
* <b>Example: </b> * <b>Example: </b>

View File

@ -12,11 +12,8 @@ public class ConsiderPBestAbsorptionStrategy extends StandardAbsorptionStrategy
/** /**
* @tested true if * True if the subswarm is active and the particle lies in the radius of the subswarm and
* the subswarm is active and
* the particle lies in the radius of the subswarm and
* the particles pbest is not better than the subswarms gbest (this would "pull the subswarm away") * the particles pbest is not better than the subswarms gbest (this would "pull the subswarm away")
* (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) {
@ -30,7 +27,6 @@ public class ConsiderPBestAbsorptionStrategy extends StandardAbsorptionStrategy
* @param indy * @param indy
* @param subswarm * @param subswarm
* @return * @return
* @tested
*/ */
private boolean absorbtionConstraintViolation(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm) { private boolean absorbtionConstraintViolation(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm) {
AbstractEAIndividual indysPBest = (AbstractEAIndividual) indy.getData("PersonalBestKey"); AbstractEAIndividual indysPBest = (AbstractEAIndividual) indy.getData("PersonalBestKey");

View File

@ -19,20 +19,9 @@ public class GenerateNeighborSubswarmCreationStrategy extends
private double mu = 0.1; private double mu = 0.1;
/**********************************************************************************************************************
* shouldCreateSubswarm
*/
// same as in StandardSubswarmCreationStrategy
/**********************************************************************************************************************
* createSubswarm
*/
/** /**
* @tested creates a subswarm from the given particle and its neighbor in the mainswarm. * @tested 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.
* (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.StandardSubswarmCreationStrategy#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) {

View File

@ -8,7 +8,7 @@ import eva2.optimization.population.Population;
* the first one to retrieve an array of strings with the canonical names of the controlled parameters, * the first one to retrieve an array of strings with the canonical names of the controlled parameters,
* and the second one to produce an object array of the same length with the values to be assigned * and the second one to produce an object array of the same length with the values to be assigned
* at the iteration. If there is no iteration known, iteration counts will be set to -1. * at the iteration. If there is no iteration known, iteration counts will be set to -1.
* <p/> * <p>
* This class can be used to implement strategies to adapt multiple parameters within one strategy. * This class can be used to implement strategies to adapt multiple parameters within one strategy.
* For single parameter adaption, better use the ParamAdaption inheritance tree and the ParameterControlManager class. * For single parameter adaption, better use the ParamAdaption inheritance tree and the ParameterControlManager class.
* *

View File

@ -15,7 +15,7 @@ import java.util.LinkedList;
* if it was always infeasible, the penalty factor is increased. For other cases, the penalty remains the same. * if it was always infeasible, the penalty factor is increased. For other cases, the penalty remains the same.
* This is plausible for the typical case that the optimum lies near the constraint boundary, however it makes * This is plausible for the typical case that the optimum lies near the constraint boundary, however it makes
* the fitness function change dynamically based only on the positions of last best indidivuals. * the fitness function change dynamically based only on the positions of last best indidivuals.
* </p><p> * <p>
* The authors advise to select betaInc != 1./betaDec to avoid cycling. * The authors advise to select betaInc != 1./betaDec to avoid cycling.
*/ */
@Description("Adapt a constraint's penalty factor (esp. fitness based) if the population contained only valid or only invalid individuals for some generations.") @Description("Adapt a constraint's penalty factor (esp. fitness based) if the population contained only valid or only invalid individuals for some generations.")

View File

@ -8,7 +8,7 @@ import eva2.optimization.population.Population;
* an update is triggered after every optimize call. This allows parameters of the object to be * an update is triggered after every optimize call. This allows parameters of the object to be
* adapted dynamically, such as linearly decreasing weights or control parameters. In case of PSO, * adapted dynamically, such as linearly decreasing weights or control parameters. In case of PSO,
* this may be the linearly decreasing inertia weight or the activation feedback control mechanism. * this may be the linearly decreasing inertia weight or the activation feedback control mechanism.
* <p/> * <p>
* Notice how Processor handles parameter control. For now, a controlled object must implement * Notice how Processor handles parameter control. For now, a controlled object must implement
* the method getParamControl() which is to return either an InterfaceParameterControl or an array * the method getParamControl() which is to return either an InterfaceParameterControl or an array
* of Objects which should either be instances of InterfaceParameterControl or * of Objects which should either be instances of InterfaceParameterControl or
@ -22,7 +22,7 @@ public interface InterfaceParameterControl {
/** /**
* Make a deep copy of the object. * Make a deep copy of the object.
* *
* @return * @return Deep copy
*/ */
public Object clone(); public Object clone();
@ -43,9 +43,10 @@ public interface InterfaceParameterControl {
/** /**
* For a given runtime (maxIteration) and current iteration, update the parameters of the object. * For a given runtime (maxIteration) and current iteration, update the parameters of the object.
* *
* @param obj * @param obj Object
* @param iteration * @param pop Population
* @param maxIteration * @param iteration Iteration
* @param maxIteration Maximum Iteration
*/ */
public void updateParameters(Object obj, Population pop, int iteration, int maxIteration); public void updateParameters(Object obj, Population pop, int iteration, int maxIteration);
@ -53,7 +54,7 @@ public interface InterfaceParameterControl {
* If no runtime in terms of iterations can be specified, the parameter control may try to infer * If no runtime in terms of iterations can be specified, the parameter control may try to infer
* the state from the object itself. * the state from the object itself.
* *
* @param obj * @param obj Object
*/ */
public void updateParameters(Object obj); public void updateParameters(Object obj);
} }

View File

@ -13,7 +13,7 @@ import java.io.Serializable;
* here is simply the average relative velocity of the particles. * here is simply the average relative velocity of the particles.
* The target activity decreases with time, and if the current activity is too low (high), the * The target activity decreases with time, and if the current activity is too low (high), the
* inertia is increased (decreased) so that the activity approximates the target activity. * inertia is increased (decreased) so that the activity approximates the target activity.
* <p/> * <p>
* The original authors used an absolute velocity measure and FIPS which is not implemented in EvA2 so far. * The original authors used an absolute velocity measure and FIPS which is not implemented in EvA2 so far.
* However, after some initial tests, this version seems * However, after some initial tests, this version seems
* to work ok, although it depends on the defined target activity. I am not convinced that in general it is * to work ok, although it depends on the defined target activity. I am not convinced that in general it is

View File

@ -641,7 +641,7 @@ public class PostProcess {
* At the moment, the function calls are distributed evenly between all candidate solutions. This could be * At the moment, the function calls are distributed evenly between all candidate solutions. This could be
* improved by checking the convergence state in the future. The given terminator will be applied to each * improved by checking the convergence state in the future. The given terminator will be applied to each
* candidate sub-population anew. If the terminator is null, 10*n steps will be performed on each candidate. * candidate sub-population anew. If the terminator is null, 10*n steps will be performed on each candidate.
* <p/> * <p>
* A double value is added to each solution individual that replaces its ancestor candidate, using the key * A double value is added to each solution individual that replaces its ancestor candidate, using the key
* PostProcess.movedDistanceKey. * PostProcess.movedDistanceKey.
* It indicates the phenotype distance the found solution has moved relatively to the original candidate. * It indicates the phenotype distance the found solution has moved relatively to the original candidate.
@ -1123,7 +1123,7 @@ public class PostProcess {
* epsilon[k] and discarded. The number of solutions * epsilon[k] and discarded. The number of solutions
* which are accurate by epsilon[k] are returned in the integer array. Optionally, the refined solutions * which are accurate by epsilon[k] are returned in the integer array. Optionally, the refined solutions
* are added to an array of histograms. * are added to an array of histograms.
* <p/> * <p>
* For refining, either known optima are used or {@link AbstractOptimizationProblem}.extractPotentialOptima() * For refining, either known optima are used or {@link AbstractOptimizationProblem}.extractPotentialOptima()
* is called. * is called.
* *

View File

@ -5,7 +5,7 @@ import eva2.util.annotation.Description;
/** /**
* A eva2.problems.simple sum to calculate the selection probability. * A eva2.problems.simple sum to calculate the selection probability.
* <p/> * <p>
* p(i is selected) = exp(-fitness(i))/sum_j(exp(-fitness(j))) * p(i is selected) = exp(-fitness(i))/sum_j(exp(-fitness(j)))
*/ */
@Description("This is a standard normation method using the exp function.") @Description("This is a standard normation method using the exp function.")

View File

@ -26,17 +26,17 @@ import java.util.*;
* updated per iteration in createNextGenerationPerformed and reported to listeners in stopOptimizationPerformed. * updated per iteration in createNextGenerationPerformed and reported to listeners in stopOptimizationPerformed.
* Several different verbosity levels are regarded. * Several different verbosity levels are regarded.
* The method plotCurrentResults should be implemented to plot further results per iteration. * The method plotCurrentResults should be implemented to plot further results per iteration.
* <p/> * <p>
* All displayable data is now routed through a single pipeline, which consists in a * All displayable data is now routed through a single pipeline, which consists in a
* list of Objects assembled in the getOutputValues method. This allows all eva2.problems.simple data types which are * list of Objects assembled in the getOutputValues method. This allows all eva2.problems.simple data types which are
* provided by the external informer instances to be handled uniformly to the internally collected data, and * provided by the external informer instances to be handled uniformly to the internally collected data, and
* thus they can be plotted and text-dumped in the same manner. * thus they can be plotted and text-dumped in the same manner.
* Basic fields are identified by the enum GraphSelectionEnum and are available independently of additional * Basic fields are identified by the enum GraphSelectionEnum and are available independently of additional
* informer instances. * informer instances.
* <p/> * <p>
* Depending on the field selection state and the informers, the list of data fields is dynamically altered, * Depending on the field selection state and the informers, the list of data fields is dynamically altered,
* however changes during a multi-run are ignored, since the potential of inconsistencies is too high. * however changes during a multi-run are ignored, since the potential of inconsistencies is too high.
* <p/> * <p>
* Listeners implementing InterfaceTextListener receive String output (human readable). * Listeners implementing InterfaceTextListener receive String output (human readable).
* Listeners implementing InterfaceStatisticsListener receive the raw data per iteration. * Listeners implementing InterfaceStatisticsListener receive the raw data per iteration.
*/ */

View File

@ -5,16 +5,17 @@ import eva2.tools.StringSelection;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.logging.Logger;
/** /**
* An OptimizationJob is a set of optimization parameters and potential results from the statistics class. * An OptimizationJob is a set of optimization parameters and potential results from the statistics class.
* Each job has a unique ID and may have been completely finished or not. Once finished, the * Each job has a unique ID and may have been completely finished or not. Once finished, the
* framework should guarantee that the job is removed as a statistics listener. * framework should guarantee that the job is removed as a statistics listener.
* <p/> * <p>
* A job contains data fields of a multi-run experiment and header strings describing the data. * A job contains data fields of a multi-run experiment and header strings describing the data.
*/ */
public class OptimizationJob implements Serializable, InterfaceStatisticsListener { public class OptimizationJob implements Serializable, InterfaceStatisticsListener {
private static final Logger LOGGER = Logger.getLogger(OptimizationJob.class.getName());
private InterfaceOptimizationParameters params = null; private InterfaceOptimizationParameters params = null;
private String[] fieldHeaders = null; private String[] fieldHeaders = null;
private List<Object[]> multiRunFinalObjectData = null; private List<Object[]> multiRunFinalObjectData = null;
@ -52,20 +53,16 @@ public class OptimizationJob implements Serializable, InterfaceStatisticsListene
multiRunFinalObjectData = null; multiRunFinalObjectData = null;
} }
public InterfaceOptimizationParameters getParams() {
return params;
}
/** /**
* Set the GO parameters for this instance. * Set the optimization parameters for this instance.
* *
* @param params * @param params An instance of OptimizationParameters
*/ */
public void setParams(InterfaceOptimizationParameters params) { public void setOptimizationParameters(InterfaceOptimizationParameters params) {
// how should this be treated? In case the run is already finished, changing // how should this be treated? In case the run is already finished, changing
// the parameters will be evil, so avoid that case. // the parameters will be evil, so avoid that case.
if (state == StateEnum.complete) { if (state == StateEnum.complete) {
System.err.println("Warning, ignoring changed parameters for finished job!"); LOGGER.warning("Ignoring changed parameters for finished job!");
} else { } else {
this.params = params; this.params = params;
} }
@ -166,8 +163,8 @@ public class OptimizationJob implements Serializable, InterfaceStatisticsListene
* Retrieve the index of a data field within the data lines. * Retrieve the index of a data field within the data lines.
* Returns -1 if the field has not been found. * Returns -1 if the field has not been found.
* *
* @param field * @param field Field name
* @return * @return The index of the field
*/ */
public int getFieldIndex(String field) { public int getFieldIndex(String field) {
if (fieldHeaders != null) { if (fieldHeaders != null) {
@ -222,8 +219,8 @@ public class OptimizationJob implements Serializable, InterfaceStatisticsListene
* Retrieve a single column of data indicated by a field name. If the field is unknown * Retrieve a single column of data indicated by a field name. If the field is unknown
* or there is no data, null is returned. * or there is no data, null is returned.
* *
* @param field * @param field Field name
* @return * @return An array of objects from the field provided
*/ */
public Object[] getDataColumn(String field) { public Object[] getDataColumn(String field) {
int index = getFieldIndex(field); int index = getFieldIndex(field);
@ -247,7 +244,7 @@ public class OptimizationJob implements Serializable, InterfaceStatisticsListene
curSelection.setSelected(field, true); curSelection.setSelected(field, true);
} }
} else { } else {
System.err.println("Warning, empty field selection in job " + this); LOGGER.warning("Empty field selection in job " + this);
} }
return newSel; return newSel;
} }

View File

@ -45,8 +45,8 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
/** /**
* This adds a new job to the list. * This adds a new job to the list.
* *
* @param params * @param params Optimization parameters
* @param stats * @param stats Statistics instance
*/ */
public OptimizationJob addJob(InterfaceOptimizationParameters params, AbstractStatistics stats) { public OptimizationJob addJob(InterfaceOptimizationParameters params, AbstractStatistics stats) {
OptimizationJob job = new OptimizationJob((InterfaceOptimizationParameters) Serializer.deepClone(params), stats); OptimizationJob job = new OptimizationJob((InterfaceOptimizationParameters) Serializer.deepClone(params), stats);
@ -76,7 +76,7 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
/** /**
* Return the last job in the list, which is also the last one added. * Return the last job in the list, which is also the last one added.
* *
* @return * @return The last job added
*/ */
public OptimizationJob lastJob() { public OptimizationJob lastJob() {
OptimizationJob[] curArr = getObjects(); OptimizationJob[] curArr = getObjects();
@ -90,7 +90,7 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
/** /**
* Return a list of the currently selected jobs. * Return a list of the currently selected jobs.
* *
* @return * @return A List of selected jobs
*/ */
public ArrayList<OptimizationJob> getSelectedJobs() { public ArrayList<OptimizationJob> getSelectedJobs() {
OptimizationJob[] selected = getSelectedObjects(); OptimizationJob[] selected = getSelectedObjects();

View File

@ -50,7 +50,7 @@ public class StatisticalEvaluation {
} }
textout.println(""); textout.println("");
for (int i = 0; i < jobsToWorkWith.size(); i++) { for (int i = 0; i < jobsToWorkWith.size(); i++) {
textout.print(jobsToWorkWith.get(i).getParams().getOptimizer().getName()); textout.print(jobsToWorkWith.get(i).getOptimizationParameters().getOptimizer().getName());
for (int j = 0; j < singleStats.length; j++) { for (int j = 0; j < singleStats.length; j++) {
switch (singleStats[j]) { switch (singleStats[j]) {
case mean: case mean:
@ -115,7 +115,7 @@ public class StatisticalEvaluation {
InterfaceTextListener textout, ArrayList<OptimizationJob> jobsToWorkWith, InterfaceTextListener textout, ArrayList<OptimizationJob> jobsToWorkWith,
String field) { String field) {
for (int i = 0; i < jobsToWorkWith.size(); i++) { for (int i = 0; i < jobsToWorkWith.size(); i++) {
textout.print(jobsToWorkWith.get(i).getParams().getOptimizer().getName()); textout.print(jobsToWorkWith.get(i).getOptimizationParameters().getOptimizer().getName());
for (int j = 0; j < jobsToWorkWith.size(); j++) { for (int j = 0; j < jobsToWorkWith.size(); j++) {
textout.print("\t" + calculateTTestUnEqSizeUnEqVar(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j))); textout.print("\t" + calculateTTestUnEqSizeUnEqVar(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j)));
} }
@ -131,7 +131,7 @@ public class StatisticalEvaluation {
private static void writeUnEqSizeEqVar(InterfaceTextListener textout, private static void writeUnEqSizeEqVar(InterfaceTextListener textout,
ArrayList<OptimizationJob> jobsToWorkWith, String field) { ArrayList<OptimizationJob> jobsToWorkWith, String field) {
for (int i = 0; i < jobsToWorkWith.size(); i++) { for (int i = 0; i < jobsToWorkWith.size(); i++) {
textout.print(jobsToWorkWith.get(i).getParams().getOptimizer().getName()); textout.print(jobsToWorkWith.get(i).getOptimizationParameters().getOptimizer().getName());
for (int j = 0; j < jobsToWorkWith.size(); j++) { for (int j = 0; j < jobsToWorkWith.size(); j++) {
textout.print("\t" + calculateTTestUnEqSizeEqVar(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j))); textout.print("\t" + calculateTTestUnEqSizeEqVar(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j)));
} }
@ -147,7 +147,7 @@ public class StatisticalEvaluation {
private static void writeTTestEqSizeEqVar(InterfaceTextListener textout, private static void writeTTestEqSizeEqVar(InterfaceTextListener textout,
ArrayList<OptimizationJob> jobsToWorkWith, String field) { ArrayList<OptimizationJob> jobsToWorkWith, String field) {
for (int i = 0; i < jobsToWorkWith.size(); i++) { for (int i = 0; i < jobsToWorkWith.size(); i++) {
textout.print(jobsToWorkWith.get(i).getParams().getOptimizer().getName()); textout.print(jobsToWorkWith.get(i).getOptimizationParameters().getOptimizer().getName());
for (int j = 0; j < jobsToWorkWith.size(); j++) { for (int j = 0; j < jobsToWorkWith.size(); j++) {
textout.print("\t" + calculateTTestEqSizeEqVar(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j))); textout.print("\t" + calculateTTestEqSizeEqVar(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j)));
} }
@ -157,7 +157,7 @@ public class StatisticalEvaluation {
private static void writeMannWhitney(InterfaceTextListener textout, ArrayList<OptimizationJob> jobsToWorkWith, String field) { private static void writeMannWhitney(InterfaceTextListener textout, ArrayList<OptimizationJob> jobsToWorkWith, String field) {
for (int i = 0; i < jobsToWorkWith.size(); i++) { for (int i = 0; i < jobsToWorkWith.size(); i++) {
textout.print(jobsToWorkWith.get(i).getParams().getOptimizer().getName()); textout.print(jobsToWorkWith.get(i).getOptimizationParameters().getOptimizer().getName());
for (int j = 0; j < jobsToWorkWith.size(); j++) { for (int j = 0; j < jobsToWorkWith.size(); j++) {
textout.print("\t" + calculateMannWhitney(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j))); textout.print("\t" + calculateMannWhitney(field, jobsToWorkWith.get(i), jobsToWorkWith.get(j)));
} }
@ -172,7 +172,7 @@ public class StatisticalEvaluation {
private static void writeTwoSampleFirstLine(InterfaceTextListener textout, private static void writeTwoSampleFirstLine(InterfaceTextListener textout,
ArrayList<OptimizationJob> jobsToWorkWith) { ArrayList<OptimizationJob> jobsToWorkWith) {
for (int i = 0; i < jobsToWorkWith.size(); i++) { for (int i = 0; i < jobsToWorkWith.size(); i++) {
textout.print("\t" + jobsToWorkWith.get(i).getParams().getOptimizer().getName()); textout.print("\t" + jobsToWorkWith.get(i).getOptimizationParameters().getOptimizer().getName());
} }
textout.println(""); textout.println("");
} }

View File

@ -41,7 +41,7 @@ import java.util.Vector;
* perfom a local search on its own. This results in a high exploration ability of the main swarm and * perfom a local search on its own. This results in a high exploration ability of the main swarm and
* potentially leads to a good amount of identified optima. * potentially leads to a good amount of identified optima.
* Larger values for mainSwarmPhi2 on the other hand might help to concentrate on fewer optima with superior fitness values. * Larger values for mainSwarmPhi2 on the other hand might help to concentrate on fewer optima with superior fitness values.
* <p/> * <p>
* To avoid further parameters and the need to specify adequate values, which are often difficult to decide, * To avoid further parameters and the need to specify adequate values, which are often difficult to decide,
* the following adaption mechanism is employed: * the following adaption mechanism is employed:
* ANPSO adaptively determines a threshold parameter r during every generation by computing the average * ANPSO adaptively determines a threshold parameter r during every generation by computing the average
@ -53,7 +53,7 @@ import java.util.Vector;
* The implemented version uses a strategy to deactivate subswarms when all containing particles converged on a solution. * The implemented version uses a strategy to deactivate subswarms when all containing particles converged on a solution.
* Furthermore, different neighborhood topologies can be choosen for the main swarm. * Furthermore, different neighborhood topologies can be choosen for the main swarm.
* In case the Multi-Swarm topology is used, the species radius is adaptively determined as well. * In case the Multi-Swarm topology is used, the species radius is adaptively determined as well.
* <p/> * <p>
* [1] S. Bird and X. Li: * [1] S. Bird and X. Li:
* Adaptively choosing niching parameters in a PSO. * Adaptively choosing niching parameters in a PSO.
* In: GECCO '06: Proceedings of the 8th annual conference on Genetic and evolutionary computation, * In: GECCO '06: Proceedings of the 8th annual conference on Genetic and evolutionary computation,

View File

@ -27,7 +27,7 @@ import java.util.logging.Logger;
/** /**
* Basic implementation of the Bayesian Optimization Algorithm * Basic implementation of the Bayesian Optimization Algorithm
* <p/> * <p>
* Martin Pelikan, David E. Goldberg and Erick Cantu-Paz: 'BOA: The Bayesian * Martin Pelikan, David E. Goldberg and Erick Cantu-Paz: 'BOA: The Bayesian
* Optimization Algorithm' the works by Martin Pelikan and David E. Goldberg. * Optimization Algorithm' the works by Martin Pelikan and David E. Goldberg.
* Genetic and Evolutionary Computation Conference (GECCO-99), pp. 525-532 * Genetic and Evolutionary Computation Conference (GECCO-99), pp. 525-532

View File

@ -22,7 +22,7 @@ import java.util.BitSet;
/** /**
* A BinaryScatterSearch implementation taken mainly from [i]. * A BinaryScatterSearch implementation taken mainly from [i].
* *
* <p/> * <p>
* F. Gortazar, A. Duarte, M. Laguna and R. Marti: Black Box Scatter Search for * F. Gortazar, A. Duarte, M. Laguna and R. Marti: Black Box Scatter Search for
* General Classes of Binary Optimization Problems Computers and Operations * General Classes of Binary Optimization Problems Computers and Operations
* research, vol. 37, no. 11, pp. 1977-1986 (2010) * research, vol. 37, no. 11, pp. 1977-1986 (2010)

View File

@ -34,12 +34,12 @@ import java.util.*;
/** /**
* The infamous clustering based niching EA, still under construction. It should * The infamous clustering based niching EA, still under construction. It should
* be able to identify and track multiple global/local optima at the same time. * be able to identify and track multiple global/local optima at the same time.
* <p/> * <p>
* Notes: For std. GA, the mutation rate may have to reduced, because the * Notes: For std. GA, the mutation rate may have to reduced, because the
* initial step size tends to be rel. large and easily disperse clustered * initial step size tends to be rel. large and easily disperse clustered
* species (so that they fall below the minimum swarm size and the local optimum * species (so that they fall below the minimum swarm size and the local optimum
* is lost). * is lost).
* <p/> * <p>
* For the CBN-PSO remember to use the IndividualDataMetric so that the * For the CBN-PSO remember to use the IndividualDataMetric so that the
* remembered positions are used for clustering (which are rel. stable - so that * remembered positions are used for clustering (which are rel. stable - so that
* species clustering actually makes sense). * species clustering actually makes sense).
@ -1179,7 +1179,7 @@ public class ClusterBasedNichingEA extends AbstractOptimizer implements Interfac
* Calculate the clustering parameter in such a way that about one q-th part * Calculate the clustering parameter in such a way that about one q-th part
* of the range of the given problem is within one hyper sphere of the * of the range of the given problem is within one hyper sphere of the
* clustering parameter. * clustering parameter.
* <p/> * <p>
* For certain types of parameter adaption schemes, this automatically sets * For certain types of parameter adaption schemes, this automatically sets
* the upper limit if the clustering parameter is controlled. * the upper limit if the clustering parameter is controlled.
* *

View File

@ -25,7 +25,7 @@ import java.io.Serializable;
* a cluster, only a subset of representatives of the cluster is taken over to * a cluster, only a subset of representatives of the cluster is taken over to
* the next HC step while the rest is discarded. This means that the population * the next HC step while the rest is discarded. This means that the population
* size may be reduced. * size may be reduced.
* <p/> * <p>
* As soon as the improvement by HC lies below a threshold, the mutation step * As soon as the improvement by HC lies below a threshold, the mutation step
* size is decreased. If the step size is decreased below a certain threshold, * size is decreased. If the step size is decreased below a certain threshold,
* the current population is stored to an archive and reinitialized. Thus, the * the current population is stored to an archive and reinitialized. Thus, the

View File

@ -38,7 +38,7 @@ import java.util.Formatter;
* 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
* DPI returns less than q peaks. In this implementation, this is solved by * DPI returns less than q peaks. In this implementation, this is solved by
@ -46,43 +46,43 @@ import java.util.Formatter;
* population, only the best muPerPeak remain and the rest is assigned to the * population, only the best muPerPeak remain and the rest is assigned to the
* unclustered set. From these, pseudo-peaks are then formed until the expected * unclustered set. From these, pseudo-peaks are then formed until the expected
* number of peak populations is produced. * number of peak populations is produced.
* <p/> * <p>
* Also, they gave a general rule for setting the niche radius depending on the * Also, they gave a general rule for setting the niche radius depending on the
* optimizationProblem domain, however in their experiments, they were able to identify * optimizationProblem domain, however in their experiments, they were able to identify
* optima which were much closer (i.e., on Ackley's), so it is unclear which * optima which were much closer (i.e., on Ackley's), so it is unclear which
* niche radius was actually used there * niche radius was actually used there
* <p/> * <p>
* Due to the "non-standard" environmental selection mechanism (a fixed * Due to the "non-standard" environmental selection mechanism (a fixed
* proportion is chosen from the children, the rest from the parents), a * proportion is chosen from the children, the rest from the parents), a
* preselection mechanism was implemented here, slightly breaking the ES * preselection mechanism was implemented here, slightly breaking the ES
* 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:
* <p/> * <p>
* If strictNiching is deactivated, niches are disappearing because they are * If strictNiching is deactivated, niches are disappearing because they are
* sometimes assigned the global opt. and in that niche are very bad so they get * sometimes assigned the global opt. and in that niche are very bad so they get
* thrown away due to the maximum niche count if strictNiching is activated, * thrown away due to the maximum niche count if strictNiching is activated,
* niches are very small - or even empty. Why is that? This can hardly be * niches are very small - or even empty. Why is that? This can hardly be
* sensible esp. with a very small niche radius for F8. This would mean that in * sensible esp. with a very small niche radius for F8. This would mean that in
* the beginning, nearly all offspring are created from very few pairs of peaks. * the beginning, nearly all offspring are created from very few pairs of peaks.
* <p/> * <p>
* The mu/lambda information was lost on the way to the MutateESRankMuCMA * The mu/lambda information was lost on the way to the MutateESRankMuCMA
* class... I added it now as additional pop.data which is only loaded if the * class... I added it now as additional pop.data which is only loaded if the
* mu/lambda ratio deduced from the orig/selected population sizes does not make * mu/lambda ratio deduced from the orig/selected population sizes does not make
* sense. * sense.
* <p/> * <p>
* With the explorer peaks reinited every 100 generations or so, the course of * With the explorer peaks reinited every 100 generations or so, the course of
* the MPR for a *single* run will not be a clear logistic function, because * the MPR for a *single* run will not be a clear logistic function, because
* "finding" additional peaks produces small steps in the MPR. * "finding" additional peaks produces small steps in the MPR.
* <p/> * <p>
* The Niching ES is now using the Population to catch the generational events, * The Niching ES is now using the Population to catch the generational events,
* not producing it itself, similar to Tribes, ScatterSearch or IPOP-ES. Thus it * not producing it itself, similar to Tribes, ScatterSearch or IPOP-ES. Thus it
* could be used with a dynamic population size without too much hassle. * could be used with a dynamic population size without too much hassle.
* <p/> * <p>
* TODO Add adaptive niche radius. Add parameter to every indy which is adapted * TODO Add adaptive niche radius. Add parameter to every indy which is adapted
* after all new peaks have been found. * after all new peaks have been found.
*/ */

View File

@ -24,14 +24,14 @@ import java.util.LinkedList;
* Stagnation is for this implementation defined by a FitnessConvergenceTerminator instance * Stagnation is for this implementation defined by a FitnessConvergenceTerminator instance
* which terminates if the absolute change in fitness is below a threshold (default 10e-12) for a * which terminates if the absolute change in fitness is below a threshold (default 10e-12) for a
* certain number of generations (default: 10+floor(30*n/lambda) for problem dimension n). * certain number of generations (default: 10+floor(30*n/lambda) for problem dimension n).
* <p/> * <p>
* If the MutateESRankMuCMA mutation operator is used, additional criteria are used for restarts, * If the MutateESRankMuCMA mutation operator is used, additional criteria are used for restarts,
* such as numeric conditions of the covariance matrix. * such as numeric conditions of the covariance matrix.
* 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.")

View File

@ -146,10 +146,8 @@ public class FloodAlgorithm extends AbstractOptimizer implements java.io.Seriali
/** /**
* This main method will start a eva2.problems.simple hillclimber. No arguments necessary. * This main method will start a eva2.problems.simple hillclimber. No arguments necessary.
*
* @param args
*/ */
public static void main(String[] args) { public static void main() {
FloodAlgorithm program = new FloodAlgorithm(); FloodAlgorithm program = new FloodAlgorithm();
int TmpMeanCalls = 0, TmpMeanFitness = 0; int TmpMeanCalls = 0, TmpMeanFitness = 0;
for (int i = 0; i < program.multiRuns; i++) { for (int i = 0; i < program.multiRuns; i++) {

View File

@ -15,7 +15,7 @@ import eva2.util.annotation.Description;
/** /**
* A gradient descent algorithm by hannes planatscher don't expect any * A gradient descent algorithm by hannes planatscher don't expect any
* descriptions here... *big sigh* * descriptions here... *big sigh*
* <p/> * <p>
* mkron added some! * mkron added some!
* *
*/ */

View File

@ -24,7 +24,7 @@ import eva2.util.annotation.Hidden;
* to allow fast and reliable computation. This is still usefull, since it is * to allow fast and reliable computation. This is still usefull, since it is
* less prone to premature convergence and also an heterogenuous island model * less prone to premature convergence and also an heterogenuous island model
* can be used. * can be used.
* <p/> * <p>
* A population of the same size is sent to all nodes and evaluated there * A population of the same size is sent to all nodes and evaluated there
* independently for a cycle (more precisely: for MigrationRate generations) * independently for a cycle (more precisely: for MigrationRate generations)
* after which a communication step is performed according to the migration * after which a communication step is performed according to the migration

View File

@ -43,17 +43,17 @@ import java.util.Vector;
* search space. Subswarms are formed from that main swarm to refine and * search space. Subswarms are formed from that main swarm to refine and
* represent single niches which are assumed to correspond to local or global * represent single niches which are assumed to correspond to local or global
* optima. * optima.
* <p/> * <p>
* Different strategies are employed in order to: create subswarms from the main * Different strategies are employed in order to: create subswarms from the main
* swarm merge subswarms if they converge to the same solution absorb main swarm * swarm merge subswarms if they converge to the same solution absorb main swarm
* particles into a subswarm in case a particle enters the area covered by the * particles into a subswarm in case a particle enters the area covered by the
* subswarm deactivate subswarms when all containing particles converged on a * subswarm deactivate subswarms when all containing particles converged on a
* solution * solution
* <p/> * <p>
* Some implementations of these strategies and the deactivation strategy itself * Some implementations of these strategies and the deactivation strategy itself
* extend the original algorithm. As proposed in [1], NichePSO uses the * extend the original algorithm. As proposed in [1], NichePSO uses the
* "cognition only" model of the "inertness weight" PSO to train the main swarm. * "cognition only" model of the "inertness weight" PSO to train the main swarm.
* <p/> * <p>
* mainSwarmInertness sets the inertia weight omega and weights the particles * mainSwarmInertness sets the inertia weight omega and weights the particles
* tendency to follow its former movement. This controls exploration (favored by * tendency to follow its former movement. This controls exploration (favored by
* larger values) against exploitation (favored by smaller values). * larger values) against exploitation (favored by smaller values).
@ -67,7 +67,7 @@ import java.util.Vector;
* 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
* Optimizer In Proceedings of the 4th Asia-Pacific Conference on Simulated * Optimizer In Proceedings of the 4th Asia-Pacific Conference on Simulated
* Evolution and Learning (SEAL'02), 2002, 2, 692-696 [2] E. <EFBFBD>zcan and M. * Evolution and Learning (SEAL'02), 2002, 2, 692-696 [2] E. <EFBFBD>zcan and M.
@ -594,15 +594,10 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
} }
/** /**
* ******************************************************************************************************************** * Adds indy to an active subswarm, then removes indy from the mainswarm.
* Absorbtion *
*/
/**
* @param indy * @param indy
* @param subswarm * @param subswarm
* @return
* @tested adds indy to an active subswarm, then removes indy from the
* mainswarm.
*/ */
protected void absorbtionEventFor(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm) { protected void absorbtionEventFor(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm) {
if (isVerbose()) { if (isVerbose()) {
@ -613,7 +608,7 @@ public class NichePSO extends AbstractOptimizer implements InterfaceAdditionalPo
} }
/** /**
* @tested junit absorbs the mainswarm particles into the subswarm according * junit absorbs the mainswarm particles into the subswarm according
* to the absorbtion strategy * to the absorbtion strategy
*/ */
protected void absorbParticlesIfPossible() { protected void absorbParticlesIfPossible() {
@ -1999,7 +1994,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>
* The evaluation count is required currently due to the * The evaluation count is required currently due to the
* generation-dependent intertness decay used by the std. variant. To alter * generation-dependent intertness decay used by the std. variant. To alter
* the terminator, use OptimizationParameters.setTerminator(), and mind the intertness * the terminator, use OptimizationParameters.setTerminator(), and mind the intertness

View File

@ -369,7 +369,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
} }
// min.setDoubleGenotype(minValInDim); // set all dimensions to min // min.setDoubleGenotype(minValInDim); // set all dimensions to min
// max.setDoubleGenotype(maxValInDim); // set all dimensions to max // max.setDoubleGenotype(maxValInDim); // set all dimensions to max
this.maxPosDist = Mathematics.euclidianDist(minValInDim, maxValInDim); this.maxPosDist = Mathematics.euclideanDist(minValInDim, maxValInDim);
} }
// /** // /**

View File

@ -34,7 +34,7 @@ import java.util.Vector;
* range constraints on the decision variables. I've implemented 'brakes' before * range constraints on the decision variables. I've implemented 'brakes' before
* an individual is updated it is checked whether the new individual would * an individual is updated it is checked whether the new individual would
* violate range constraints, if so the velocity vector is reduced. * violate range constraints, if so the velocity vector is reduced.
* <p/> * <p>
* Possible topologies are: "Linear", "Grid", "Star", "Multi-Swarm", "Tree", * Possible topologies are: "Linear", "Grid", "Star", "Multi-Swarm", "Tree",
* "HPSO", "Random" in that order starting by 0. * "HPSO", "Random" in that order starting by 0.
*/ */

View File

@ -22,7 +22,7 @@ import java.util.logging.Logger;
* also allows to simulate ant systems due to the flexible update rule of V. But * also allows to simulate ant systems due to the flexible update rule of V. But
* both are limited to binary genotypes. This is a eva2.problems.simple implementation of * both are limited to binary genotypes. This is a eva2.problems.simple implementation of
* Population Based Incremental Learning. * Population Based Incremental Learning.
* <p/> * <p>
* Nicolas Monmarché , Eric Ramat , Guillaume Dromel , Mohamed Slimane , Gilles * Nicolas Monmarché , Eric Ramat , Guillaume Dromel , Mohamed Slimane , Gilles
* Venturini: On the similarities between AS, BSC and PBIL: toward the birth of * Venturini: On the similarities between AS, BSC and PBIL: toward the birth of
* a new meta-heuristic. TecReport 215. Univ. de Tours, 1999. * a new meta-heuristic. TecReport 215. Univ. de Tours, 1999.

View File

@ -37,7 +37,7 @@ import java.util.ArrayList;
* values in the reference set or as an absolute value (in both cases only the * values in the reference set or as an absolute value (in both cases only the
* first fitness criterion is regarded). * first fitness criterion is regarded).
* *
* <p/> * <p>
* [1] M.Rodiguez-Fernandez, J.Egea, J.Banga: Novel metaheuristic for parameter * [1] M.Rodiguez-Fernandez, J.Egea, J.Banga: Novel metaheuristic for parameter
* estimation in nonlinear dynamic biological systems. BMC Bioinformatics 2006, * estimation in nonlinear dynamic biological systems. BMC Bioinformatics 2006,
* 7:483. BioMed Central 2006. * 7:483. BioMed Central 2006.

View File

@ -33,7 +33,7 @@ import java.util.List;
* the CEC 2005 benchmarks (see the corresponding class) - I widely kept the * the CEC 2005 benchmarks (see the corresponding class) - I widely kept the
* original comments, except for places I changed the code so much that they * original comments, except for places I changed the code so much that they
* might mislead - thats all, I think * might mislead - thats all, I think
* <p/> * <p>
* I could produce similar results as Clerc's on Rosenbrock and Griewank, (in * I could produce similar results as Clerc's on Rosenbrock and Griewank, (in
* his book on p. 148), I couldnt reproduce the 100% success rate on Ackley, * his book on p. 148), I couldnt reproduce the 100% success rate on Ackley,
* though. * though.
@ -43,7 +43,7 @@ import java.util.List;
* {@link http://clerc.maurice.free.fr/pso/} * {@link http://clerc.maurice.free.fr/pso/}
* @version 2006-02 21 * @version 2006-02 21
* @date 2007-09-13 * @date 2007-09-13
* <p/> * <p>
* Original notes: * Original notes:
*/ */
/* Last updates (M.Clerc) /* Last updates (M.Clerc)

View File

@ -245,7 +245,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
/** /**
* Called to indicate a change in the problem environment. To be implemented. * Called to indicate a change in the problem environment. To be implemented.
* *
* @param problemTime * @param problemTime The time at which the problem changes
*/ */
protected abstract void changeProblemAt(double problemTime); protected abstract void changeProblemAt(double problemTime);

View File

@ -241,7 +241,7 @@ public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDoub
* based on the full list of known optima. * based on the full list of known optima.
* This assumes that the realOpts have fitness values assigned as for maximization and the * This assumes that the realOpts have fitness values assigned as for maximization and the
* population has fitness values assigned for minimization (mirrored by maximum fitness within realOpts). * population has fitness values assigned for minimization (mirrored by maximum fitness within realOpts).
* <p/> * <p>
* This is in analogy to the original implementation by F.Streichert. * This is in analogy to the original implementation by F.Streichert.
* *
* @param realOpts * @param realOpts

View File

@ -29,18 +29,18 @@ import eva2.util.annotation.Parameter;
* {@link #getProblemDimension()} must return the problem dimension, while * {@link #getProblemDimension()} must return the problem dimension, while
* {@link #evaluate(double[])} is to evaluate a single double vector into the result * {@link #evaluate(double[])} is to evaluate a single double vector into the result
* fitness vector. * fitness vector.
* <p/> * <p>
* To define the problem range, you may use the default range parameter * To define the problem range, you may use the default range parameter
* resulting in a symmetric double range [-defaultRange,defaulRange] in all * resulting in a symmetric double range [-defaultRange,defaulRange] in all
* dimensions. Or you may implement {@link #getRangeLowerBound(int)} and * dimensions. Or you may implement {@link #getRangeLowerBound(int)} and
* {@link #getRangeUpperBound(int)} to define an arbitrary problem range. In * {@link #getRangeUpperBound(int)} to define an arbitrary problem range. In
* that case, the default range parameter is not used. * that case, the default range parameter is not used.
* <p/> * <p>
* Anything you want to do before any optimization is started on the problem * Anything you want to do before any optimization is started on the problem
* should go into {@link #initializeProblem()}, but remember to call the super-method * should go into {@link #initializeProblem()}, but remember to call the super-method
* in your implementation. The individual template will be initialized to an * in your implementation. The individual template will be initialized to an
* ESIndividualDoubleData by then. * ESIndividualDoubleData by then.
* <p/> * <p>
* For the GUI, it is also convenient to implement the {@link eva2.util.annotation.Description} * For the GUI, it is also convenient to implement the {@link eva2.util.annotation.Description}
* annotation and {@link #getName()} method to provide some distinctive information for the * annotation and {@link #getName()} method to provide some distinctive information for the
* user. * user.
@ -445,7 +445,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
* Refine a candidate solution vector regarding rotations. Saves the new * Refine a candidate solution vector regarding rotations. Saves the new
* solution vector in pos and returns the number of dimensions that had to * solution vector in pos and returns the number of dimensions that had to
* be modified after rotation due to range restrictions. * be modified after rotation due to range restrictions.
* <p/> * <p>
* The given position is expected to be unrotated! The returned solution is * The given position is expected to be unrotated! The returned solution is
* unrotated as well. * unrotated as well.
* *

View File

@ -13,7 +13,7 @@ import java.io.Serializable;
* There are diagonal ridges across the search space and the optima are close to the bounds. * There are diagonal ridges across the search space and the optima are close to the bounds.
* The minimum fitness f(x*) is close to (n-1)*r for dimension n and default range r, by which * The minimum fitness f(x*) is close to (n-1)*r for dimension n and default range r, by which
* this implementation may be shifted to the positive domain. * this implementation may be shifted to the positive domain.
* <p/> * <p>
* For gnuplot: x *sin(sqrt(abs(-x+y+1)))*cos(sqrt(abs(x+y+1)))+(y+1)*cos(sqrt(abs(-x+y+1)))*sin(sqrt(abs(x+y+1))) * For gnuplot: x *sin(sqrt(abs(-x+y+1)))*cos(sqrt(abs(x+y+1)))+(y+1)*cos(sqrt(abs(-x+y+1)))*sin(sqrt(abs(x+y+1)))
*/ */
@Description("The Rana function is non-separable, highly multi-modal and multi-funnel." + @Description("The Rana function is non-separable, highly multi-modal and multi-funnel." +

View File

@ -4,7 +4,7 @@ import eva2.optimization.population.Population;
/** /**
* A multimodal problem which has knowledge of its optima. * A multimodal problem which has knowledge of its optima.
* <p/> * <p>
* User: streiche * User: streiche
* Date: 23.04.2003 * Date: 23.04.2003
* Time: 10:57:47 * Time: 10:57:47

View File

@ -33,7 +33,7 @@ public interface InterfaceProblemDouble {
* Get the upper bound of the double range in the given dimension. Override * Get the upper bound of the double range in the given dimension. Override
* this to implement non-symmetric ranges. User setDefaultRange for symmetric ranges. * this to implement non-symmetric ranges. User setDefaultRange for symmetric ranges.
* *
* @param dim * @param dim Dimension
* @return the upper bound of the double range in the given dimension * @return the upper bound of the double range in the given dimension
* @see #makeRange() * @see #makeRange()
* @see #getRangeLowerBound(int dim) * @see #getRangeLowerBound(int dim)
@ -44,7 +44,7 @@ public interface InterfaceProblemDouble {
* Get the lower bound of the double range in the given dimension. Override * Get the lower bound of the double range in the given dimension. Override
* this to implement non-symmetric ranges. Use setDefaultRange for symmetric ranges. * this to implement non-symmetric ranges. Use setDefaultRange for symmetric ranges.
* *
* @param dim * @param dim Dimension
* @return the lower bound of the double range in the given dimension * @return the lower bound of the double range in the given dimension
* @see #makeRange() * @see #makeRange()
* @see #getRangeUpperBound(int dim) * @see #getRangeUpperBound(int dim)

View File

@ -138,7 +138,7 @@ public final class JarResources {
/** /**
* Is a test driver. Given a jar file and a resource name, it tries to * Is a test driver. Given a jar file and a resource name, it tries to
* extract the resource and then tells us whether it could or not. * extract the resource and then tells us whether it could or not.
* <p/> * <p>
* <strong>Example</strong> * <strong>Example</strong>
* Let's say you have a JAR file which jarred up a bunch of gif image * Let's say you have a JAR file which jarred up a bunch of gif image
* files. Now, by using JarResources, you could extract, create, and display * files. Now, by using JarResources, you could extract, create, and display

View File

@ -6,7 +6,7 @@ import java.awt.*;
* <code>DComponent</code> is the mother of all objects which can be displayed * <code>DComponent</code> is the mother of all objects which can be displayed
* by a <code>DArea</code> object, even when it would be also enough to * by a <code>DArea</code> object, even when it would be also enough to
* implement the <code>DElement</code> interface to an class * implement the <code>DElement</code> 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
*/ */
public abstract class DComponent implements DElement { public abstract class DComponent implements DElement {
@ -30,7 +30,7 @@ public abstract class DComponent implements DElement {
/** /**
* this border respresents the additional space around the clip of the * this border represents the additional space around the clip of the
* graphics context, which is calculated by the union of all DRectangles of * graphics context, which is calculated by the union of all DRectangles of
* the components. For example it is used by DPointIcons or DLabels. * the components. For example it is used by DPointIcons or DLabels.
*/ */
@ -41,8 +41,7 @@ public abstract class DComponent implements DElement {
* this constructor is necessary to avoid infinite loops in constructing * this constructor is necessary to avoid infinite loops in constructing
* DRectangles * DRectangles
*/ */
DComponent(boolean is_rect) { DComponent(boolean is_rect) {}
}
public DComponent() { public DComponent() {
rectangle = DRectangle.getEmpty(); rectangle = DRectangle.getEmpty();

View File

@ -202,7 +202,7 @@ public class DMeasures implements Serializable {
* 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</code>
* <p/> * <p>
* Tuning: rect must not be empty * Tuning: rect must not be empty
* *
* @param rect the image rectangle * @param rect the image rectangle

View File

@ -2,10 +2,10 @@ package eva2.tools.math.Jama;
/** /**
* Cholesky Decomposition. * Cholesky Decomposition.
* <p/> * <p>
* For a symmetric, positive definite matrix A, the Cholesky decomposition * For a symmetric, positive definite matrix A, the Cholesky decomposition
* is an lower triangular matrix L so that A = L*L'. * is an lower triangular matrix L so that A = L*L'.
* <p/> * <p>
* If the matrix is not symmetric or positive definite, the constructor * If the matrix is not symmetric or positive definite, the constructor
* returns a partial decomposition and sets an internal flag that may * returns a partial decomposition and sets an internal flag that may
* be queried by the isSPD() method. * be queried by the isSPD() method.

View File

@ -5,12 +5,12 @@ import eva2.tools.math.Jama.util.Maths;
/** /**
* Eigenvalues and eigenvectors of a real matrix. * Eigenvalues and eigenvectors of a real matrix.
* <p/> * <p>
* If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is * If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is
* diagonal and the eigenvector matrix V is orthogonal. * diagonal and the eigenvector matrix V is orthogonal.
* I.e. A = V.times(D.times(V.transpose())) and * I.e. A = V.times(D.times(V.transpose())) and
* V.times(V.transpose()) equals the identiCty matrix. * V.times(V.transpose()) equals the identiCty matrix.
* <p/> * <p>
* If A is not symmetric, then the eigenvalue matrix D is block diagonal * If A is not symmetric, then the eigenvalue matrix D is block diagonal
* with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues, * with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues,
* lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The * lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The

View File

@ -3,12 +3,12 @@ package eva2.tools.math.Jama;
/** /**
* LU Decomposition. * LU Decomposition.
* <p/> * <p>
* For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n * For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
* unit lower triangular matrix L, an n-by-n upper triangular matrix U, * unit lower triangular matrix L, an n-by-n upper triangular matrix U,
* and a permutation vector piv of length m so that A(piv,:) = L*U. * and a permutation vector piv of length m so that A(piv,:) = L*U.
* If m < n, then L is m-by-m and U is m-by-n. * If m < n, then L is m-by-m and U is m-by-n.
* <p/> * <p>
* The LU decompostion with pivoting always exists, even if the matrix is * The LU decompostion with pivoting always exists, even if the matrix is
* singular, so the constructor will never fail. The primary use of the * singular, so the constructor will never fail. The primary use of the
* LU decomposition is in the solution of square systems of simultaneous * LU decomposition is in the solution of square systems of simultaneous

View File

@ -19,7 +19,7 @@ import java.util.Vector;
/** /**
* Jama = Java Matrix class. * Jama = Java Matrix class.
* <p/> * <p>
* The Java Matrix Class provides the fundamental operations of numerical * The Java Matrix Class provides the fundamental operations of numerical
* linear algebra. Various constructors create Matrices from two dimensional * linear algebra. Various constructors create Matrices from two dimensional
* arrays of double precision floating point numbers. Various "gets" and * arrays of double precision floating point numbers. Various "gets" and
@ -29,7 +29,7 @@ import java.util.Vector;
* Methods for reading and printing matrices are also included. All the * Methods for reading and printing matrices are also included. All the
* operations in this version of the Matrix Class involve real matrices. * operations in this version of the Matrix Class involve real matrices.
* Complex matrices may be handled in a future version. * Complex matrices may be handled in a future version.
* <p/> * <p>
* Five fundamental matrix decompositions, which consist of pairs or triples * Five fundamental matrix decompositions, which consist of pairs or triples
* of matrices, permutation vectors, and the like, produce results in five * of matrices, permutation vectors, and the like, produce results in five
* decomposition classes. These decompositions are accessed by the Matrix * decomposition classes. These decompositions are accessed by the Matrix
@ -44,7 +44,7 @@ import java.util.Vector;
* </UL> * </UL>
* <DL> * <DL>
* <DT><B>Example of use:</B></DT> * <DT><B>Example of use:</B></DT>
* <p/> * <p>
* <DD>Solve a linear system A x = b and compute the residual norm, ||b - A x||. * <DD>Solve a linear system A x = b and compute the residual norm, ||b - A x||.
* <P><PRE> * <P><PRE>
* double[][] vals = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}}; * double[][] vals = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}};
@ -1428,7 +1428,7 @@ public class Matrix implements Cloneable, Serializable {
/** /**
* Given two vectors, ``[a0, a1, ..., aM]`` and ``[b0, b1, ..., bN]``, * Given two vectors, ``[a0, a1, ..., aM]`` and ``[b0, b1, ..., bN]``,
* the outer product becomes:: * the outer product becomes::
* <p/> * <p>
* [[a0*b0 a0*b1 ... a0*bN ] * [[a0*b0 a0*b1 ... a0*bN ]
* [a1*b0 . * [a1*b0 .
* [ ... . * [ ... .

View File

@ -4,11 +4,11 @@ import eva2.tools.math.Jama.util.Maths;
/** /**
* QR Decomposition. * QR Decomposition.
* <p/> * <p>
* For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n * For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
* orthogonal matrix Q and an n-by-n upper triangular matrix R so that * orthogonal matrix Q and an n-by-n upper triangular matrix R so that
* A = Q*R. * A = Q*R.
* <p/> * <p>
* The QR decompostion always exists, even if the matrix does not have * The QR decompostion always exists, even if the matrix does not have
* full rank, so the constructor will never fail. The primary use of the * full rank, so the constructor will never fail. The primary use of the
* QR decomposition is in the least squares solution of nonsquare systems * QR decomposition is in the least squares solution of nonsquare systems

View File

@ -5,14 +5,14 @@ import eva2.tools.math.Jama.util.Maths;
/** /**
* Singular Value Decomposition. * Singular Value Decomposition.
* <p/> * <p>
* For an m-by-n matrix A with m >= n, the singular value decomposition is * For an m-by-n matrix A with m >= n, the singular value decomposition is
* an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and * an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
* an n-by-n orthogonal matrix V so that A = U*S*V'. * an n-by-n orthogonal matrix V so that A = U*S*V'.
* <p/> * <p>
* The singular values, sigma[k] = S[k][k], are ordered so that * The singular values, sigma[k] = S[k][k], are ordered so that
* sigma[0] >= sigma[1] >= ... >= sigma[n-1]. * sigma[0] >= sigma[1] >= ... >= sigma[n-1].
* <p/> * <p>
* The singular value decompostion always exists, so the constructor will * The singular value decompostion always exists, so the constructor will
* never fail. The matrix condition number and the effective numerical * never fail. The matrix condition number and the effective numerical
* rank can be computed from this decomposition. * rank can be computed from this decomposition.

View File

@ -117,10 +117,9 @@ public final class Mathematics {
* @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 Exception if x and y have different dimensions an exception is thrown.
*/ */
public static double euclidianDist(double[] x, double[] y) { public static double euclideanDist(double[] x, double[] y) {
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");
} }
double d = 0; double d = 0;
for (int i = 0; i < x.length; i++) { for (int i = 0; i < x.length; i++) {
@ -647,7 +646,7 @@ public final class Mathematics {
} }
/** /**
* Performs two-sample unpaired t test and returns t critical value. * Performs two-sample unpaired t test and returns t value.
* *
* Both samples have to have the same size and equal variance. * Both samples have to have the same size and equal variance.
* *
@ -662,8 +661,7 @@ public final class Mathematics {
double stdDev1 = stdDev(vector1); double stdDev1 = stdDev(vector1);
double stdDev2 = stdDev(vector2); double stdDev2 = stdDev(vector2);
double sX1X2 = Math.sqrt((Math.pow(stdDev1, 2) + Math.pow(stdDev2, 2)) / 2); double sX1X2 = Math.sqrt((Math.pow(stdDev1, 2) + Math.pow(stdDev2, 2)) / 2);
double result = (mean1 - mean2) / (Math.sqrt(2 / n) * sX1X2); return (mean1 - mean2) / (Math.sqrt(2 / n) * sX1X2);
return result;
} }
public static double tTestUnEqSizeEqVar(double[] vector1, double[] vector2) { public static double tTestUnEqSizeEqVar(double[] vector1, double[] vector2) {
@ -674,8 +672,7 @@ public final class Mathematics {
double stdDev1 = stdDev(vector1); double stdDev1 = stdDev(vector1);
double stdDev2 = stdDev(vector2); double stdDev2 = stdDev(vector2);
double sX1X2 = Math.sqrt(((n1 - 1) * Math.pow(stdDev1, 2) + (n2 - 1) * Math.pow(stdDev2, 2)) / (n1 + n2 - 2)); double sX1X2 = Math.sqrt(((n1 - 1) * Math.pow(stdDev1, 2) + (n2 - 1) * Math.pow(stdDev2, 2)) / (n1 + n2 - 2));
double result = (mean1 - mean2) / (sX1X2 * Math.sqrt(1 / n1 + 1 / n2)); return (mean1 - mean2) / (sX1X2 * Math.sqrt(1 / n1 + 1 / n2));
return result;
} }
public static double tTestUnEqSizeUnEqVar(double[] vector1, double[] vector2) { public static double tTestUnEqSizeUnEqVar(double[] vector1, double[] vector2) {
@ -686,8 +683,7 @@ public final class Mathematics {
double stdDev1 = stdDev(vector1); double stdDev1 = stdDev(vector1);
double stdDev2 = stdDev(vector2); double stdDev2 = stdDev(vector2);
double sX1X2 = Math.sqrt((Math.pow(stdDev1, 2) / n1) + (Math.pow(stdDev2, 2) / n2)); double sX1X2 = Math.sqrt((Math.pow(stdDev1, 2) / n1) + (Math.pow(stdDev2, 2) / n2));
double result = (mean1 - mean2) / sX1X2; return (mean1 - mean2) / sX1X2;
return result;
} }
public static double min(double[] vals) { public static double min(double[] vals) {
@ -706,8 +702,8 @@ public final class Mathematics {
*/ */
public static double norm(double[] d) { public static double norm(double[] d) {
double sqSum = 0; double sqSum = 0;
for (int i = 0; i < d.length; i++) { for (double value : d) {
sqSum += d[i] * d[i]; sqSum += value * value;
} }
return Math.sqrt(sqSum); return Math.sqrt(sqSum);
} }
@ -716,7 +712,7 @@ public final class Mathematics {
* Normalizes the doubles in the array by their sum, so that they add up to * Normalizes the doubles in the array by their sum, so that they add up to
* one. * one.
* *
* @param d the array of double * @param v the array of double
* @throws IllegalArgumentException if sum is Zero or NaN * @throws IllegalArgumentException if sum is Zero or NaN
*/ */
public static double[] normalizeSum(double[] v) { public static double[] normalizeSum(double[] v) {
@ -784,8 +780,7 @@ public final class Mathematics {
public static int projectToRange(double[] x, double[][] range) { public static int projectToRange(double[] x, double[][] range) {
int viols = 0; int viols = 0;
if (x.length > range.length) { if (x.length > range.length) {
System.err System.err.println("Invalid vector length, x is longer than range! (Mathematics.projectToRange)");
.println("Invalid vector length, x is longer than range! (Mathematics.projectToRange)");
} }
for (int i = 0; i < x.length; i++) { for (int i = 0; i < x.length; i++) {
if (x[i] < range[i][0]) { if (x[i] < range[i][0]) {
@ -845,7 +840,7 @@ public final class Mathematics {
*/ */
public static int reflectBounds(double[] x, double[][] range) { public static int reflectBounds(double[] x, double[][] range) {
int viols = 0; int viols = 0;
double d = 0.; double d;
for (int i = 0; i < x.length; i++) { for (int i = 0; i < x.length; i++) {
double dimLen = range[i][1] - range[i][0]; double dimLen = range[i][1] - range[i][0];
if (dimLen <= 0.) { if (dimLen <= 0.) {
@ -1121,8 +1116,8 @@ public final class Mathematics {
*/ */
public static double sum(double[] doubles) { public static double sum(double[] doubles) {
double sum = 0; double sum = 0;
for (int i = 0; i < doubles.length; i++) { for (double value : doubles) {
sum += doubles[i]; sum += value;
} }
return sum; return sum;
} }
@ -1137,8 +1132,8 @@ public final class Mathematics {
int sum = 0; int sum = 0;
for (int i = 0; i < ints.length; i++) { for (int value : ints) {
sum += ints[i]; sum += value;
} }
return sum; return sum;
} }

View File

@ -36,7 +36,7 @@ package eva2.tools.math;
* Like the java.lang.Math class this class is final and cannot be * Like the java.lang.Math class this class is final and cannot be
* subclassed. * subclassed.
* All physical constants are in cgs units. * All physical constants are in cgs units.
* <p/> * <p>
* <B>NOTE:</B> These special functions do not necessarily use the fastest * <B>NOTE:</B> These special functions do not necessarily use the fastest
* or most accurate algorithms. * or most accurate algorithms.
* *
@ -527,7 +527,7 @@ 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> * <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>
@ -662,7 +662,7 @@ public final class SpecialFunction {
* @param a double value * @param a double value
* @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> * <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>
@ -737,7 +737,7 @@ public final class SpecialFunction {
* @param a double value * @param a double value
* @param x double value * @param x double value
* @return the Incomplete Gamma function. * @return the Incomplete Gamma function.
* <p/> * <p>
* <FONT size=2> * <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>
@ -811,7 +811,7 @@ public final class SpecialFunction {
* @param df degrees of freedom * @param df degrees of freedom
* @param x double value * @param x double value
* @return the Chi-Square function. * @return the Chi-Square function.
* <p/> * <p>
*/ */
static public double chisqc(double df, double x) static public double chisqc(double df, double x)
@ -893,7 +893,7 @@ 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> * <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>
@ -997,7 +997,7 @@ public final class SpecialFunction {
/** /**
* @param a double value * @param a double value
* @return The Error function * @return The Error function
* <p/> * <p>
* <FONT size=2> * <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>
@ -1174,7 +1174,7 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
* @param bb double value * @param bb double value
* @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> * <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>

View File

@ -67,7 +67,6 @@ public final class StatisticUtils {
double seA = 0.0; double seA = 0.0;
double seB = 0.0; double seB = 0.0;
double seAB = 0.0; double seAB = 0.0;
double c = 0.0;
int AB; int AB;
int allSum = countsSum1 + countsSum2; int allSum = countsSum1 + countsSum2;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
@ -77,9 +76,7 @@ public final class StatisticUtils {
seAB -= xlogx(((double) AB) / ((double) allSum)); seAB -= xlogx(((double) AB) / ((double) allSum));
} }
c = seAB - 0.5 * (seA + seB); return seAB - 0.5 * (seA + seB);
return c;
} }
/** /**
@ -124,7 +121,6 @@ public final class StatisticUtils {
* @param a a double * @param a a double
*/ */
public static double log2(double a) { public static double log2(double a) {
return Math.log(a) / log2; return Math.log(a) / log2;
} }
@ -230,9 +226,9 @@ public final class StatisticUtils {
if (n <= 1) { if (n <= 1) {
return 0; return 0;
} }
for (int i = 0; i < n; i++) { for (double value : vector) {
sum += vector[i]; sum += value;
sumSquared += (vector[i] * vector[i]); sumSquared += (value * value);
} }
double denom; double denom;
if (finiteSet) { if (finiteSet) {
@ -240,14 +236,7 @@ public final class StatisticUtils {
} else { } else {
denom = (n - 1); denom = (n - 1);
} }
double result = (sumSquared - (sum * sum / (double) n)) / denom; return (sumSquared - (sum * sum / (double) n)) / denom;
// We don't like negative variance
if (result < 0) {
return 0;
} else {
return result;
}
} }
/** /**
@ -354,7 +343,7 @@ public final class StatisticUtils {
/** /**
* Returns the correlation coefficient r^2. * Returns the correlation coefficient r^2.
* <p/> * <p>
* Correlation ("Statistik", 7 Aufl., Hartung, 1989, Kapitel 9 und 10, S.546-608): * Correlation ("Statistik", 7 Aufl., Hartung, 1989, Kapitel 9 und 10, S.546-608):
* a=yMess[i]; * a=yMess[i];
* b=yWahr[i]; * b=yWahr[i];
@ -364,8 +353,6 @@ public final class StatisticUtils {
* numerator=sumAB-(sumA*sumB/n); * numerator=sumAB-(sumA*sumB/n);
* denominator=sqrt[(sumAA-(sumA*sumA/n))*(sumBB-(sumB*sumB/n))]; * denominator=sqrt[(sumAA-(sumA*sumA/n))*(sumBB-(sumB*sumB/n))];
* R=correlationcoefficient=numerator/denominator; * R=correlationcoefficient=numerator/denominator;
*
* @author Joerg K. Wegner
*/ */
public static double getCorrelationCoefficient(double array1[], double array2[]) { public static double getCorrelationCoefficient(double array1[], double array2[]) {
if ((array1 == null) || (array2 == null)) { if ((array1 == null) || (array2 == null)) {

View File

@ -250,12 +250,12 @@ public class JMatLink extends Thread {
/** /**
* This is the constructor for the JMatLink library. * This is the constructor for the JMatLink library.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* <b>JMatLink</b> engine = new <b>JMatLink()</b>; * <b>JMatLink</b> engine = new <b>JMatLink()</b>;
@ -297,14 +297,14 @@ public class JMatLink extends Thread {
/** /**
* Open engine. This command is used to open a <b>single</b> connection * Open engine. This command is used to open a <b>single</b> connection
* <p/> * <p>
* to matlab. * to matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* JMatLink engine = new JMatLink(); * JMatLink engine = new JMatLink();
@ -330,18 +330,18 @@ public class JMatLink extends Thread {
/** /**
* Open engine. This command is used to open a <b>single</b> connection * Open engine. This command is used to open a <b>single</b> connection
* <p/> * <p>
* to matlab. * to matlab.
* <p/> * <p>
* This command is only useful on unix systems. On windows * This command is only useful on unix systems. On windows
* <p/> * <p>
* the optional parameter <b>must</b> be NULL. * the optional parameter <b>must</b> be NULL.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* JMatLink engine = new JMatLink(); * JMatLink engine = new JMatLink();
@ -382,14 +382,14 @@ public class JMatLink extends Thread {
/** /**
* Open engine for single use. This command is used to open * Open engine for single use. This command is used to open
* <p/> * <p>
* <b>multiple</b> connections to matlab. * <b>multiple</b> connections to matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int a,b; * int a,b;
@ -424,14 +424,14 @@ public class JMatLink extends Thread {
/** /**
* Open engine for single use. This command is used to open * Open engine for single use. This command is used to open
* <p/> * <p>
* <b>multiple</b> connections to matlab. * <b>multiple</b> connections to matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int a,b; * int a,b;
@ -478,12 +478,12 @@ public class JMatLink extends Thread {
/** /**
* Close the connection to matlab. * Close the connection to matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* JMatLink engine = new JMatLink(); * JMatLink engine = new JMatLink();
@ -510,12 +510,12 @@ public class JMatLink extends Thread {
/** /**
* Close a specified connection to an instance of matlab. * Close a specified connection to an instance of matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int a,b; * int a,b;
@ -564,11 +564,11 @@ public class JMatLink extends Thread {
/** /**
* Evaluate an expression in matlab's workspace. * Evaluate an expression in matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* JMatLink engine = new JMatLink(); * JMatLink engine = new JMatLink();
@ -595,12 +595,12 @@ public class JMatLink extends Thread {
/** /**
* Evaluate an expression in a specified workspace. * Evaluate an expression in a specified workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int a,b; * int a,b;
@ -653,12 +653,12 @@ public class JMatLink extends Thread {
/** /**
* Get a scalar value from matlab's workspace. * Get a scalar value from matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* double a; * double a;
@ -689,12 +689,12 @@ public class JMatLink extends Thread {
/** /**
* Get a scalar value from a specified workspace. * Get a scalar value from a specified workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* double a; * double a;
@ -749,12 +749,12 @@ public class JMatLink extends Thread {
/** /**
* Get an array (1 * n) from matlab's workspace. * Get an array (1 * n) from matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* double[] array; * double[] array;
@ -785,12 +785,12 @@ public class JMatLink extends Thread {
/** /**
* Get an array (1 * n) from a specified workspace. * Get an array (1 * n) from a specified workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int b; * int b;
@ -839,12 +839,12 @@ public class JMatLink extends Thread {
/** /**
* Get an array from matlab's workspace. * Get an array from matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int b; * int b;
@ -877,12 +877,12 @@ public class JMatLink extends Thread {
/** /**
* Get an array from a specified instance/workspace of matlab. * Get an array from a specified instance/workspace of matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int b; * int b;
@ -931,12 +931,12 @@ public class JMatLink extends Thread {
/** /**
* Get an 'char' array (string) from matlab's workspace. * Get an 'char' array (string) from matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* String array; * String array;
@ -983,12 +983,12 @@ public class JMatLink extends Thread {
/** /**
* Put an array into a specified workspace. * Put an array into a specified workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int array = 1; * int array = 1;
@ -1027,12 +1027,12 @@ public class JMatLink extends Thread {
/** /**
* Put an array into matlab's workspace. * Put an array into matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* double array = 1; * double array = 1;
@ -1061,12 +1061,12 @@ public class JMatLink extends Thread {
/** /**
* Put an array into a specified instance/workspace of matlab. * Put an array into a specified instance/workspace of matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int b; * int b;
@ -1101,14 +1101,14 @@ public class JMatLink extends Thread {
/** /**
* Put an array (1 dimensional) into a specified instance/workspace of * Put an array (1 dimensional) into a specified instance/workspace of
* <p/> * <p>
* matlab. * matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* double[] array = {1.0 , 2.0 , 3.0}; * double[] array = {1.0 , 2.0 , 3.0};
@ -1137,14 +1137,14 @@ public class JMatLink extends Thread {
/** /**
* Put an array (1 dimensional) into a specified instance/workspace of * Put an array (1 dimensional) into a specified instance/workspace of
* <p/> * <p>
* matlab. * matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int b; * int b;
@ -1184,12 +1184,12 @@ public class JMatLink extends Thread {
/** /**
* Put an array (2 dimensional) into matlab's workspace. * Put an array (2 dimensional) into matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* double[][] array={{1.0 , 2.0 , 3.0}, * double[][] array={{1.0 , 2.0 , 3.0},
@ -1220,14 +1220,14 @@ public class JMatLink extends Thread {
/** /**
* Put an array (2 dimensional) into a specified instance/workspace of * Put an array (2 dimensional) into a specified instance/workspace of
* <p/> * <p>
* matlab. * matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* int b; * int b;
@ -1279,12 +1279,12 @@ public class JMatLink extends Thread {
/** /**
* Return the outputs of previous commands from matlab's workspace. * Return the outputs of previous commands from matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* String buffer; * String buffer;
@ -1317,14 +1317,14 @@ public class JMatLink extends Thread {
/** /**
* Return the outputs of previous commands from a specified instance/ * Return the outputs of previous commands from a specified instance/
* <p/> * <p>
* workspace form matlab. * workspace form matlab.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* String buffer; * String buffer;
@ -1357,16 +1357,16 @@ public class JMatLink extends Thread {
/** /**
* Return the ouputs of previous commands in matlab's workspace. * Return the ouputs of previous commands in matlab's workspace.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* Right now the parameter <i>buflen</i> is not supported. * Right now the parameter <i>buflen</i> is not supported.
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* <p/> * <p>
* E.g.:<br> * E.g.:<br>
* <p/> * <p>
* <pre> * <pre>
* *
* String buffer; * String buffer;

View File

@ -8,8 +8,12 @@ import static org.junit.Assert.assertTrue;
public class MathematicsTest { public class MathematicsTest {
@Test @Test
public void testEuclidianDist() throws Exception { public void testEuclideanDist() throws Exception {
double[] values1 = {6.0, 51.0, 3.0};
double[] values2 = {1.9, 99.0, 2.9};
assertEquals(48.174889, Mathematics.euclideanDist(values1, values2), 0.00001);
assertEquals(48.174889, Mathematics.euclideanDist(values2, values1), 0.00001);
} }
@Test @Test