diff --git a/src/eva2/OptimizerFactory.java b/src/eva2/OptimizerFactory.java index 1825c207..26f02827 100644 --- a/src/eva2/OptimizerFactory.java +++ b/src/eva2/OptimizerFactory.java @@ -40,22 +40,19 @@ import java.util.BitSet; import java.util.List; /** - *

- * The OptimizerFactory allows quickly creating some optimizers without thinking - * much about parameters. You can access a runnable Optimization thread and - * directly start it, or access its fully prepared GOParameter instance, change - * some parameters, and start it then. - *

- *

- * On the other hand this class provides an almost complete list of all - * currently available optimization procedures in EvA2. The arguments passed to - * the methods initialize the respective optimization procedure. To perform an - * optimization one has to do the following: + *

The OptimizerFactory allows quickly creating some optimizers without + * thinking much about parameters. You can access a runnable Optimization thread + * and directly start it, or access its fully prepared GOParameter instance, + * change some parameters, and start it then.

On the other hand this + * class provides an almost complete list of all currently available + * optimization procedures in EvA2. The arguments passed to the methods + * initialize the respective optimization procedure. To perform an optimization + * one has to do the following: + * * InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments); * EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls); * while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize(); - * - *

+ *

* * @version 0.1 * @since 2.0 @@ -64,1538 +61,1578 @@ import java.util.List; * @date 17.04.2007 */ public class OptimizerFactory { - private static InterfaceTerminator userTerm = null; - public final static int STD_ES = 1; + private static InterfaceTerminator userTerm = null; + public final static int STD_ES = 1; + public final static int CMA_ES = 2; + public final static int STD_GA = 3; + public final static int PSO = 4; + public final static int DE = 5; + public final static int TRIBES = 6; + public final static int RANDOM = 7; + public final static int HILLCL = 8; + public final static int CBN_ES = 9; + public final static int CL_HILLCL = 10; + public final static int CMA_ES_IPOP = 11; + public final static int CBN_GA = 12; + public final static int PBIL = 13; + public final static int MOGA = 14; + public final static int defaultFitCalls = 10000; + public final static int randSeed = 0; + private static OptimizerRunnable lastRunnable = null; + private static final int cbnDefaultHaltingWindowLength = new ClusterBasedNichingEA().getHaltingWindow(); + private static final double cbnDefaultHaltingWindowEpsilon = new ClusterBasedNichingEA().getEpsilonBound(); + private static final double cbnDefaultClusterSigma = 0.1; + private static final int cbnDefaultMinGroupSize = 5; + private static final int cbnDefaultMaxGroupSize = -1; - public final static int CMA_ES = 2; + /** + * This method optimizes the given problem using differential evolution. + * + * @param problem + * @param popsize + * @param f + * @param CR + * @param lambda + * @param listener + * @return An optimization algorithm that performs differential evolution. + */ + public static final DifferentialEvolution createDifferentialEvolution( + AbstractOptimizationProblem problem, int popsize, double f, + double lambda, double CR, + InterfacePopulationChangedEventListener listener) { - public final static int STD_GA = 3; + problem.initProblem(); - public final static int PSO = 4; + setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0); - public final static int DE = 5; + DifferentialEvolution de = new DifferentialEvolution(); + de.setProblem(problem); + de.getPopulation().setTargetSize(popsize); + de.setDEType(DETypeEnum.DE2_CurrentToBest); + de.setF(f); + de.setK(CR); + de.setLambda(lambda); + de.addPopulationChangedEventListener(listener); + de.init(); - public final static int TRIBES = 6; + if (listener != null) { + listener.registerPopulationStateChanged(de.getPopulation(), ""); + } - public final static int RANDOM = 7; + return de; + } - public final static int HILLCL = 8; + /** + * This method performs the optimization using an Evolution strategy. + * + * @param mu + * @param lambda + * @param plus if true this operator uses elitism otherwise a comma + * strategy. + * @param mutationoperator + * @param pm + * @param crossoveroperator + * @param pc + * @param selection environmental selection operator + * @param problem + * @param listener + * @return An optimization algorithm that employs an evolution strategy. + */ + public static final EvolutionStrategies createEvolutionStrategy(int mu, + int lambda, boolean plus, InterfaceMutation mutationoperator, + double pm, InterfaceCrossover crossoveroperator, double pc, + InterfaceSelection selection, AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { + return createES(new EvolutionStrategies(mu, lambda, plus), mutationoperator, pm, crossoveroperator, pc, selection, problem, listener); + } - public final static int CBN_ES = 9; - - public final static int CL_HILLCL = 10; - - public final static int CMA_ES_IPOP = 11; - - public final static int CBN_GA = 12; - - public final static int PBIL = 13; - - public final static int MOGA = 14; - - public final static int defaultFitCalls = 10000; - - public final static int randSeed = 0; - - private static OptimizerRunnable lastRunnable = null; - - private static final int cbnDefaultHaltingWindowLength=new ClusterBasedNichingEA().getHaltingWindow(); - private static final double cbnDefaultHaltingWindowEpsilon=new ClusterBasedNichingEA().getEpsilonBound(); - private static final double cbnDefaultClusterSigma = 0.1; - private static final int cbnDefaultMinGroupSize = 5; - private static final int cbnDefaultMaxGroupSize = -1; - - /** - * This method optimizes the given problem using differential evolution. - * - * @param problem - * @param popsize - * @param f - * @param CR - * @param lambda - * @param listener - * @return An optimization algorithm that performs differential evolution. - */ - public static final DifferentialEvolution createDifferentialEvolution( - AbstractOptimizationProblem problem, int popsize, double f, - double lambda, double CR, - InterfacePopulationChangedEventListener listener) { - - problem.initProblem(); - - setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0); - - DifferentialEvolution de = new DifferentialEvolution(); - de.setProblem(problem); - de.getPopulation().setTargetSize(popsize); - de.setDEType(DETypeEnum.DE2_CurrentToBest); - de.setF(f); - de.setK(CR); - de.setLambda(lambda); - de.addPopulationChangedEventListener(listener); - de.init(); - - if (listener!=null) listener.registerPopulationStateChanged(de.getPopulation(), ""); - - return de; - } - - /** - * This method performs the optimization using an Evolution strategy. - * - * @param mu - * @param lambda - * @param plus - * if true this operator uses elitism otherwise a comma strategy. - * @param mutationoperator - * @param pm - * @param crossoveroperator - * @param pc - * @param selection environmental selection operator - * @param problem - * @param listener - * @return An optimization algorithm that employs an evolution strategy. - */ - public static final EvolutionStrategies createEvolutionStrategy(int mu, - int lambda, boolean plus, InterfaceMutation mutationoperator, - double pm, InterfaceCrossover crossoveroperator, double pc, - InterfaceSelection selection, AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { - return createES(new EvolutionStrategies(mu, lambda, plus), mutationoperator, pm, crossoveroperator, pc, selection, problem, listener); - } - - /** - * This method initializes the optimization using an Evolution strategy with - * increasing population size. - * - * @param mu - * @param lambda - * @param plus - * if true this operator uses elitism otherwise a comma strategy. - * @param mutationoperator - * @param pm - * @param crossoveroperator - * @param pc - * @param incPopSizeFact factor by which to inrease lambda ro restart, default is 2 - * @param stagThresh if the fitness changes below this value during a stagnation phase, a restart is initiated - * @param problem - * @param listener - * @return An optimization algorithm that employs an IPOP-ES. - */ - public static final EvolutionStrategyIPOP createEvolutionStrategyIPOP(int mu, - int lambda, boolean plus, InterfaceMutation mutationoperator, - double pm, InterfaceCrossover crossoveroperator, double pc, double incPopSizeFact, double stagThresh, - AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) { - EvolutionStrategyIPOP esIPOP = (EvolutionStrategyIPOP)createES(new EvolutionStrategyIPOP(mu, lambda, plus), mutationoperator, pm, crossoveroperator, pc, new SelectBestIndividuals(), problem, listener); - esIPOP.setIncPopSizeFact(incPopSizeFact); + /** + * This method initializes the optimization using an Evolution strategy with + * increasing population size. + * + * @param mu + * @param lambda + * @param plus if true this operator uses elitism otherwise a comma + * strategy. + * @param mutationoperator + * @param pm + * @param crossoveroperator + * @param pc + * @param incPopSizeFact factor by which to inrease lambda ro restart, + * default is 2 + * @param stagThresh if the fitness changes below this value during a + * stagnation phase, a restart is initiated + * @param problem + * @param listener + * @return An optimization algorithm that employs an IPOP-ES. + */ + public static final EvolutionStrategyIPOP createEvolutionStrategyIPOP(int mu, + int lambda, boolean plus, InterfaceMutation mutationoperator, + double pm, InterfaceCrossover crossoveroperator, double pc, double incPopSizeFact, double stagThresh, + AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) { + EvolutionStrategyIPOP esIPOP = (EvolutionStrategyIPOP) createES(new EvolutionStrategyIPOP(mu, lambda, plus), mutationoperator, pm, crossoveroperator, pc, new SelectBestIndividuals(), problem, listener); + esIPOP.setIncPopSizeFact(incPopSizeFact); // esIPOP.setStagnationGenerations(stagTimeGens); - esIPOP.setStagThreshold(stagThresh); - return esIPOP; - } + esIPOP.setStagThreshold(stagThresh); + return esIPOP; + } - private static final EvolutionStrategies createES(EvolutionStrategies theES, InterfaceMutation mutationoperator, - double pm, InterfaceCrossover crossoveroperator, double pc, - InterfaceSelection selection, AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { + private static final EvolutionStrategies createES(EvolutionStrategies theES, InterfaceMutation mutationoperator, + double pm, InterfaceCrossover crossoveroperator, double pc, + InterfaceSelection selection, AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { - problem.initProblem(); + problem.initProblem(); - AbstractEAIndividual tmpIndi = problem.getIndividualTemplate(); - AbstractEAIndividual.setOperators(tmpIndi, mutationoperator, pm, crossoveroperator, pc); + AbstractEAIndividual tmpIndi = problem.getIndividualTemplate(); + AbstractEAIndividual.setOperators(tmpIndi, mutationoperator, pm, crossoveroperator, pc); - theES.addPopulationChangedEventListener(listener); + theES.addPopulationChangedEventListener(listener); // theES.setParentSelection(selection); // theES.setPartnerSelection(selection); - theES.setEnvironmentSelection(selection); - theES.setProblem(problem); - theES.init(); + theES.setEnvironmentSelection(selection); + theES.setProblem(problem); + theES.init(); - if (listener != null) listener.registerPopulationStateChanged(theES.getPopulation(), ""); + if (listener != null) { + listener.registerPopulationStateChanged(theES.getPopulation(), ""); + } - return theES; - } - - /** - * This method performs a Genetic Algorithm. - * - * @param mut - * @param pm - * @param cross - * @param pc - * @param select - * @param popsize - * @param problem - * @param listener - * @return An optimization algorithm that employes an genetic algorithm. - */ - public static final GeneticAlgorithm createGeneticAlgorithm( - InterfaceMutation mut, double pm, InterfaceCrossover cross, - double pc, InterfaceSelection select, int popsize, - AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { + return theES; + } - problem.initProblem(); + /** + * This method performs a Genetic Algorithm. + * + * @param mut + * @param pm + * @param cross + * @param pc + * @param select + * @param popsize + * @param problem + * @param listener + * @return An optimization algorithm that employes an genetic algorithm. + */ + public static GeneticAlgorithm createGeneticAlgorithm( + InterfaceMutation mut, double pm, InterfaceCrossover cross, + double pc, InterfaceSelection select, int popsize, + AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { - setTemplateOperators(problem, mut, pm, cross, pc); + problem.initProblem(); - GeneticAlgorithm ga = new GeneticAlgorithm(); - ga.setProblem(problem); - ga.getPopulation().setTargetSize(popsize); - ga.setParentSelection(select); - ga.setPartnerSelection(select); - ga.addPopulationChangedEventListener(listener); - ga.init(); + setTemplateOperators(problem, mut, pm, cross, pc); - if (listener!=null) listener.registerPopulationStateChanged(ga.getPopulation(), ""); + GeneticAlgorithm ga = new GeneticAlgorithm(); + ga.setProblem(problem); + ga.getPopulation().setTargetSize(popsize); + ga.setParentSelection(select); + ga.setPartnerSelection(select); + ga.addPopulationChangedEventListener(listener); + ga.init(); - return ga; - } + if (listener != null) { + listener.registerPopulationStateChanged(ga.getPopulation(), ""); + } - /** - * This method creates a multi-objective EA optimizer. Remember to set a - * multi-objective selection method within the specific optimizer. This uses - * a standard archiving strategy (NSGAII) and InformationRetrievalInserting. - * - * @param subOpt - * the specific optimizer to use - * @param archiveSize - * maximum size of the archive - * @param problem - * @param listener - * @return An optimization algorithm that employs a multi-objective - * optimizer - */ - public static final MultiObjectiveEA createMultiObjectiveEA( - InterfaceOptimizer subOpt, int archiveSize, - AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { + return ga; + } - return createMultiObjectiveEA(subOpt, new ArchivingNSGAII(), - archiveSize, new InformationRetrievalInserting(), problem, - listener); - } + /** + * This method creates a multi-objective EA optimizer. Remember to set a + * multi-objective selection method within the specific optimizer. This uses + * a standard archiving strategy (NSGAII) and InformationRetrievalInserting. + * + * @param subOpt the specific optimizer to use + * @param archiveSize maximum size of the archive + * @param problem + * @param listener + * @return An optimization algorithm that employs a multi-objective + * optimizer + */ + public static MultiObjectiveEA createMultiObjectiveEA( + InterfaceOptimizer subOpt, int archiveSize, + AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { - public static final GOParameters standardMOGA(AbstractOptimizationProblem problem) { - GOParameters gaParams=standardGA(problem); - int archiveSize=100; - int popSize=100; - MultiObjectiveEA moga = createMultiObjectiveEA(gaParams.getOptimizer(), archiveSize, problem, null); - return makeParams(moga, popSize, problem, randSeed, makeDefaultTerminator()); - } - - /** - * This method creates a multi-objective EA optimizer. Remember to set a - * multi-objective selection method within the specific optimizer. - * - * @param subOpt - * the specific optimizer to use - * @param archiving - * the archiving strategy collecting the pareto front - * @param archiveSize - * maximum size of the archive - * @param infoRetrieval - * information retrieval strategy - * @param problem - * @param listener - * @return An optimization algorithm that employs a multi-objective - * optimizer - */ - public static final MultiObjectiveEA createMultiObjectiveEA( - InterfaceOptimizer subOpt, InterfaceArchiving archiving, - int archiveSize, InterfaceInformationRetrieval infoRetrieval, - AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { + return createMultiObjectiveEA(subOpt, new ArchivingNSGAII(), + archiveSize, new InformationRetrievalInserting(), problem, + listener); + } - problem.initProblem(); - subOpt.setProblem(problem); + /** + * This method creates a multi-objective EA optimizer. + * + * @param problem + * @return + */ + public static GOParameters standardMOGA(AbstractOptimizationProblem problem) { + GOParameters gaParams = standardGA(problem); + int archiveSize = 100; + int popSize = 100; + MultiObjectiveEA moga = createMultiObjectiveEA(gaParams.getOptimizer(), archiveSize, problem, null); + return makeParams(moga, popSize, problem, randSeed, makeDefaultTerminator()); + } - return new MultiObjectiveEA(subOpt, archiving, archiveSize, - infoRetrieval, problem); - } + /** + * This method creates a multi-objective EA optimizer. Remember to set a + * multi-objective selection method within the specific optimizer. + * + * @param subOpt the specific optimizer to use + * @param archiving the archiving strategy collecting the pareto front + * @param archiveSize maximum size of the archive + * @param infoRetrieval information retrieval strategy + * @param problem + * @param listener + * @return An optimization algorithm that employs a multi-objective + * optimizer + */ + public static MultiObjectiveEA createMultiObjectiveEA( + InterfaceOptimizer subOpt, InterfaceArchiving archiving, + int archiveSize, InterfaceInformationRetrieval infoRetrieval, + AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { - /** - * This starts a Gradient Descent. - * - * @param problem - * @return An optimization algorithm that performs gradient descent. - */ - public static final GradientDescentAlgorithm createGradientDescent( - AbstractOptimizationProblem problem) { + problem.initProblem(); + subOpt.setProblem(problem); - System.err.println("Currently not implemented!"); + return new MultiObjectiveEA(subOpt, archiving, archiveSize, + infoRetrieval, problem); + } - problem.initProblem(); + /** + * This starts a Gradient Descent. + * + * @param problem + * @return An optimization algorithm that performs gradient descent. + */ + public static GradientDescentAlgorithm createGradientDescent( + AbstractOptimizationProblem problem) { - AbstractEAIndividual tmpIndi = problem.getIndividualTemplate(); - tmpIndi.setCrossoverOperator(new NoCrossover()); - tmpIndi.setCrossoverProbability(0.0); + System.err.println("Currently not implemented!"); - GradientDescentAlgorithm gd = new GradientDescentAlgorithm(); + problem.initProblem(); - // TODO implement! + AbstractEAIndividual tmpIndi = problem.getIndividualTemplate(); + tmpIndi.setCrossoverOperator(new NoCrossover()); + tmpIndi.setCrossoverProbability(0.0); - return gd; - } + GradientDescentAlgorithm gd = new GradientDescentAlgorithm(); - /** - * This method creates a Hill Climber algorithm with a default fixed-size mutation. - * - * @param pop - * The size of the population - * @param problem - * The problem to be optimized - * @param listener - * @return An optimization procedure that performes hill climbing. - */ - public static final HillClimbing createHillClimber(int popSize, - AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { - return createHillClimber(popSize, new MutateESFixedStepSize(0.2), problem, listener); - } + // TODO implement! - /** - * This method creates a Hill Climber algorithm. - * - * @param pop - * The size of the population - * @param problem - * The problem to be optimized - * @param listener - * @return An optimization procedure that performes hill climbing. - */ - public static final HillClimbing createHillClimber(int popSize, InterfaceMutation mutator, - AbstractOptimizationProblem problem, - InterfacePopulationChangedEventListener listener) { + return gd; + } - problem.initProblem(); + /** + * This method creates a Hill Climber algorithm with a default fixed-size + * mutation. + * + * @param pop The size of the population + * @param problem The problem to be optimized + * @param listener + * @return An optimization procedure that performs hill climbing. + */ + public static HillClimbing createHillClimber(int popSize, + AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { + return createHillClimber(popSize, new MutateESFixedStepSize(0.2), problem, listener); + } - setTemplateOperators(problem, mutator, 1., new NoCrossover(), 0); + /** + * This method creates a Hill Climber algorithm. + * + * @param pop The size of the population + * @param problem The problem to be optimized + * @param listener + * @return An optimization procedure that performs hill climbing. + */ + public static HillClimbing createHillClimber(int popSize, InterfaceMutation mutator, + AbstractOptimizationProblem problem, + InterfacePopulationChangedEventListener listener) { - HillClimbing hc = new HillClimbing(); - hc.setIdentifier("-"+popSize+"-"+mutator.getStringRepresentation()); - hc.getPopulation().setTargetSize(popSize); - hc.addPopulationChangedEventListener(listener); - hc.setProblem(problem); - hc.init(); + problem.initProblem(); - if (listener != null) listener.registerPopulationStateChanged(hc.getPopulation(), ""); + setTemplateOperators(problem, mutator, 1., new NoCrossover(), 0); - return hc; - } + HillClimbing hc = new HillClimbing(); + hc.setIdentifier("-" + popSize + "-" + mutator.getStringRepresentation()); + hc.getPopulation().setTargetSize(popSize); + hc.addPopulationChangedEventListener(listener); + hc.setProblem(problem); + hc.init(); - /** - * This method performs a Monte Carlo Search with the given number of - * fitness calls. - * - * @param problem - * @param popsize - * @param listener - * @return An optimization procedure that performes the random walk. - */ - public static final MonteCarloSearch createMonteCarlo( - AbstractOptimizationProblem problem, int popsize, - InterfacePopulationChangedEventListener listener) { + if (listener != null) { + listener.registerPopulationStateChanged(hc.getPopulation(), ""); + } - problem.initProblem(); - setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0); + return hc; + } - MonteCarloSearch mc = new MonteCarloSearch(); - mc.getPopulation().setTargetSize(popsize); - mc.addPopulationChangedEventListener(listener); - mc.setProblem(problem); - mc.init(); + /** + * This method performs a Monte Carlo Search with the given number of + * fitness calls. + * + * @param problem + * @param popsize + * @param listener + * @return An optimization procedure that performes the random walk. + */ + public static MonteCarloSearch createMonteCarlo( + AbstractOptimizationProblem problem, int popsize, + InterfacePopulationChangedEventListener listener) { - if (listener != null) listener.registerPopulationStateChanged(mc.getPopulation(), ""); + problem.initProblem(); + setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0); - return mc; - } + MonteCarloSearch mc = new MonteCarloSearch(); + mc.getPopulation().setTargetSize(popsize); + mc.addPopulationChangedEventListener(listener); + mc.setProblem(problem); + mc.init(); - /** - * This method performs a particle swarm optimization. Standard topologies are - * linear, grid and star. - * - * @param problem - * @param mut - * @param popsize - * @param phi1 - * @param phi2 - * @param speedLim - * @param listener - * @param topology - * @see ParticleSwarmOpimization - * @return An optimization algorithm that performs particle swarm - * optimization. - */ - public static final ParticleSwarmOptimization createParticleSwarmOptimization( - AbstractOptimizationProblem problem, int popsize, double phi1, - double phi2, double speedLim, PSOTopologyEnum selectedTopology, int topologyRange, - InterfacePopulationChangedEventListener listener) { + if (listener != null) { + listener.registerPopulationStateChanged(mc.getPopulation(), ""); + } - problem.initProblem(); + return mc; + } - setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0); + /** + * This method performs a particle swarm optimization. Standard topologies + * are linear, grid and star. + * + * @param problem + * @param mut + * @param popsize + * @param phi1 + * @param phi2 + * @param speedLim + * @param listener + * @param topology + * @see ParticleSwarmOpimization + * @return An optimization algorithm that performs particle swarm + * optimization. + */ + public static ParticleSwarmOptimization createParticleSwarmOptimization( + AbstractOptimizationProblem problem, int popsize, double phi1, + double phi2, double speedLim, PSOTopologyEnum selectedTopology, int topologyRange, + InterfacePopulationChangedEventListener listener) { - ParticleSwarmOptimization pso = new ParticleSwarmOptimization(); - pso.setProblem(problem); - pso.getPopulation().setTargetSize(popsize); - pso.setPhi1(phi1); - pso.setPhi2(phi2); - pso.setSpeedLimit(speedLim); + problem.initProblem(); + + setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0); + + ParticleSwarmOptimization pso = new ParticleSwarmOptimization(); + pso.setProblem(problem); + pso.getPopulation().setTargetSize(popsize); + pso.setPhi1(phi1); + pso.setPhi2(phi2); + pso.setSpeedLimit(speedLim); // pso.getTopology().setSelectedTag(selectedTopology); - pso.setTopology(selectedTopology); - pso.setTopologyRange(topologyRange); - pso.addPopulationChangedEventListener(listener); - pso.init(); - - if (listener != null) listener.registerPopulationStateChanged(pso.getPopulation(), ""); - - return pso; - } - - /** - * This method performs a Simulated Annealing Optimization and prints the - * result as R output. It uses real valued individuals. The mutation - * probability is always 1.0. - * - * @param problem - * @param popsize - * @param alpha - * The parameter for the linear cooling - * @param temperature - * The initial temperature - * @param mut - * @param listener - * @return Returns an optimizer that performs simulated annealing. - */ - public static final SimulatedAnnealing createSimulatedAnnealing( - AbstractOptimizationProblem problem, int popsize, double alpha, - double temperature, InterfaceMutation mut, - InterfacePopulationChangedEventListener listener) { - - problem.initProblem(); - - setTemplateOperators(problem, mut, 1, new NoCrossover(), 0); - - SimulatedAnnealing sa = new SimulatedAnnealing(); - sa.setAlpha(alpha); - sa.setInitialTemperature(temperature); - sa.setProblem(problem); - sa.getPopulation().setTargetSize(popsize); - sa.addPopulationChangedEventListener(listener); - sa.init(); - - if (listener!=null) listener.registerPopulationStateChanged(sa.getPopulation(), ""); - - return sa; - } - - /** - * Calling init here makes problems when using the Matlab interface. - * - * @param learningRate - * @param mutateSigma - * @param mutationRate - * @param positiveSamples - * @param selection - * @param popsize - * @param problem - * @param listener - * @return - */ - public static final PopulationBasedIncrementalLearning createPBIL( - double learningRate, double mutateSigma, double mutationRate, - int positiveSamples, InterfaceSelection selection, int popsize, - AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) { - problem.initProblem(); - PopulationBasedIncrementalLearning pbil = new PopulationBasedIncrementalLearning(); - - pbil.setLearningRate(learningRate); - pbil.setMutateSigma(mutateSigma); - pbil.setMutationRate(mutationRate); - pbil.setPopulation(new PBILPopulation(popsize)); - pbil.setSelectionMethod(selection); - pbil.setPositiveSamples(positiveSamples); - - pbil.addPopulationChangedEventListener(listener); - pbil.setProblem(problem); - - if (listener != null) listener.registerPopulationStateChanged(pbil.getPopulation(), ""); - - return pbil; - } - - // /////////////////////////// Termination criteria - public static InterfaceTerminator makeDefaultTerminator() { - return new EvaluationTerminator(defaultFitCalls); - } - - /** - * The default Terminator finishes after n fitness calls, the default n is - * returned here. - * - * @return the default number of fitness call done before termination - */ - public static final int getDefaultFitCalls() { - return defaultFitCalls; - } - - // /////////////////////////// constructing a default OptimizerRunnable - - /** - * For an optimizer identifier, return the corresponding default parameter set including - * initialization (thats why the problem is required). - * - * @param optType optimizer identifier - * @param problem corresponding optimization problem - */ - public static GOParameters getParams(final int optType, - AbstractOptimizationProblem problem) { - switch (optType) { - case STD_ES: - return standardES(problem); - case CMA_ES: - return cmaES(problem); - case STD_GA: - return standardGA(problem); - case PSO: - return standardPSO(problem); - case DE: - return standardDE(problem); - case TRIBES: - return tribes(problem); - case RANDOM: - return monteCarlo(problem); - case HILLCL: - return hillClimbing(problem); - case CBN_ES: - return standardCbnES(problem); - case CL_HILLCL: - return stdClusteringHillClimbing(problem); - case CMA_ES_IPOP: - return cmaESIPOP(problem); - case CBN_GA: - return standardCbnGA(problem); - case PBIL: - return standardPBIL(problem); - case MOGA: - return standardMOGA(problem); - default: - System.err.println("Error: optimizer type " + optType - + " is unknown!"); - return null; - } - } - - /** - * Return a simple String showing the accessible optimizers. For external - * access." - * - * @return a String listing the accessible optimizers - */ - public static String showOptimizers() { - return STD_ES+": Standard ES \n"+ CMA_ES+ ": CMA-ES \n"+ STD_GA+ ": GA \n"+ PSO + ": PSO \n"+ DE + ": DE \n"+ TRIBES + ": Tribes \n"+ RANDOM + ": Random (Monte Carlo) " - + "\n"+ HILLCL + ": Hill-Climbing \n"+ CBN_ES + ": Cluster-based niching ES \n"+ CL_HILLCL + ": Clustering Hill-Climbing \n"+ CMA_ES_IPOP + ": IPOP-CMA-ES " - + "\n"+ CBN_GA + ": Cluster-based niching GA \n"+ PBIL + ": PBIL \n"+ MOGA + ": MOGA, a Multi-Objective Genetic Algorithm"; - } - - /** - * Produce a runnable optimizer from a strategy identifier, a problem instance and with a given - * number of fitness calls to be performed. Output is written to a file if the prefix String is given. - * - * @param optType - * @param problem - * @param fitCalls - * @param outputFilePrefix - * @return a runnable optimizer - */ - public static OptimizerRunnable getOptRunnable(final int optType, - AbstractOptimizationProblem problem, int fitCalls, - String outputFilePrefix) { - return getOptRunnable(optType, problem, new EvaluationTerminator(fitCalls), outputFilePrefix); - } - - /** - * Produce a runnable optimizer from a strategy identifier, a problem instance and with a given - * terminator. Output is written to a file if the prefix String is given. If the terminator is null - * the current user-defined terminator will be used and if none is set, the default number of fitness - * calls will be performed. - * - * @param optType - * @param problem - * @param terminator - * @param outputFilePrefix - * @return a runnable optimizer - */ - public static OptimizerRunnable getOptRunnable(final int optType, - AbstractOptimizationProblem problem, InterfaceTerminator terminator, - String outputFilePrefix) { - OptimizerRunnable opt = null; - GOParameters params = getParams(optType, problem); - if (params != null) { - opt = new OptimizerRunnable(params, outputFilePrefix); - if (terminator != null) opt.getGOParams().setTerminator(terminator); - else opt.getGOParams().setTerminator(getTerminator()); - } - return opt; - } - - /** - * Produce a runnable optimizer from a GOParameters instance. Output is written to a file if the - * prefix String is given. - * - * @param params - * @param outputFilePrefix - * @return a runnable optimizer - */ - public static OptimizerRunnable getOptRunnable(GOParameters params, String outputFilePrefix) { - return new OptimizerRunnable(params, outputFilePrefix); - } - - // /////////////////////////// constructing a default OptimizerRunnable - /** - * Produce a runnable optimizer from a strategy identifier, a problem instance and with the current - * static terminator in use. Output is written to a file if the prefix String is given. - * @see #getOptRunnable(int, AbstractOptimizationProblem, int, String) - * @param optType - * @param problem - * @param outputFilePrefix - * @return a runnable optimizer - */ - public static OptimizerRunnable getOptRunnable(final int optType, - AbstractOptimizationProblem problem, String outputFilePrefix) { - return getOptRunnable(optType, problem, getTerminator(), outputFilePrefix); - } - - /** - * Return the current user-defined terminator or, if none was set, the default terminator. - * - * @return the current default terminator - */ - public static InterfaceTerminator getTerminator() { - if (OptimizerFactory.userTerm != null) return OptimizerFactory.userTerm; - else return makeDefaultTerminator(); - } - - /** - * Return the number of evaluations performed during the last run or -1 if unavailable. - * - * @return the number of evaluations performed during the last run or -1 - */ - public static int lastEvalsPerformed() { - return (lastRunnable != null) ? lastRunnable.getProgress() : -1; - } - - // /////////////////////// Creating default strategies - - /** - * Use lambda, default random seed and terminator to produce GOParameters. - * - * @param es - * @param problem - * @return - */ - public static GOParameters makeESParams(EvolutionStrategies es, - AbstractOptimizationProblem problem) { - return makeParams(es, es.getLambda(), problem, randSeed, getTerminator()); - } - - /** - * Use default random seed and terminator for a parameter set. - * - * @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem, long, InterfaceTerminator) - * @param opt - * @param popSize - * @param problem - * @return - */ - public static GOParameters makeParams(InterfaceOptimizer opt, int popSize, AbstractOptimizationProblem problem) { - return makeParams(opt, popSize, problem, randSeed, getTerminator()); - } - - /** - * Use default random seed and the population size of the optimizer. - * - * @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem, long, InterfaceTerminator) - * @param opt - * @param popSize - * @param problem - * @return - */ - public static GOParameters makeParams(InterfaceOptimizer opt, AbstractOptimizationProblem problem, InterfaceTerminator term) { - return makeParams(opt, opt.getPopulation().getTargetSize(), problem, randSeed, term); - } - /** - * Set the population size, initialize the population and return a parameter structure containing all - * given parts. - * - * @see #makeParams(InterfaceOptimizer, Population, AbstractOptimizationProblem, long, InterfaceTerminator) - * @param opt - * @param popSize - * @param problem - * @param seed - * @param term - * @return - */ - public static GOParameters makeParams(InterfaceOptimizer opt, - int popSize, AbstractOptimizationProblem problem, long seed, - InterfaceTerminator term) { - Population pop = new Population(popSize); - RNG.setRandomSeed(seed); - problem.initPopulation(pop); - return makeParams(opt, pop, problem, seed, term); - } - - /** - * Create a GOParameters instance and prepare it with the given arguments. The result can be - * modified and then used to create an OptimizerRunnable, which of course can simply be run. - * - * @see OptimizerRunnable - * @param opt - * @param pop - * @param problem - * @param seed - * @param term - * @return - */ - public static GOParameters makeParams(InterfaceOptimizer opt, - Population pop, AbstractOptimizationProblem problem, long seed, - InterfaceTerminator term) { - GOParameters params = new GOParameters(); - params.setProblem(problem); - opt.setProblem(problem); - opt.setPopulation(pop); - params.setOptimizer(opt); - params.setTerminator(term); - params.setSeed(seed); - return params; - } - - public static OptimizerRunnable optimize(final int optType, - AbstractOptimizationProblem problem, String outputFilePrefix) { - return optimize(getOptRunnable(optType, problem, outputFilePrefix)); - } - - public static OptimizerRunnable optimize(OptimizerRunnable runnable) { - if (runnable == null) - return null; - new Thread(runnable).run(); - lastRunnable = runnable; - return runnable; - } - - /** - * Create a runnable optimization Runnable and directly start it in an own - * thread. The Runnable will notify waiting threads and set the isFinished - * flag when the optimization is complete. If the optType is invalid, null - * will be returned. - * - * @param optType - * @param problem - * @param outputFilePrefix - * @return the OptimizerRunnable instance just started - */ - public static OptimizerRunnable optimizeInThread(final int optType, AbstractOptimizationProblem problem, String outputFilePrefix) { - return optimizeInThread(getOptRunnable(optType, problem, outputFilePrefix)); - } - - /** - * Create a runnable optimization Runnable and directly start it in an own - * thread. The Runnable will notify waiting threads and set the isFinished - * flag when the optimization is complete. If the optType is invalid, null - * will be returned. - * - * @param params - * @param outputFilePrefix - * @return the OptimizerRunnable instance just started - */ - public static OptimizerRunnable optimizeInThread(GOParameters params, String outputFilePrefix) { - return optimizeInThread(new OptimizerRunnable(params, outputFilePrefix)); - } - - /** - * Start a runnable optimizer in a concurrent thread. - * @param runnable - * @return the started runnable - */ - public static OptimizerRunnable optimizeInThread(OptimizerRunnable runnable) { - if (runnable != null) { - new Thread(runnable).start(); - lastRunnable = runnable; - } - return runnable; - } - - // ///////////////////////////// Optimize a given parameter instance - public static BitSet optimizeToBinary(GOParameters params, - String outputFilePrefix) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, - outputFilePrefix)); - return runnable.getBinarySolution(); - } - - // ///////////////////////////// Optimize using a default strategy - public static BitSet optimizeToBinary(final int optType, - AbstractOptimizationProblem problem) { - return optimizeToBinary(optType, problem, null); - } - - // ///////////////////////////// Optimize using a default strategy - public static BitSet optimizeToBinary(final int optType, - AbstractOptimizationProblem problem, String outputFilePrefix) { - OptimizerRunnable runnable = optimize(optType, problem, - outputFilePrefix); - return (runnable != null) ? runnable.getBinarySolution() : null; - } - - // ///////////////////////////// Optimize a given runnable - public static BitSet optimizeToBinary(OptimizerRunnable runnable) { - optimize(runnable); - return (runnable != null) ? runnable.getBinarySolution() : null; - } - - public static double[] optimizeToDouble(GOParameters params, - String outputFilePrefix) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, - outputFilePrefix)); - return runnable.getDoubleSolution(); - } - - public static double[] optimizeToDouble(GOParameters params) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, - false)); - return runnable.getDoubleSolution(); - } - - public static double[] optimizeToDouble(GOParameters params,InterfaceStatistics stats) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params,stats, - false)); - return runnable.getDoubleSolution(); - } - - public static double[] optimizeToDouble(final int optType, - AbstractOptimizationProblem problem) { - return optimizeToDouble(optType, problem, null); - } - - public static double[] optimizeToDouble(final int optType, - AbstractOptimizationProblem problem, String outputFilePrefix) { - OptimizerRunnable runnable = optimize(optType, problem, - outputFilePrefix); - return (runnable != null) ? runnable.getDoubleSolution() : null; - } - - public static double[] optimizeToDouble(OptimizerRunnable runnable) { - optimize(runnable); - return (runnable != null) ? runnable.getDoubleSolution() : null; - } - - - public static IndividualInterface optimizeToInd(GOParameters params) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, - false)); - return runnable.getResult(); - } - - public static IndividualInterface optimizeToInd(GOParameters params, - String outputFilePrefix) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, - outputFilePrefix)); - return runnable.getResult(); - } - - public static IndividualInterface optimizeToInd(final int optType, - AbstractOptimizationProblem problem) { - return optimizeToInd(optType, problem, null); - } - - public static IndividualInterface optimizeToInd(final int optType, - AbstractOptimizationProblem problem, String outputFilePrefix) { - OptimizerRunnable runnable = optimize(optType, problem, - outputFilePrefix); - return (runnable != null) ? runnable.getResult() : null; - } - - public static IndividualInterface optimizeToInd(OptimizerRunnable runnable) { - optimize(runnable); - return (runnable != null) ? runnable.getResult() : null; - } - - public static Population optimizeToPop(GOParameters params, - String outputFilePrefix) { - OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, - outputFilePrefix)); - return runnable.getResultPopulation(); - } - - public static Population optimizeToPop(final int optType, - AbstractOptimizationProblem problem, String outputFilePrefix) { - OptimizerRunnable runnable = optimize(optType, problem, - outputFilePrefix); - return (runnable != null) ? runnable.getResultPopulation() : null; - } - - public static Population optimizeToPop(OptimizerRunnable runnable) { - optimize(runnable); - return (runnable != null) ? runnable.getResultPopulation() : null; - } - - ///////////////////////////// post processing - - public static Population postProcess(PostProcessMethod method, int steps, double sigma, int nBest) { - return (lastRunnable == null) ? null : postProcess(lastRunnable, - new PostProcessParams(method, steps, sigma, nBest)); - } - - public static Population postProcess(InterfacePostProcessParams ppp) { - return (lastRunnable == null) ? null : postProcess(lastRunnable, ppp); - } - - /** - * Post process the given runnable with given parameters. The runnable will - * not be stored. - * - * @param runnable - * @param steps - * @param sigma - * @param nBest - * @return - */ - public static Population postProcess(OptimizerRunnable runnable, int steps, - double sigma, int nBest) { - PostProcessParams ppp = new PostProcessParams(steps, sigma, nBest); - return postProcess(runnable, ppp); - } - - /** - * Post process the given runnable with given parameters. The runnable will - * not be stored. - * - * @param runnable - * @param ppp - * @return - */ - public static Population postProcess(OptimizerRunnable runnable, - InterfacePostProcessParams ppp) { - runnable.setDoRestart(true); - runnable.setDoPostProcessOnly(true); - runnable.setPostProcessingParams(ppp); - runnable.run(); // this run will not set the lastRunnable - - // postProcessing - // starts always anew - return runnable.getResultPopulation(); - } - - public static List postProcessBinVec(int steps, double sigma, - int nBest) { - return (lastRunnable != null) ? postProcessBinVec(lastRunnable, - new PostProcessParams(steps, sigma, nBest)) : null; - } - - public static List postProcessBinVec( - InterfacePostProcessParams ppp) { - return (lastRunnable != null) ? postProcessBinVec(lastRunnable, ppp) - : null; - } - - public static List postProcessBinVec(OptimizerRunnable runnable, - int steps, double sigma, int nBest) { - return postProcessBinVec(runnable, new PostProcessParams(steps, sigma, - nBest)); - } - - /** - * Post process the given runnable with given parameters. Return the solution set - * as a vector of BitSets. The runnable will not be stored. - * - * @param runnable - * @param ppp - * @return - */ - public static List postProcessBinVec(OptimizerRunnable runnable, - InterfacePostProcessParams ppp) { - Population resPop = postProcess(runnable, ppp); - List ret = new ArrayList(resPop.size()); - for (Object o : resPop) { - if (o instanceof InterfaceDataTypeBinary) { - InterfaceDataTypeBinary indy = (InterfaceDataTypeBinary) o; - ret.add(indy.getBinaryData()); - } - } - return ret; - } - - public static List postProcessDblVec(int steps, double sigma, - int nBest) { - return (lastRunnable == null) ? null : postProcessDblVec(lastRunnable, - new PostProcessParams(steps, sigma, nBest)); - } - - public static List postProcessDblVec( - InterfacePostProcessParams ppp) { - return (lastRunnable != null) ? postProcessDblVec(lastRunnable, ppp) - : null; - } - - public static List postProcessDblVec( - OptimizerRunnable runnable, int steps, double sigma, int nBest) { - return postProcessDblVec(runnable, new PostProcessParams(steps, sigma, - nBest)); - } - - /** - * Post process the given runnable with given parameters. Return the solution set - * as a vector of double arrays. The runnable will not be stored. - * - * @param runnable - * @param ppp - * @return - */ - public static List postProcessDblVec( - OptimizerRunnable runnable, InterfacePostProcessParams ppp) { - Population resPop = postProcess(runnable, ppp); - List ret = new ArrayList(resPop.size()); - for (Object o : resPop) { - if (o instanceof InterfaceDataTypeDouble) { - InterfaceDataTypeDouble indy = (InterfaceDataTypeDouble) o; - ret.add(indy.getDoubleData()); - } - } - return ret; - } - - public static List postProcessIndVec(int steps, - double sigma, int nBest) { - return (lastRunnable != null) ? postProcessIndVec(lastRunnable, - new PostProcessParams(steps, sigma, nBest)) : null; - } - - public static List postProcessIndVec( - InterfacePostProcessParams ppp) { - return (lastRunnable != null) ? postProcessIndVec(lastRunnable, ppp) - : null; - } - - public static List postProcessIndVec( - OptimizerRunnable runnable, int steps, double sigma, int nBest) { - return postProcessIndVec(runnable, new PostProcessParams(steps, sigma, - nBest)); - } - - /** - * Post process the given runnable with given parameters. Return the solution set - * as a vector of AbstractEAIndividuals. The runnable will not be stored. - * - * @param runnable - * @param ppp - * @return - */ - public static List postProcessIndVec( - OptimizerRunnable runnable, InterfacePostProcessParams ppp) { - Population resPop = postProcess(runnable, ppp); - List ret = new ArrayList( - resPop.size()); - for (Object o : resPop) { - if (o instanceof AbstractEAIndividual) { - AbstractEAIndividual indy = (AbstractEAIndividual) o; - ret.add(indy); - } - } - return ret; - } - - ///////////////////////////// termination management - /** - * Replace the current user-defined terminator by the given one. - * - * @param term - */ - public static void setTerminator(InterfaceTerminator term) { - OptimizerFactory.userTerm = term; - } - - /** - * Add a new InterfaceTerminator to the current user-defined optimizer in a boolean combination. - * The old and the given terminator will be combined as in (TOld && TNew) if - * bAnd is true, and as in (TOld || TNew) if bAnd is false. - * If there was no user-defined terminator (or it was set to null) the new one is used without conjunction. - * - * @param newTerm - * a new InterfaceTerminator instance - * @param bAnd - * indicate the boolean combination - */ - public static void addTerminator(InterfaceTerminator newTerm, boolean bAnd) { - if (OptimizerFactory.userTerm == null) - OptimizerFactory.userTerm = newTerm; - else - setTerminator(new CombinedTerminator(OptimizerFactory.userTerm, - newTerm, bAnd)); - } - - /** - * Convenience method setting an EvaluationTerminator with the given - * number of evaluations. - * - * @param maxEvals - */ - public static void setEvaluationTerminator(int maxEvals) { - setTerminator(new EvaluationTerminator(maxEvals)); - } - - /** - * Return the termination message of the last runnable, if available. - * @return - */ - public static String terminatedBecause() { - return (lastRunnable != null) ? lastRunnable.terminatedBecause() : null; - } - - ///////////////////////////// default parameters - /** - * Create a standard multi-start hill-climber parameter set with 50 initial individuals. - * - * @return a standard multi-start hill-climber - */ - public static final GOParameters hillClimbing( - AbstractOptimizationProblem problem) { - return hillClimbing(problem, 50); - } - - /** - * Create a standard multi-start hill-climber parameter set with the given number of - * individuals. - * - * @return a standard multi-start hill-climber - */ - public static final GOParameters hillClimbing( - AbstractOptimizationProblem problem, int popSize) { - return makeParams(new HillClimbing(), popSize, problem, randSeed, getTerminator()); - } - - public static final GOParameters monteCarlo( - AbstractOptimizationProblem problem) { - return makeParams(new MonteCarloSearch(), 50, problem, randSeed, getTerminator()); - } - - /** - * Create a generic Clustering-based Niching EA with given parameters. Uses ClusteringDensityBased as - * a default clustering algorithm. - * - * @param problem - * @param opt - * @param clusterSigma - * @param minClustSize - * @param haltingWindowLength - * @param haltingWindowEpsilon - * @param popSize - * @return - */ - public static final GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt, - double clusterSigma, int minClustSize, int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) { - return createCbn(problem, opt, new ClusteringDensityBased(clusterSigma, minClustSize), maxSpecSize, - new ClusteringDensityBased(clusterSigma, minClustSize), haltingWindowLength, haltingWindowEpsilon, popSize); - } - - /** - * A standard CBNPSO with density based clustering working on personal best positions. - * - * @param problem - * @return - */ - public static final GOParameters standardCbnPSO(AbstractOptimizationProblem problem) { - return createCbnPSO(problem, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, - cbnDefaultHaltingWindowLength , cbnDefaultHaltingWindowEpsilon, 100 ); - } - - public static final GOParameters createCbnPSO(AbstractOptimizationProblem problem, double clusterSigma, int minClustSize, - int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize ) { - GOParameters psoParams = standardPSO(problem); - ParticleSwarmOptimization pso = (ParticleSwarmOptimization)psoParams.getOptimizer(); - ClusteringDensityBased clust = new ClusteringDensityBased(clusterSigma, minClustSize, - new IndividualDataMetric(ParticleSwarmOptimization.partBestPosKey)); - return createCbn(problem, pso, clust, maxSpecSize, new ClusteringDensityBased(clust), - haltingWindowLength, haltingWindowEpsilon, popSize); - } - - /** - * Create a generic Clustering-based Niching EA with given parameters. - * - * @param problem - * @param opt - * @param clustDifferentiate - * @param clustMerge - * @param haltingWindowLength - * @param haltingWindowEpsilon - * @param popSize - * @return - */ - public static final GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt, - InterfaceClustering clustDifferentiate, int maxSpecSize, InterfaceClustering clustMerge, int haltingWindowLength, - double haltingWindowEpsilon, int popSize) { - ClusterBasedNichingEA cbn = new ClusterBasedNichingEA(); - cbn.setOptimizer(opt); - cbn.setMergingCA(clustMerge); - cbn.setMaxSpeciesSize(maxSpecSize); - cbn.setDifferentiationCA(clustDifferentiate); - if (clustMerge!=null) cbn.setUseMerging(true); - cbn.setShowCycle(0); // don't do graphical output - cbn.setHaltingWindow(haltingWindowLength); - cbn.setEpsilonBound(haltingWindowEpsilon); - return makeParams(cbn, popSize, problem, randSeed, getTerminator()); - } - - /** - * A standard CBNES which employs a (15,50)-ES with further parameters as set by the EvA2 framework. - * - * @param problem - * @return - */ - public static final GOParameters standardCbnES(AbstractOptimizationProblem problem) { - EvolutionStrategies es = new EvolutionStrategies(); - es.setMu(15); - es.setLambda(50); - es.setPlusStrategy(false); - return createCbn(problem, es, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); - } - - /** - * A standard CBNES which employs a CMA-ES, see {@link #cmaES(AbstractOptimizationProblem)}. - * - * @param problem - * @return - */ - public static final GOParameters standardCbnCmaES(AbstractOptimizationProblem problem) { - GOParameters cmaEsParams = cmaES(problem); - EvolutionStrategies cmaES = (EvolutionStrategies)cmaEsParams.getOptimizer(); - return createCbn(problem, cmaES, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); - } - - /** - * A standard CBNGA with a GA and further parameters as set by the EvA2 framework. - * @param problem - * @return - */ - public static final GOParameters standardCbnGA(AbstractOptimizationProblem problem) { - GeneticAlgorithm ga = new GeneticAlgorithm(); - return createCbn(problem, ga, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); - } - - public static final GOParameters standardPBIL(AbstractOptimizationProblem problem) { - PopulationBasedIncrementalLearning pbil = createPBIL(0.04, 0.01, 0.5, 1, - new SelectBestIndividuals(), 50, problem, null); - - return makeParams(pbil, pbil.getPopulation(), problem, randSeed, getTerminator()); - } - - /** - * Create a standard clustering hill climbing employing simple ES mutation with adaptive - * step size, starting in parallel 100 local searches and clustering intermediate populations - * to avoid optima being found several times by the same population (density based clustering with - * sigma = 0.05). - * The population is reinitialized if the average progress of one cycle does not exceed 1e-6. - * - * @param problem - * @return - */ - public static final GOParameters stdClusteringHillClimbing( - AbstractOptimizationProblem problem) { - return clusteringHillClimbing(problem, 1000, 100, 0.000001, - PostProcessMethod.hillClimber, 0.05, 0.000001, 0.05); - } - - /** - * Create a clustering hillclimber using nelder mead and additional given parameters. - * - * @param problem - * @param evalCycle - * @param popSize - * @param minImprovement - * @param method - * @param sigmaClust - * @return - */ - public static final GOParameters clusteringHillClimbingNM(AbstractOptimizationProblem problem, - int evalCycle, int popSize, double minImprovement, double sigmaClust) { - return clusteringHillClimbing(problem, evalCycle, popSize, minImprovement, - PostProcessMethod.nelderMead, 0.01, 0.00000001, sigmaClust); - } - - /** - * Create a custom clustering hillclimber using ES mutation (simple or CMA) or nelder mead. - * The parameters hcInitialStep and hcStepThresh are - * only relevant for the simple mutation based hc method. - * - * @param problem - * @param evalCycle - * @param popSize - * @param minImprovement - * @param method - * @param hcInitialStep - * @param hcStepThresh - * @param sigmaClust - * @return - */ - public static final GOParameters clusteringHillClimbing( - AbstractOptimizationProblem problem, int evalCycle, int popSize, double minImprovement, - PostProcessMethod method, double hcInitialStep, double hcStepThresh, double sigmaClust) { - ClusteringHillClimbing chc = new ClusteringHillClimbing(); - chc.setProblem(problem); - - chc.setEvalCycle(evalCycle); - chc.setInitialPopSize(popSize); - chc.setStepSizeInitial(hcInitialStep); - chc.setLocalSearchMethod(method); - chc.setMinImprovement(minImprovement); - chc.setNotifyGuiEvery(0); - chc.setStepSizeThreshold(hcStepThresh); - chc.setSigmaClust(sigmaClust); - return makeParams(chc, popSize, problem, randSeed, getTerminator()); - } - - - public static final GOParameters cmaES(AbstractOptimizationProblem problem) { - EvolutionStrategies es = new EvolutionStrategies(); - es.setMu(15); - es.setLambda(50); - es.setPlusStrategy(false); - - if (assertIndyType(problem,InterfaceESIndividual.class)) { - setTemplateOperators(problem, new MutateESCovarianceMatrixAdaption(true), 1, new CrossoverESDefault(), 0); - } else { - System.err.println("Error, CMA-ES is implemented for ES individuals only (requires double data types)"); - return null; - } - - return makeESParams(es, problem); - } - - /** - * Create a new IPOP-CMA-ES strategy with Rank-mu-CMA. The population size is set to - * lambda = (int) (4.0 + 3.0 * Math.log(dim)) and mu = Math.floor(lambda/2.), but - * lambda may grow during optimization due to restarts with increased lambda. - * Operator probabilities are set to p_mut = 1 and p_c = 0. - * The given problem must work with an individual template which implements - * InterfaceDataTypeDouble. - * - * @param problem the optimization problem - * @return - */ - public static final GOParameters cmaESIPOP(AbstractOptimizationProblem problem) { - return createCmaEsIPop(problem, 2.); - } - - public static final GOParameters createCmaEsIPop(AbstractOptimizationProblem problem, double incLambdaFact) { - EvolutionStrategies es = new EvolutionStrategyIPOP(); - - AbstractEAIndividual indyTemplate = problem.getIndividualTemplate(); - if ((indyTemplate != null) && ((indyTemplate instanceof InterfaceESIndividual) || (indyTemplate instanceof InterfaceDataTypeDouble))) { - // set selection strategy - int dim; - if (indyTemplate instanceof InterfaceESIndividual) dim=((InterfaceESIndividual)indyTemplate).getDGenotype().length; - else dim = ((InterfaceDataTypeDouble)indyTemplate).getDoubleData().length; - int lambda = (int) (4.0 + 3.0 * Math.log(dim)); - es.setGenerationStrategy((int)Math.floor(lambda/2.),lambda, false); - es.setForceOrigPopSize(false); - ((EvolutionStrategyIPOP)es).setIncPopSizeFact(incLambdaFact); - // Set CMA operator for mutation - AbstractEAIndividual indy = (AbstractEAIndividual) indyTemplate; - MutateESRankMuCMA cmaMut = new MutateESRankMuCMA(); - AbstractEAIndividual.setOperators(indy, cmaMut, 1., new CrossoverESDefault(), 0.); - } else { - System.err.println("Error, CMA-ES is implemented for ES individuals only (requires double data types)"); - return null; - } - - return makeESParams(es, problem); - } - - public static final GOParameters standardNMS(AbstractOptimizationProblem problem) { - NelderMeadSimplex nms = NelderMeadSimplex.createNelderMeadSimplex(problem, null); - return makeParams(nms, 50, problem, randSeed, getTerminator()); - } - - /** - * This constructs a standard DE variant with current-to-best/1 scheme, F=0.8, - * k=0.6, lambda=0.6. The population size is 50 by default. - * @param problem - * @return - */ - public static final GOParameters standardDE( - AbstractOptimizationProblem problem) { - DifferentialEvolution de = new DifferentialEvolution(); - de.setDEType(DETypeEnum.DE2_CurrentToBest); // this sets current-to-best - de.setF(0.8); - de.setK(0.6); - de.setLambda(0.6); - de.setMt(0.05); // this is not really employed for currentToBest - return makeParams(de, 50, problem, randSeed, getTerminator()); - } - - public static final GOParameters standardES( - AbstractOptimizationProblem problem) { - EvolutionStrategies es = new EvolutionStrategies(); - es.setMu(15); - es.setLambda(50); - es.setPlusStrategy(false); - - if (assertIndyType(problem,InterfaceESIndividual.class)) { - setTemplateOperators(problem, new MutateESGlobal(0.2, MutateESCrossoverTypeEnum.intermediate), 0.9, new CrossoverESDefault(), 0.2); - } else { - System.err.println("Error, standard ES is implemented for ES individuals only (requires double data types)"); - return null; - } - return makeESParams(es, problem); - } - - public static final GOParameters standardGA( - AbstractOptimizationProblem problem) { - GeneticAlgorithm ga = new GeneticAlgorithm(); - ga.setElitism(true); - - return makeParams(ga, 100, problem, randSeed, getTerminator()); - } - - /** - * A standard constricted PSO instance with phi1=phi2=2.05, grid topology of range 1 and - * a population size of 30. The chi parameter is set to approx. 0.73 automatically. - * @param problem - * @return - */ - public static final GOParameters standardPSO( - AbstractOptimizationProblem problem) { - ParticleSwarmOptimization pso = new ParticleSwarmOptimization(); - pso.setPhiValues(2.05, 2.05); -// pso.getTopology().setSelectedTag("Grid"); - pso.setTopology(PSOTopologyEnum.grid); - pso.setTopologyRange(1); - return makeParams(pso, 30, problem, randSeed, getTerminator()); - } - - public static final GOParameters tribes(AbstractOptimizationProblem problem) { - return makeParams(new Tribes(), 1, problem, randSeed, getTerminator()); - } - - /** - * A standard niching ES which employs predefined values and standard ES variation operators. - * - * @param problem - * @return - */ - public static final GOParameters standardNichingEs(AbstractOptimizationProblem prob) { - // nichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, - return createNichingEs(prob, -1, 100, 100, - // int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) { - 10, 200, 0, 100, 50); - } - - /** - * A niching ES. - * - * @param problem - * @return - */ - public static final GOParameters createNichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) { - EsDpiNiching nes = new EsDpiNiching(nicheRadius, muPerPeak, lambdaPerPeak, expectedPeaks, rndImmigrants, explorerPeaks, resetExplInterval, etaPresel); - - if (assertIndyType(prob, InterfaceESIndividual.class)) { - setTemplateOperators(prob, new MutateESGlobal(0.2, MutateESCrossoverTypeEnum.intermediate), 0.9, new CrossoverESDefault(), 0.2); - } else { - System.err.println("Error, standard ES is implemented for ES individuals only (requires double data types)"); - return null; - } - // pop. size will be ignored by nes - return makeParams(nes, 100, prob, randSeed, getTerminator()); - } - - /** - * This actually employs the rank-mu CMA operator. - * - * @param prob - * @return - */ - public static GOParameters standardNichingCmaEs(AbstractOptimizationProblem prob) { - return createNichingCmaEs(prob, -1, 10, 10, 0, 0, -1); - } - - /** - * This actually employs the rank-mu CMA operator. - * - * @param prob - * @return - */ - public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRad) { - return createNichingCmaEs(prob, nicheRad, 10, 10, 0, 0, -1); - } - - /** - * This actually employs the rank-mu CMA operator. - * - * @param prob - * @return - */ - public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRad, double stagnationEpsilon) { - return createNichingCmaEs(prob, nicheRad, 10, 10, 0, 0, stagnationEpsilon); - } - - /** - * This actually employs the rank-mu CMA operator. - * - * @param prob - * @return - */ - public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRad, int nicheCount, double stagnationEpsilon) { - return createNichingCmaEs(prob, nicheRad, 10, nicheCount, 0, 0, stagnationEpsilon); - } - - /** - * A generic niching CMA-ES using the rank-mu CMA operator - * @param prob - * @param nicheRadius - * @param lambda - * @param expectedPeaks - * @param explorerPeaks - * @param resetExplInterval - * @return - */ - public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRadius, int lambda, int expectedPeaks, int explorerPeaks, int resetExplInterval, double stagnationEpsilon) { - EsDpiNiching nes = new EsDpiNichingCma(nicheRadius, lambda, expectedPeaks, explorerPeaks, resetExplInterval); - if (stagnationEpsilon>0) nes.setEpsilonBound(stagnationEpsilon); - - if (assertIndyType(prob, InterfaceESIndividual.class)) { - setTemplateOperators(prob, new MutateESRankMuCMA(), 1., new CrossoverESDefault(), 0.); - } else { - System.err.println("Error, standard ES is implemented for ES individuals only (requires double data types)"); - return null; - } - // pop. size will be ignored by nes - return makeParams(nes, 100, prob, randSeed, getTerminator()); - } - - /** - * Check if a given problem instance has a template individual matching the given class. - * - * @param prob - * @param cls - * @return - */ - private static boolean assertIndyType(AbstractOptimizationProblem prob, - Class cls) { - return cls.isAssignableFrom(prob.getIndividualTemplate().getClass()); - } - - /** - * Set the evolutionary operators of the individual template of the given problem instance. - * @param prob - * @param mute - * @param pMut - * @param cross - * @param pCross - */ - public static void setTemplateOperators(AbstractOptimizationProblem prob, InterfaceMutation mute, double pMut, InterfaceCrossover cross, double pCross) { - AbstractEAIndividual indy = prob.getIndividualTemplate(); - if ((indy != null)) { - indy.setOperators(mute, pMut, cross, pCross); - } - } + pso.setTopology(selectedTopology); + pso.setTopologyRange(topologyRange); + pso.addPopulationChangedEventListener(listener); + pso.init(); + + if (listener != null) { + listener.registerPopulationStateChanged(pso.getPopulation(), ""); + } + + return pso; + } + + /** + * This method performs a Simulated Annealing Optimization and prints the + * result as R output. It uses real valued individuals. The mutation + * probability is always 1.0. + * + * @param problem + * @param popsize + * @param alpha The parameter for the linear cooling + * @param temperature The initial temperature + * @param mut + * @param listener + * @return Returns an optimizer that performs simulated annealing. + */ + public static SimulatedAnnealing createSimulatedAnnealing( + AbstractOptimizationProblem problem, int popsize, double alpha, + double temperature, InterfaceMutation mut, + InterfacePopulationChangedEventListener listener) { + + problem.initProblem(); + + setTemplateOperators(problem, mut, 1, new NoCrossover(), 0); + + SimulatedAnnealing sa = new SimulatedAnnealing(); + sa.setAlpha(alpha); + sa.setInitialTemperature(temperature); + sa.setProblem(problem); + sa.getPopulation().setTargetSize(popsize); + sa.addPopulationChangedEventListener(listener); + sa.init(); + + if (listener != null) { + listener.registerPopulationStateChanged(sa.getPopulation(), ""); + } + + return sa; + } + + /** + * Calling init here makes problems when using the Matlab interface. + * + * @param learningRate + * @param mutateSigma + * @param mutationRate + * @param positiveSamples + * @param selection + * @param popsize + * @param problem + * @param listener + * @return + */ + public static PopulationBasedIncrementalLearning createPBIL( + double learningRate, double mutateSigma, double mutationRate, + int positiveSamples, InterfaceSelection selection, int popsize, + AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) { + problem.initProblem(); + PopulationBasedIncrementalLearning pbil = new PopulationBasedIncrementalLearning(); + + pbil.setLearningRate(learningRate); + pbil.setMutateSigma(mutateSigma); + pbil.setMutationRate(mutationRate); + pbil.setPopulation(new PBILPopulation(popsize)); + pbil.setSelectionMethod(selection); + pbil.setPositiveSamples(positiveSamples); + + pbil.addPopulationChangedEventListener(listener); + pbil.setProblem(problem); + + if (listener != null) { + listener.registerPopulationStateChanged(pbil.getPopulation(), ""); + } + + return pbil; + } + + // /////////////////////////// Termination criteria + public static InterfaceTerminator makeDefaultTerminator() { + return new EvaluationTerminator(defaultFitCalls); + } + + /** + * The default Terminator finishes after n fitness calls, the default n is + * returned here. + * + * @return the default number of fitness call done before termination + */ + public static final int getDefaultFitCalls() { + return defaultFitCalls; + } + + // /////////////////////////// constructing a default OptimizerRunnable + /** + * For an optimizer identifier, return the corresponding default parameter + * set including initialization (thats why the problem is required). + * + * @param optType optimizer identifier + * @param problem corresponding optimization problem + */ + public static GOParameters getParams(final int optType, + AbstractOptimizationProblem problem) { + switch (optType) { + case STD_ES: + return standardES(problem); + case CMA_ES: + return cmaES(problem); + case STD_GA: + return standardGA(problem); + case PSO: + return standardPSO(problem); + case DE: + return standardDE(problem); + case TRIBES: + return tribes(problem); + case RANDOM: + return monteCarlo(problem); + case HILLCL: + return hillClimbing(problem); + case CBN_ES: + return standardCbnES(problem); + case CL_HILLCL: + return stdClusteringHillClimbing(problem); + case CMA_ES_IPOP: + return cmaESIPOP(problem); + case CBN_GA: + return standardCbnGA(problem); + case PBIL: + return standardPBIL(problem); + case MOGA: + return standardMOGA(problem); + default: + System.err.println("Error: optimizer type " + optType + + " is unknown!"); + return null; + } + } + + /** + * Return a simple String showing the accessible optimizers. For external + * access." + * + * @return a String listing the accessible optimizers + */ + public static String showOptimizers() { + return STD_ES + ": Standard ES \n" + CMA_ES + ": CMA-ES \n" + STD_GA + ": GA \n" + PSO + ": PSO \n" + DE + ": DE \n" + TRIBES + ": Tribes \n" + RANDOM + ": Random (Monte Carlo) " + + "\n" + HILLCL + ": Hill-Climbing \n" + CBN_ES + ": Cluster-based niching ES \n" + CL_HILLCL + ": Clustering Hill-Climbing \n" + CMA_ES_IPOP + ": IPOP-CMA-ES " + + "\n" + CBN_GA + ": Cluster-based niching GA \n" + PBIL + ": PBIL \n" + MOGA + ": MOGA, a Multi-Objective Genetic Algorithm"; + } + + /** + * Produce a runnable optimizer from a strategy identifier, a problem + * instance and with a given number of fitness calls to be performed. Output + * is written to a file if the prefix String is given. + * + * @param optType + * @param problem + * @param fitCalls + * @param outputFilePrefix + * @return a runnable optimizer + */ + public static OptimizerRunnable getOptRunnable(final int optType, + AbstractOptimizationProblem problem, int fitCalls, + String outputFilePrefix) { + return getOptRunnable(optType, problem, new EvaluationTerminator(fitCalls), outputFilePrefix); + } + + /** + * Produce a runnable optimizer from a strategy identifier, a problem + * instance and with a given terminator. Output is written to a file if the + * prefix String is given. If the terminator is null the current + * user-defined terminator will be used and if none is set, the default + * number of fitness calls will be performed. + * + * @param optType + * @param problem + * @param terminator + * @param outputFilePrefix + * @return a runnable optimizer + */ + public static OptimizerRunnable getOptRunnable(final int optType, + AbstractOptimizationProblem problem, InterfaceTerminator terminator, + String outputFilePrefix) { + OptimizerRunnable opt = null; + GOParameters params = getParams(optType, problem); + if (params != null) { + opt = new OptimizerRunnable(params, outputFilePrefix); + if (terminator != null) { + opt.getGOParams().setTerminator(terminator); + } else { + opt.getGOParams().setTerminator(getTerminator()); + } + } + return opt; + } + + /** + * Produce a runnable optimizer from a GOParameters instance. Output is + * written to a file if the prefix String is given. + * + * @param params + * @param outputFilePrefix + * @return a runnable optimizer + */ + public static OptimizerRunnable getOptRunnable(GOParameters params, String outputFilePrefix) { + return new OptimizerRunnable(params, outputFilePrefix); + } + + // /////////////////////////// constructing a default OptimizerRunnable + /** + * Produce a runnable optimizer from a strategy identifier, a problem + * instance and with the current static terminator in use. Output is written + * to a file if the prefix String is given. + * + * @see #getOptRunnable(int, AbstractOptimizationProblem, int, String) + * @param optType + * @param problem + * @param outputFilePrefix + * @return a runnable optimizer + */ + public static OptimizerRunnable getOptRunnable(final int optType, + AbstractOptimizationProblem problem, String outputFilePrefix) { + return getOptRunnable(optType, problem, getTerminator(), outputFilePrefix); + } + + /** + * Return the current user-defined terminator or, if none was set, the + * default terminator. + * + * @return the current default terminator + */ + public static InterfaceTerminator getTerminator() { + if (OptimizerFactory.userTerm != null) { + return OptimizerFactory.userTerm; + } else { + return makeDefaultTerminator(); + } + } + + /** + * Return the number of evaluations performed during the last run or -1 if + * unavailable. + * + * @return the number of evaluations performed during the last run or -1 + */ + public static int lastEvalsPerformed() { + return (lastRunnable != null) ? lastRunnable.getProgress() : -1; + } + + // /////////////////////// Creating default strategies + /** + * Use lambda, default random seed and terminator to produce GOParameters. + * + * @param es + * @param problem + * @return + */ + public static GOParameters makeESParams(EvolutionStrategies es, + AbstractOptimizationProblem problem) { + return makeParams(es, es.getLambda(), problem, randSeed, getTerminator()); + } + + /** + * Use default random seed and terminator for a parameter set. + * + * @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem, + * long, InterfaceTerminator) + * @param opt + * @param popSize + * @param problem + * @return + */ + public static GOParameters makeParams(InterfaceOptimizer opt, int popSize, AbstractOptimizationProblem problem) { + return makeParams(opt, popSize, problem, randSeed, getTerminator()); + } + + /** + * Use default random seed and the population size of the optimizer. + * + * @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem, + * long, InterfaceTerminator) + * @param opt + * @param popSize + * @param problem + * @return + */ + public static GOParameters makeParams(InterfaceOptimizer opt, AbstractOptimizationProblem problem, InterfaceTerminator term) { + return makeParams(opt, opt.getPopulation().getTargetSize(), problem, randSeed, term); + } + + /** + * Set the population size, initialize the population and return a parameter + * structure containing all given parts. + * + * @see #makeParams(InterfaceOptimizer, Population, + * AbstractOptimizationProblem, long, InterfaceTerminator) + * @param opt + * @param popSize + * @param problem + * @param seed + * @param term + * @return + */ + public static GOParameters makeParams(InterfaceOptimizer opt, + int popSize, AbstractOptimizationProblem problem, long seed, + InterfaceTerminator term) { + Population pop = new Population(popSize); + RNG.setRandomSeed(seed); + problem.initPopulation(pop); + return makeParams(opt, pop, problem, seed, term); + } + + /** + * Create a GOParameters instance and prepare it with the given arguments. + * The result can be modified and then used to create an OptimizerRunnable, + * which of course can simply be run. + * + * @see OptimizerRunnable + * @param opt + * @param pop + * @param problem + * @param seed + * @param term + * @return + */ + public static GOParameters makeParams(InterfaceOptimizer opt, + Population pop, AbstractOptimizationProblem problem, long seed, + InterfaceTerminator term) { + GOParameters params = new GOParameters(); + params.setProblem(problem); + opt.setProblem(problem); + opt.setPopulation(pop); + params.setOptimizer(opt); + params.setTerminator(term); + params.setSeed(seed); + return params; + } + + public static OptimizerRunnable optimize(final int optType, + AbstractOptimizationProblem problem, String outputFilePrefix) { + return optimize(getOptRunnable(optType, problem, outputFilePrefix)); + } + + public static OptimizerRunnable optimize(OptimizerRunnable runnable) { + if (runnable == null) { + return null; + } + new Thread(runnable).start(); + lastRunnable = runnable; + return runnable; + } + + /** + * Create a runnable optimization Runnable and directly start it in an own + * thread. The Runnable will notify waiting threads and set the isFinished + * flag when the optimization is complete. If the optType is invalid, null + * will be returned. + * + * @param optType + * @param problem + * @param outputFilePrefix + * @return the OptimizerRunnable instance just started + */ + public static OptimizerRunnable optimizeInThread(final int optType, AbstractOptimizationProblem problem, String outputFilePrefix) { + return optimizeInThread(getOptRunnable(optType, problem, outputFilePrefix)); + } + + /** + * Create a runnable optimization Runnable and directly start it in an own + * thread. The Runnable will notify waiting threads and set the isFinished + * flag when the optimization is complete. If the optType is invalid, null + * will be returned. + * + * @param params + * @param outputFilePrefix + * @return the OptimizerRunnable instance just started + */ + public static OptimizerRunnable optimizeInThread(GOParameters params, String outputFilePrefix) { + return optimizeInThread(new OptimizerRunnable(params, outputFilePrefix)); + } + + /** + * Start a runnable optimizer in a concurrent thread. + * + * @param runnable + * @return the started runnable + */ + public static OptimizerRunnable optimizeInThread(OptimizerRunnable runnable) { + if (runnable != null) { + new Thread(runnable).start(); + lastRunnable = runnable; + } + return runnable; + } + + // ///////////////////////////// Optimize a given parameter instance + public static BitSet optimizeToBinary(GOParameters params, + String outputFilePrefix) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, + outputFilePrefix)); + return runnable.getBinarySolution(); + } + + // ///////////////////////////// Optimize using a default strategy + public static BitSet optimizeToBinary(final int optType, + AbstractOptimizationProblem problem) { + return optimizeToBinary(optType, problem, null); + } + + // ///////////////////////////// Optimize using a default strategy + public static BitSet optimizeToBinary(final int optType, + AbstractOptimizationProblem problem, String outputFilePrefix) { + OptimizerRunnable runnable = optimize(optType, problem, + outputFilePrefix); + return (runnable != null) ? runnable.getBinarySolution() : null; + } + + // ///////////////////////////// Optimize a given runnable + public static BitSet optimizeToBinary(OptimizerRunnable runnable) { + optimize(runnable); + return (runnable != null) ? runnable.getBinarySolution() : null; + } + + public static double[] optimizeToDouble(GOParameters params, + String outputFilePrefix) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, + outputFilePrefix)); + return runnable.getDoubleSolution(); + } + + public static double[] optimizeToDouble(GOParameters params) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, + false)); + return runnable.getDoubleSolution(); + } + + public static double[] optimizeToDouble(GOParameters params, InterfaceStatistics stats) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, stats, + false)); + return runnable.getDoubleSolution(); + } + + public static double[] optimizeToDouble(final int optType, + AbstractOptimizationProblem problem) { + return optimizeToDouble(optType, problem, null); + } + + public static double[] optimizeToDouble(final int optType, + AbstractOptimizationProblem problem, String outputFilePrefix) { + OptimizerRunnable runnable = optimize(optType, problem, + outputFilePrefix); + return (runnable != null) ? runnable.getDoubleSolution() : null; + } + + public static double[] optimizeToDouble(OptimizerRunnable runnable) { + optimize(runnable); + return (runnable != null) ? runnable.getDoubleSolution() : null; + } + + public static IndividualInterface optimizeToInd(GOParameters params) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, + false)); + return runnable.getResult(); + } + + public static IndividualInterface optimizeToInd(GOParameters params, + String outputFilePrefix) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, + outputFilePrefix)); + return runnable.getResult(); + } + + public static IndividualInterface optimizeToInd(final int optType, + AbstractOptimizationProblem problem) { + return optimizeToInd(optType, problem, null); + } + + public static IndividualInterface optimizeToInd(final int optType, + AbstractOptimizationProblem problem, String outputFilePrefix) { + OptimizerRunnable runnable = optimize(optType, problem, + outputFilePrefix); + return (runnable != null) ? runnable.getResult() : null; + } + + public static IndividualInterface optimizeToInd(OptimizerRunnable runnable) { + optimize(runnable); + return (runnable != null) ? runnable.getResult() : null; + } + + public static Population optimizeToPop(GOParameters params, + String outputFilePrefix) { + OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, + outputFilePrefix)); + return runnable.getResultPopulation(); + } + + public static Population optimizeToPop(final int optType, + AbstractOptimizationProblem problem, String outputFilePrefix) { + OptimizerRunnable runnable = optimize(optType, problem, + outputFilePrefix); + return (runnable != null) ? runnable.getResultPopulation() : null; + } + + public static Population optimizeToPop(OptimizerRunnable runnable) { + optimize(runnable); + return (runnable != null) ? runnable.getResultPopulation() : null; + } + + ///////////////////////////// post processing + public static Population postProcess(PostProcessMethod method, int steps, double sigma, int nBest) { + return (lastRunnable == null) ? null : postProcess(lastRunnable, + new PostProcessParams(method, steps, sigma, nBest)); + } + + public static Population postProcess(InterfacePostProcessParams ppp) { + return (lastRunnable == null) ? null : postProcess(lastRunnable, ppp); + } + + /** + * Post process the given runnable with given parameters. The runnable will + * not be stored. + * + * @param runnable + * @param steps + * @param sigma + * @param nBest + * @return + */ + public static Population postProcess(OptimizerRunnable runnable, int steps, + double sigma, int nBest) { + PostProcessParams ppp = new PostProcessParams(steps, sigma, nBest); + return postProcess(runnable, ppp); + } + + /** + * Post process the given runnable with given parameters. The runnable will + * not be stored. + * + * @param runnable + * @param ppp + * @return + */ + public static Population postProcess(OptimizerRunnable runnable, + InterfacePostProcessParams ppp) { + runnable.setDoRestart(true); + runnable.setDoPostProcessOnly(true); + runnable.setPostProcessingParams(ppp); + runnable.run(); // this run will not set the lastRunnable - + // postProcessing + // starts always anew + return runnable.getResultPopulation(); + } + + public static List postProcessBinVec(int steps, double sigma, + int nBest) { + return (lastRunnable != null) ? postProcessBinVec(lastRunnable, + new PostProcessParams(steps, sigma, nBest)) : null; + } + + public static List postProcessBinVec( + InterfacePostProcessParams ppp) { + return (lastRunnable != null) ? postProcessBinVec(lastRunnable, ppp) + : null; + } + + public static List postProcessBinVec(OptimizerRunnable runnable, + int steps, double sigma, int nBest) { + return postProcessBinVec(runnable, new PostProcessParams(steps, sigma, + nBest)); + } + + /** + * Post process the given runnable with given parameters. Return the + * solution set as a vector of BitSets. The runnable will not be stored. + * + * @param runnable + * @param ppp + * @return + */ + public static List postProcessBinVec(OptimizerRunnable runnable, + InterfacePostProcessParams ppp) { + Population resPop = postProcess(runnable, ppp); + List ret = new ArrayList(resPop.size()); + for (Object o : resPop) { + if (o instanceof InterfaceDataTypeBinary) { + InterfaceDataTypeBinary indy = (InterfaceDataTypeBinary) o; + ret.add(indy.getBinaryData()); + } + } + return ret; + } + + public static List postProcessDblVec(int steps, double sigma, + int nBest) { + return (lastRunnable == null) ? null : postProcessDblVec(lastRunnable, + new PostProcessParams(steps, sigma, nBest)); + } + + public static List postProcessDblVec( + InterfacePostProcessParams ppp) { + return (lastRunnable != null) ? postProcessDblVec(lastRunnable, ppp) + : null; + } + + public static List postProcessDblVec( + OptimizerRunnable runnable, int steps, double sigma, int nBest) { + return postProcessDblVec(runnable, new PostProcessParams(steps, sigma, + nBest)); + } + + /** + * Post process the given runnable with given parameters. Return the + * solution set as a vector of double arrays. The runnable will not be + * stored. + * + * @param runnable + * @param ppp + * @return + */ + public static List postProcessDblVec( + OptimizerRunnable runnable, InterfacePostProcessParams ppp) { + Population resPop = postProcess(runnable, ppp); + List ret = new ArrayList(resPop.size()); + for (Object o : resPop) { + if (o instanceof InterfaceDataTypeDouble) { + InterfaceDataTypeDouble indy = (InterfaceDataTypeDouble) o; + ret.add(indy.getDoubleData()); + } + } + return ret; + } + + public static List postProcessIndVec(int steps, + double sigma, int nBest) { + return (lastRunnable != null) ? postProcessIndVec(lastRunnable, + new PostProcessParams(steps, sigma, nBest)) : null; + } + + public static List postProcessIndVec( + InterfacePostProcessParams ppp) { + return (lastRunnable != null) ? postProcessIndVec(lastRunnable, ppp) + : null; + } + + public static List postProcessIndVec( + OptimizerRunnable runnable, int steps, double sigma, int nBest) { + return postProcessIndVec(runnable, new PostProcessParams(steps, sigma, + nBest)); + } + + /** + * Post process the given runnable with given parameters. Return the + * solution set as a vector of AbstractEAIndividuals. The runnable will not + * be stored. + * + * @param runnable + * @param ppp + * @return + */ + public static List postProcessIndVec( + OptimizerRunnable runnable, InterfacePostProcessParams ppp) { + Population resPop = postProcess(runnable, ppp); + List ret = new ArrayList( + resPop.size()); + for (Object o : resPop) { + if (o instanceof AbstractEAIndividual) { + AbstractEAIndividual indy = (AbstractEAIndividual) o; + ret.add(indy); + } + } + return ret; + } + + ///////////////////////////// termination management + /** + * Replace the current user-defined terminator by the given one. + * + * @param term + */ + public static void setTerminator(InterfaceTerminator term) { + OptimizerFactory.userTerm = term; + } + + /** + * Add a new InterfaceTerminator to the current user-defined optimizer in a + * boolean combination. The old and the given terminator will be combined as + * in (TOld && TNew) if bAnd is true, and as in (TOld || TNew) if bAnd is + * false. If there was no user-defined terminator (or it was set to null) + * the new one is used without conjunction. + * + * @param newTerm a new InterfaceTerminator instance + * @param bAnd indicate the boolean combination + */ + public static void addTerminator(InterfaceTerminator newTerm, boolean bAnd) { + if (OptimizerFactory.userTerm == null) { + OptimizerFactory.userTerm = newTerm; + } else { + setTerminator(new CombinedTerminator(OptimizerFactory.userTerm, + newTerm, bAnd)); + } + } + + /** + * Convenience method setting an EvaluationTerminator with the given number + * of evaluations. + * + * @param maxEvals + */ + public static void setEvaluationTerminator(int maxEvals) { + setTerminator(new EvaluationTerminator(maxEvals)); + } + + /** + * Return the termination message of the last runnable, if available. + * + * @return + */ + public static String terminatedBecause() { + return (lastRunnable != null) ? lastRunnable.terminatedBecause() : null; + } + + ///////////////////////////// default parameters + /** + * Create a standard multi-start hill-climber parameter set with 50 initial + * individuals. + * + * @return a standard multi-start hill-climber + */ + public static GOParameters hillClimbing( + AbstractOptimizationProblem problem) { + return hillClimbing(problem, 50); + } + + /** + * Create a standard multi-start hill-climber parameter set with the given + * number of individuals. + * + * @return a standard multi-start hill-climber + */ + public static GOParameters hillClimbing( + AbstractOptimizationProblem problem, int popSize) { + return makeParams(new HillClimbing(), popSize, problem, randSeed, getTerminator()); + } + + public static GOParameters monteCarlo( + AbstractOptimizationProblem problem) { + return makeParams(new MonteCarloSearch(), 50, problem, randSeed, getTerminator()); + } + + /** + * Create a generic Clustering-based Niching EA with given parameters. Uses + * ClusteringDensityBased as a default clustering algorithm. + * + * @param problem + * @param opt + * @param clusterSigma + * @param minClustSize + * @param haltingWindowLength + * @param haltingWindowEpsilon + * @param popSize + * @return + */ + public static GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt, + double clusterSigma, int minClustSize, int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) { + return createCbn(problem, opt, new ClusteringDensityBased(clusterSigma, minClustSize), maxSpecSize, + new ClusteringDensityBased(clusterSigma, minClustSize), haltingWindowLength, haltingWindowEpsilon, popSize); + } + + /** + * A standard CBNPSO with density based clustering working on personal best + * positions. + * + * @param problem + * @return + */ + public static GOParameters standardCbnPSO(AbstractOptimizationProblem problem) { + return createCbnPSO(problem, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, + cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); + } + + public static GOParameters createCbnPSO(AbstractOptimizationProblem problem, double clusterSigma, int minClustSize, + int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) { + GOParameters psoParams = standardPSO(problem); + ParticleSwarmOptimization pso = (ParticleSwarmOptimization) psoParams.getOptimizer(); + ClusteringDensityBased clust = new ClusteringDensityBased(clusterSigma, minClustSize, + new IndividualDataMetric(ParticleSwarmOptimization.partBestPosKey)); + return createCbn(problem, pso, clust, maxSpecSize, new ClusteringDensityBased(clust), + haltingWindowLength, haltingWindowEpsilon, popSize); + } + + /** + * Create a generic Clustering-based Niching EA with given parameters. + * + * @param problem + * @param opt + * @param clustDifferentiate + * @param clustMerge + * @param haltingWindowLength + * @param haltingWindowEpsilon + * @param popSize + * @return + */ + public static GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt, + InterfaceClustering clustDifferentiate, int maxSpecSize, InterfaceClustering clustMerge, int haltingWindowLength, + double haltingWindowEpsilon, int popSize) { + ClusterBasedNichingEA cbn = new ClusterBasedNichingEA(); + cbn.setOptimizer(opt); + cbn.setMergingCA(clustMerge); + cbn.setMaxSpeciesSize(maxSpecSize); + cbn.setDifferentiationCA(clustDifferentiate); + if (clustMerge != null) { + cbn.setUseMerging(true); + } + cbn.setShowCycle(0); // don't do graphical output + cbn.setHaltingWindow(haltingWindowLength); + cbn.setEpsilonBound(haltingWindowEpsilon); + return makeParams(cbn, popSize, problem, randSeed, getTerminator()); + } + + /** + * A standard CBNES which employs a (15,50)-ES with further parameters as + * set by the EvA2 framework. + * + * @param problem + * @return + */ + public static GOParameters standardCbnES(AbstractOptimizationProblem problem) { + EvolutionStrategies es = new EvolutionStrategies(); + es.setMu(15); + es.setLambda(50); + es.setPlusStrategy(false); + return createCbn(problem, es, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); + } + + /** + * A standard CBNES which employs a CMA-ES, see + * {@link #cmaES(AbstractOptimizationProblem)}. + * + * @param problem + * @return + */ + public static GOParameters standardCbnCmaES(AbstractOptimizationProblem problem) { + GOParameters cmaEsParams = cmaES(problem); + EvolutionStrategies cmaES = (EvolutionStrategies) cmaEsParams.getOptimizer(); + return createCbn(problem, cmaES, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); + } + + /** + * A standard CBNGA with a GA and further parameters as set by the EvA2 + * framework. + * + * @param problem + * @return + */ + public static GOParameters standardCbnGA(AbstractOptimizationProblem problem) { + GeneticAlgorithm ga = new GeneticAlgorithm(); + return createCbn(problem, ga, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); + } + + /** + * + * @param problem + * @return + */ + public static GOParameters standardPBIL(AbstractOptimizationProblem problem) { + PopulationBasedIncrementalLearning pbil = createPBIL(0.04, 0.01, 0.5, 1, + new SelectBestIndividuals(), 50, problem, null); + + return makeParams(pbil, pbil.getPopulation(), problem, randSeed, getTerminator()); + } + + /** + * Create a standard clustering hill climbing employing simple ES mutation + * with adaptive step size, starting in parallel 100 local searches and + * clustering intermediate populations to avoid optima being found several + * times by the same population (density based clustering with sigma = + * 0.05). The population is reinitialized if the average progress of one + * cycle does not exceed 1e-6. + * + * @param problem + * @return + */ + public static GOParameters stdClusteringHillClimbing( + AbstractOptimizationProblem problem) { + return clusteringHillClimbing(problem, 1000, 100, 0.000001, + PostProcessMethod.hillClimber, 0.05, 0.000001, 0.05); + } + + /** + * Create a clustering hillclimber using nelder mead and additional given + * parameters. + * + * @param problem + * @param evalCycle + * @param popSize + * @param minImprovement + * @param method + * @param sigmaClust + * @return + */ + public static GOParameters clusteringHillClimbingNM(AbstractOptimizationProblem problem, + int evalCycle, int popSize, double minImprovement, double sigmaClust) { + return clusteringHillClimbing(problem, evalCycle, popSize, minImprovement, + PostProcessMethod.nelderMead, 0.01, 0.00000001, sigmaClust); + } + + /** + * Create a custom clustering hillclimber using ES mutation (simple or CMA) + * or nelder mead. The parameters hcInitialStep and hcStepThresh are only + * relevant for the simple mutation based hc method. + * + * @param problem + * @param evalCycle + * @param popSize + * @param minImprovement + * @param method + * @param hcInitialStep + * @param hcStepThresh + * @param sigmaClust + * @return + */ + public static GOParameters clusteringHillClimbing( + AbstractOptimizationProblem problem, int evalCycle, int popSize, double minImprovement, + PostProcessMethod method, double hcInitialStep, double hcStepThresh, double sigmaClust) { + ClusteringHillClimbing chc = new ClusteringHillClimbing(); + chc.setProblem(problem); + + chc.setEvalCycle(evalCycle); + chc.setInitialPopSize(popSize); + chc.setStepSizeInitial(hcInitialStep); + chc.setLocalSearchMethod(method); + chc.setMinImprovement(minImprovement); + chc.setNotifyGuiEvery(0); + chc.setStepSizeThreshold(hcStepThresh); + chc.setSigmaClust(sigmaClust); + return makeParams(chc, popSize, problem, randSeed, getTerminator()); + } + + public static GOParameters cmaES(AbstractOptimizationProblem problem) { + EvolutionStrategies es = new EvolutionStrategies(); + es.setMu(15); + es.setLambda(50); + es.setPlusStrategy(false); + + if (assertIndyType(problem, InterfaceESIndividual.class)) { + setTemplateOperators(problem, new MutateESCovarianceMatrixAdaption(true), 1, new CrossoverESDefault(), 0); + } else { + System.err.println("Error, CMA-ES is implemented for ES individuals only (requires double data types)"); + return null; + } + + return makeESParams(es, problem); + } + + /** + * Create a new IPOP-CMA-ES strategy with Rank-mu-CMA. The population size + * is set to lambda = (int) (4.0 + 3.0 * Math.log(dim)) and mu = + * Math.floor(lambda/2.), but lambda may grow during optimization due to + * restarts with increased lambda. Operator probabilities are set to p_mut = + * 1 and p_c = 0. The given problem must work with an individual template + * which implements InterfaceDataTypeDouble. + * + * @param problem the optimization problem + * @return + */ + public static GOParameters cmaESIPOP(AbstractOptimizationProblem problem) { + return createCmaEsIPop(problem, 2.); + } + + public static GOParameters createCmaEsIPop(AbstractOptimizationProblem problem, double incLambdaFact) { + EvolutionStrategies es = new EvolutionStrategyIPOP(); + + AbstractEAIndividual indyTemplate = problem.getIndividualTemplate(); + if ((indyTemplate != null) && ((indyTemplate instanceof InterfaceESIndividual) || (indyTemplate instanceof InterfaceDataTypeDouble))) { + // set selection strategy + int dim; + if (indyTemplate instanceof InterfaceESIndividual) { + dim = ((InterfaceESIndividual) indyTemplate).getDGenotype().length; + } else { + dim = ((InterfaceDataTypeDouble) indyTemplate).getDoubleData().length; + } + int lambda = (int) (4.0 + 3.0 * Math.log(dim)); + es.setGenerationStrategy((int) Math.floor(lambda / 2.), lambda, false); + es.setForceOrigPopSize(false); + ((EvolutionStrategyIPOP) es).setIncPopSizeFact(incLambdaFact); + // Set CMA operator for mutation + AbstractEAIndividual indy = (AbstractEAIndividual) indyTemplate; + MutateESRankMuCMA cmaMut = new MutateESRankMuCMA(); + AbstractEAIndividual.setOperators(indy, cmaMut, 1., new CrossoverESDefault(), 0.); + } else { + System.err.println("Error, CMA-ES is implemented for ES individuals only (requires double data types)"); + return null; + } + + return makeESParams(es, problem); + } + + public static GOParameters standardNMS(AbstractOptimizationProblem problem) { + NelderMeadSimplex nms = NelderMeadSimplex.createNelderMeadSimplex(problem, null); + return makeParams(nms, 50, problem, randSeed, getTerminator()); + } + + /** + * This constructs a standard DE variant with current-to-best/1 scheme, + * F=0.8, k=0.6, lambda=0.6. The population size is 50 by default. + * + * @param problem + * @return + */ + public static GOParameters standardDE( + AbstractOptimizationProblem problem) { + DifferentialEvolution de = new DifferentialEvolution(); + de.setDEType(DETypeEnum.DE2_CurrentToBest); // this sets current-to-best + de.setF(0.8); + de.setK(0.6); + de.setLambda(0.6); + de.setMt(0.05); // this is not really employed for currentToBest + return makeParams(de, 50, problem, randSeed, getTerminator()); + } + + public static GOParameters standardES( + AbstractOptimizationProblem problem) { + EvolutionStrategies es = new EvolutionStrategies(); + es.setMu(15); + es.setLambda(50); + es.setPlusStrategy(false); + + if (assertIndyType(problem, InterfaceESIndividual.class)) { + setTemplateOperators(problem, new MutateESGlobal(0.2, MutateESCrossoverTypeEnum.intermediate), 0.9, new CrossoverESDefault(), 0.2); + } else { + System.err.println("Error, standard ES is implemented for ES individuals only (requires double data types)"); + return null; + } + return makeESParams(es, problem); + } + + public static GOParameters standardGA( + AbstractOptimizationProblem problem) { + GeneticAlgorithm ga = new GeneticAlgorithm(); + ga.setElitism(true); + + return makeParams(ga, 100, problem, randSeed, getTerminator()); + } + + /** + * A standard constricted PSO instance with phi1=phi2=2.05, grid topology of + * range 1 and a population size of 30. The chi parameter is set to approx. + * 0.73 automatically. + * + * @param problem + * @return + */ + public static GOParameters standardPSO( + AbstractOptimizationProblem problem) { + ParticleSwarmOptimization pso = new ParticleSwarmOptimization(); + pso.setPhiValues(2.05, 2.05); + pso.setTopology(PSOTopologyEnum.grid); + pso.setTopologyRange(1); + return makeParams(pso, 30, problem, randSeed, getTerminator()); + } + + public static GOParameters tribes(AbstractOptimizationProblem problem) { + return makeParams(new Tribes(), 1, problem, randSeed, getTerminator()); + } + + /** + * A standard niching ES which employs predefined values and standard ES + * variation operators. + * + * @param problem + * @return + */ + public static GOParameters standardNichingEs(AbstractOptimizationProblem prob) { + // nichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, + return createNichingEs(prob, -1, 100, 100, + // int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) { + 10, 200, 0, 100, 50); + } + + /** + * A niching ES. + * + * @param problem + * @return + */ + public static GOParameters createNichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) { + EsDpiNiching nes = new EsDpiNiching(nicheRadius, muPerPeak, lambdaPerPeak, expectedPeaks, rndImmigrants, explorerPeaks, resetExplInterval, etaPresel); + + if (assertIndyType(prob, InterfaceESIndividual.class)) { + setTemplateOperators(prob, new MutateESGlobal(0.2, MutateESCrossoverTypeEnum.intermediate), 0.9, new CrossoverESDefault(), 0.2); + } else { + System.err.println("Error, standard ES is implemented for ES individuals only (requires double data types)"); + return null; + } + // pop. size will be ignored by nes + return makeParams(nes, 100, prob, randSeed, getTerminator()); + } + + /** + * This actually employs the rank-mu CMA operator. + * + * @param prob + * @return + */ + public static GOParameters standardNichingCmaEs(AbstractOptimizationProblem prob) { + return createNichingCmaEs(prob, -1, 10, 10, 0, 0, -1); + } + + /** + * This actually employs the rank-mu CMA operator. + * + * @param prob + * @return + */ + public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRad) { + return createNichingCmaEs(prob, nicheRad, 10, 10, 0, 0, -1); + } + + /** + * This actually employs the rank-mu CMA operator. + * + * @param prob + * @return + */ + public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRad, double stagnationEpsilon) { + return createNichingCmaEs(prob, nicheRad, 10, 10, 0, 0, stagnationEpsilon); + } + + /** + * This actually employs the rank-mu CMA operator. + * + * @param prob + * @return + */ + public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRad, int nicheCount, double stagnationEpsilon) { + return createNichingCmaEs(prob, nicheRad, 10, nicheCount, 0, 0, stagnationEpsilon); + } + + /** + * A generic niching CMA-ES using the rank-mu CMA operator + * + * @param prob + * @param nicheRadius + * @param lambda + * @param expectedPeaks + * @param explorerPeaks + * @param resetExplInterval + * @return + */ + public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRadius, int lambda, int expectedPeaks, int explorerPeaks, int resetExplInterval, double stagnationEpsilon) { + EsDpiNiching nes = new EsDpiNichingCma(nicheRadius, lambda, expectedPeaks, explorerPeaks, resetExplInterval); + if (stagnationEpsilon > 0) { + nes.setEpsilonBound(stagnationEpsilon); + } + + if (assertIndyType(prob, InterfaceESIndividual.class)) { + setTemplateOperators(prob, new MutateESRankMuCMA(), 1., new CrossoverESDefault(), 0.); + } else { + System.err.println("Error, standard ES is implemented for ES individuals only (requires double data types)"); + return null; + } + // pop. size will be ignored by nes + return makeParams(nes, 100, prob, randSeed, getTerminator()); + } + + /** + * Check if a given problem instance has a template individual matching the + * given class. + * + * @param prob + * @param cls + * @return + */ + private static boolean assertIndyType(AbstractOptimizationProblem prob, + Class cls) { + return cls.isAssignableFrom(prob.getIndividualTemplate().getClass()); + } + + /** + * Set the evolutionary operators of the individual template of the given + * problem instance. + * + * @param prob + * @param mute + * @param pMut + * @param cross + * @param pCross + */ + public static void setTemplateOperators(AbstractOptimizationProblem prob, InterfaceMutation mute, double pMut, InterfaceCrossover cross, double pCross) { + AbstractEAIndividual indy = prob.getIndividualTemplate(); + if ((indy != null)) { + indy.setOperators(mute, pMut, cross, pCross); + } + } } diff --git a/src/eva2/OptimizerRunnable.java b/src/eva2/OptimizerRunnable.java index 5c8db2b7..276c0e42 100644 --- a/src/eva2/OptimizerRunnable.java +++ b/src/eva2/OptimizerRunnable.java @@ -132,6 +132,7 @@ public class OptimizerRunnable implements Runnable { doRestart = restart; } + @Override public void run() { isFinished = false; try { diff --git a/src/eva2/client/ClassPreloader.java b/src/eva2/client/ClassPreloader.java index 8880ff5c..8ce2b4ea 100644 --- a/src/eva2/client/ClassPreloader.java +++ b/src/eva2/client/ClassPreloader.java @@ -28,6 +28,7 @@ public class ClassPreloader implements Runnable { /** * Load classes via GenericObjectEditor in a thread. */ + @Override public void run() { if (classNames != null) { for (int i = 0; i < classNames.length; i++) { diff --git a/src/eva2/client/EvAClient.java b/src/eva2/client/EvAClient.java index f0ea939f..ce865248 100644 --- a/src/eva2/client/EvAClient.java +++ b/src/eva2/client/EvAClient.java @@ -252,6 +252,7 @@ public class EvAClient extends JFrame implements RemoteStateListener { SwingUtilities.invokeLater(initRnbl = new Runnable() { + @Override public void run() { synchronized (this) { long startTime = System.currentTimeMillis(); @@ -1177,6 +1178,7 @@ public class EvAClient extends JFrame implements RemoteStateListener { comAdapter.killAllServers(); } + @Override public void performedRestart(String infoString) { if (superListenerList != null) { for (RemoteStateListener l : superListenerList) { @@ -1187,6 +1189,7 @@ public class EvAClient extends JFrame implements RemoteStateListener { startTime = System.currentTimeMillis(); } + @Override public void performedStart(String infoString) { if (superListenerList != null) { for (RemoteStateListener l : superListenerList) { @@ -1197,6 +1200,7 @@ public class EvAClient extends JFrame implements RemoteStateListener { startTime = System.currentTimeMillis(); } + @Override public void performedStop() { if (superListenerList != null) { for (RemoteStateListener l : superListenerList) { @@ -1215,6 +1219,7 @@ public class EvAClient extends JFrame implements RemoteStateListener { * for the event dispatching thread with SwingUtilities.invokeLater(). In * this case we're just changing the progress bars value. */ + @Override public void updateProgress(final int percent, String msg) { if (superListenerList != null) { for (RemoteStateListener l : superListenerList) { @@ -1227,6 +1232,7 @@ public class EvAClient extends JFrame implements RemoteStateListener { if (this.progressBar != null) { Runnable doSetProgressBarValue = new Runnable() { + @Override public void run() { progressBar.setValue(percent); } diff --git a/src/eva2/client/EvAComAdapter.java b/src/eva2/client/EvAComAdapter.java index c37a2f4a..bc67c939 100644 --- a/src/eva2/client/EvAComAdapter.java +++ b/src/eva2/client/EvAComAdapter.java @@ -23,35 +23,37 @@ import java.rmi.RemoteException; * */ public class EvAComAdapter extends ComAdapter { - private LoggingPanel loggingPanel; - private EvAMainAdapterImpl localMainAdapter; - private boolean runLocally = false; - - /** - * - */ - public void setLogPanel(LoggingPanel loggingPanel) { - this.loggingPanel = loggingPanel; - } - /** - * - */ - public static EvAComAdapter getInstance() { - if (m_instance==null) { - m_instance = new EvAComAdapter(); - m_instance.addServersFromProperties(EvAInfo.getProperties()); - } - return (EvAComAdapter)m_instance; - } - /** - * Creates the ModulAdapters RMI Object on the server - * @return - */ - public ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile) { - ModuleAdapter newModuleAdapter; - if ((m_RMIServer == null) && isRunLocally()) { - //ret = evaAdapter.getModuleAdapter(Modul, hostAdd, this.m_MainAdapterClient); + private LoggingPanel loggingPanel; + private EvAMainAdapterImpl localMainAdapter; + private boolean runLocally = false; + + /** + * + */ + public void setLogPanel(LoggingPanel loggingPanel) { + this.loggingPanel = loggingPanel; + } + + /** + * + */ + public static EvAComAdapter getInstance() { + if (m_instance == null) { + m_instance = new EvAComAdapter(); + m_instance.addServersFromProperties(EvAInfo.getProperties()); + } + return (EvAComAdapter) m_instance; + } + + /** + * Creates the ModulAdapters RMI Object on the server + * + * @return + */ + public ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile) { + ModuleAdapter newModuleAdapter; + if ((m_RMIServer == null) && isRunLocally()) { newModuleAdapter = getLocalMainAdapter().getModuleAdapter(selectedModuleName, true, getHostName(), goParams, noGuiStatsFile, null); } else { newModuleAdapter = ((RMIConnectionEvA) getConnection(getHostName())).getModuleAdapter(selectedModuleName); @@ -59,68 +61,77 @@ public class EvAComAdapter extends ComAdapter { System.err.println("RMI Error for getting ModuleAdapterObject : " + selectedModuleName); } } - return newModuleAdapter; - } - - public void updateLocalMainAdapter() { - localMainAdapter = new EvAMainAdapterImpl(); - } - - private EvAMainAdapter getLocalMainAdapter() { - if (localMainAdapter == null) localMainAdapter = new EvAMainAdapterImpl(); - return localMainAdapter; - } - - /** - * Returns a list of modules available on the server. - * @return - */ - public String[] getModuleNameList() { - String[] list; - - if ((m_RMIServer == null) && isRunLocally()) { - list = getLocalMainAdapter().getModuleNameList(); - } else { - RMIConnectionEvA Connection = (RMIConnectionEvA)getConnection(getHostName()); - if (Connection == null) { - System.err.println("Couldnt create RMIConnection in EvAComAdapter.getModuleNameList"); - return null; - } - list = ((EvAMainAdapter)Connection.getMainAdapter()).getModuleNameList(); - } - if (loggingPanel != null) - loggingPanel.logMessage("List of modules on server:"); - if (list != null) - for (int i = 0; i < list.length; i++) { - if ( (String) list[i] != null && loggingPanel != null) - loggingPanel.logMessage( (String) list[i]); - } - return list; - } - - protected MainAdapter getMainAdapter(RMIInvocationHandler invocHandler) throws RemoteException { - try { - return (EvAMainAdapter) invocHandler.getWrapper(); - } catch (ClassCastException e) { - System.err.println("Warning: cannot cast to EvAMainAdapter in EvAComAdapter.. trying MainAdapter..."); - } - return (MainAdapter) invocHandler.getWrapper(); - } - - - protected RMIConnection createRMIConnection(String Host, MainAdapter mainRemoteObject, MainAdapterClient client) { - return new RMIConnectionEvA(Host, mainRemoteObject, client); - } - /** - * @return the runLocally - */ - public boolean isRunLocally() { - return runLocally; - } - /** - * @param runLocally the runLocally to set - */ - public void setRunLocally(boolean runLocally) { - this.runLocally = runLocally; - } + return newModuleAdapter; + } + + public void updateLocalMainAdapter() { + localMainAdapter = new EvAMainAdapterImpl(); + } + + private EvAMainAdapter getLocalMainAdapter() { + if (localMainAdapter == null) { + localMainAdapter = new EvAMainAdapterImpl(); + } + return localMainAdapter; + } + + /** + * Returns a list of modules available on the server. + * + * @return + */ + public String[] getModuleNameList() { + String[] list; + + if ((m_RMIServer == null) && isRunLocally()) { + list = getLocalMainAdapter().getModuleNameList(); + } else { + RMIConnectionEvA Connection = (RMIConnectionEvA) getConnection(getHostName()); + if (Connection == null) { + System.err.println("Couldnt create RMIConnection in EvAComAdapter.getModuleNameList"); + return null; + } + list = ((EvAMainAdapter) Connection.getMainAdapter()).getModuleNameList(); + } + if (loggingPanel != null) { + loggingPanel.logMessage("List of modules on server:"); + } + if (list != null) { + for (int i = 0; i < list.length; i++) { + if ((String) list[i] != null && loggingPanel != null) { + loggingPanel.logMessage((String) list[i]); + } + } + } + return list; + } + + @Override + protected MainAdapter getMainAdapter(RMIInvocationHandler invocHandler) throws RemoteException { + try { + return (EvAMainAdapter) invocHandler.getWrapper(); + } catch (ClassCastException e) { + System.err.println("Warning: cannot cast to EvAMainAdapter in EvAComAdapter.. trying MainAdapter..."); + } + return (MainAdapter) invocHandler.getWrapper(); + } + + @Override + protected RMIConnection createRMIConnection(String Host, MainAdapter mainRemoteObject, MainAdapterClient client) { + return new RMIConnectionEvA(Host, mainRemoteObject, client); + } + + /** + * @return the runLocally + */ + public boolean isRunLocally() { + return runLocally; + } + + /** + * @param runLocally the runLocally to set + */ + public void setRunLocally(boolean runLocally) { + this.runLocally = runLocally; + } } \ No newline at end of file diff --git a/src/eva2/gui/AboutDialog.java b/src/eva2/gui/AboutDialog.java index 7a941516..fa72b03f 100644 --- a/src/eva2/gui/AboutDialog.java +++ b/src/eva2/gui/AboutDialog.java @@ -63,6 +63,7 @@ public class AboutDialog extends JDialog { infoEditorPane.setOpaque(false); infoEditorPane.addHyperlinkListener(new HyperlinkListener() { + @Override public void hyperlinkUpdate(HyperlinkEvent hle) { if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) { java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); diff --git a/src/eva2/gui/AbstractListSelectionEditor.java b/src/eva2/gui/AbstractListSelectionEditor.java index b20627d2..13ea6c33 100644 --- a/src/eva2/gui/AbstractListSelectionEditor.java +++ b/src/eva2/gui/AbstractListSelectionEditor.java @@ -97,6 +97,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop this.m_BlackCheck[i] = new JCheckBox(getElementName(i), isElementSelected(i)); this.m_BlackCheck[i].setToolTipText(getElementToolTip(i)); this.m_BlackCheck[i].addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent ev) { if (actionOnSelect()) m_Support.firePropertyChange("AbstractListSelectionEditor", null, this); } @@ -123,6 +124,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (setObject(o)) updateEditor(); } @@ -131,29 +133,36 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop * Returns the current object. * @return the current object */ + @Override public abstract Object getValue(); + @Override public String getJavaInitializationString() { return ""; } + @Override public String getAsText() { return null; } + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -162,6 +171,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -171,6 +181,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -182,6 +193,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop * Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -189,11 +201,13 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_CustomEditor == null) this.initCustomEditor(); return m_CustomEditor; } + @Override public void propertyChange(PropertyChangeEvent evt) { m_Support.firePropertyChange("AbstractListSelectionEditor", null, this); } diff --git a/src/eva2/gui/BigStringEditor.java b/src/eva2/gui/BigStringEditor.java index 2afe7c29..c2300cda 100644 --- a/src/eva2/gui/BigStringEditor.java +++ b/src/eva2/gui/BigStringEditor.java @@ -109,6 +109,7 @@ public class BigStringEditor implements PropertyEditor { m_Panel.setLayout(new BorderLayout()); m_SetButton = new JButton("SET"); m_SetButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { setValue(m_TextArea.getText()); } @@ -119,6 +120,7 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public void setValue (Object value) { m_ElementEditor = null; if (value instanceof String) { @@ -135,6 +137,7 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public Object getValue () { // m_Source.setString(m_TextArea.getText()); return null; @@ -142,6 +145,7 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public String getJavaInitializationString () { return "null"; } @@ -152,6 +156,7 @@ public class BigStringEditor implements PropertyEditor { * * @return true */ + @Override public boolean isPaintable () { return true; } @@ -162,6 +167,7 @@ public class BigStringEditor implements PropertyEditor { * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue (Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent())/2; @@ -172,6 +178,7 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public String getAsText () { return null; } @@ -179,6 +186,7 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public void setAsText (String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -186,6 +194,7 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public String[] getTags () { return null; } @@ -193,21 +202,25 @@ public class BigStringEditor implements PropertyEditor { /** * */ + @Override public boolean supportsCustomEditor () { return true; } /** * */ + @Override public Component getCustomEditor () { return m_Panel; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); diff --git a/src/eva2/gui/DPointSetMultiIcon.java b/src/eva2/gui/DPointSetMultiIcon.java index 480fa993..894e0394 100644 --- a/src/eva2/gui/DPointSetMultiIcon.java +++ b/src/eva2/gui/DPointSetMultiIcon.java @@ -269,6 +269,7 @@ public class DPointSetMultiIcon extends DComponent jumperMI.addJump(); } + @Override public void paint(DMeasures m) { try @@ -490,6 +491,7 @@ public class DPointSetMultiIcon extends DComponent //~ Inner Classes ////////////////////////////////////////////////////////// + @Override public String toString() { String text = "eva2.tools.chart2d.DPointSet[size:" + getSize(); diff --git a/src/eva2/gui/DataViewer.java b/src/eva2/gui/DataViewer.java index ce77b194..dfe296f7 100644 --- a/src/eva2/gui/DataViewer.java +++ b/src/eva2/gui/DataViewer.java @@ -91,6 +91,7 @@ public class DataViewer implements DataViewerInterface { /** * */ + @Override public Graph getNewGraph(String InfoString) { m_GraphCounter++; if (TRACE) System.out.println("Graph.getNewGraph No:"+m_GraphCounter); @@ -99,6 +100,7 @@ public class DataViewer implements DataViewerInterface { /** * */ + @Override public void init() { m_Plot = new Plot(m_Name,"x","y", true); } diff --git a/src/eva2/gui/EnumEditor.java b/src/eva2/gui/EnumEditor.java index bbd5c5a0..09b5c0b4 100644 --- a/src/eva2/gui/EnumEditor.java +++ b/src/eva2/gui/EnumEditor.java @@ -18,10 +18,12 @@ public class EnumEditor extends PropertyEditorSupport { /** The Enum values that may be chosen */ private Enum[] enumConstants; + @Override public String getAsText() { return getValue().toString(); } + @Override public void setValue(Object value) { if (value instanceof Enum) { enumConstants = ((Enum)value).getClass().getEnumConstants(); @@ -67,6 +69,7 @@ public class EnumEditor extends PropertyEditorSupport { PropertyValueSelector ps = new PropertyValueSelector(ed); JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent e) { System.exit(0); } diff --git a/src/eva2/gui/EvAModuleButtonPanelMaker.java b/src/eva2/gui/EvAModuleButtonPanelMaker.java index 9a34ce3e..f264e7c3 100644 --- a/src/eva2/gui/EvAModuleButtonPanelMaker.java +++ b/src/eva2/gui/EvAModuleButtonPanelMaker.java @@ -52,6 +52,7 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa moduleAdapter = adapter; } + @Override public JToolBar makePanel() { toolBar = new JToolBar(); toolBar.setFloatable(false); @@ -165,6 +166,7 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa helpButton.setToolTipText("Description of the current optimization algorithm."); helpButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { //System.out.println("Run Opt pressed !!!!!!!!!!!!!!!!======================!!"); try { @@ -186,6 +188,7 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa /** * */ + @Override public void performedStop() { runButton.setEnabled(true); postProcessButton.setEnabled(true); diff --git a/src/eva2/gui/EvATabbedFrameMaker.java b/src/eva2/gui/EvATabbedFrameMaker.java index 6c098e57..cbb20382 100644 --- a/src/eva2/gui/EvATabbedFrameMaker.java +++ b/src/eva2/gui/EvATabbedFrameMaker.java @@ -40,6 +40,7 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN pmContainer.add(pm); } + @Override public JPanel makePanel() { JPanel tabControlPanel = new JPanel(new GridBagLayout()); @@ -111,6 +112,7 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN } } + @Override public void setInformers(List informers) { // if the informers have changed, update the GUI element which displays them try { @@ -169,6 +171,7 @@ class ClosableTabComponent extends JPanel { //make JLabel read titles from JTabbedPane JLabel label = new JLabel() { + @Override public String getText() { int index = pane.indexOfTabComponent(ClosableTabComponent.this); if (index != -1) { @@ -210,6 +213,7 @@ class ClosableTabComponent extends JPanel { addActionListener(this); } + @Override public void actionPerformed(ActionEvent e) { int i = pane.indexOfTabComponent(ClosableTabComponent.this); if (i != -1) { @@ -252,10 +256,12 @@ class ClosableTabComponent extends JPanel { } //we don't want to update UI for this button + @Override public void updateUI() { } //paint the cross + @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g.create(); @@ -273,6 +279,7 @@ class ClosableTabComponent extends JPanel { } private final static MouseListener buttonMouseListener = new MouseAdapter() { + @Override public void mouseEntered(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { @@ -281,6 +288,7 @@ class ClosableTabComponent extends JPanel { } } + @Override public void mouseExited(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { diff --git a/src/eva2/gui/EvATreeSelectionListener.java b/src/eva2/gui/EvATreeSelectionListener.java index c2e62b4a..981cae06 100644 --- a/src/eva2/gui/EvATreeSelectionListener.java +++ b/src/eva2/gui/EvATreeSelectionListener.java @@ -42,6 +42,7 @@ public class EvATreeSelectionListener implements TreeSelectionListener, Property if (goEditor!=null) goEditor.addPropertyChangeListener(this); // listen to changes to the parameters } + @Override public void valueChanged(TreeSelectionEvent e) { if (TRACE) System.out.println("valueChanged to " + BeanInspector.toString(e.getPath())); TreePath tp = e.getPath(); @@ -59,6 +60,7 @@ public class EvATreeSelectionListener implements TreeSelectionListener, Property } } + @Override public void propertyChange(PropertyChangeEvent evt) { if (TRACE) System.out.println("EvATreeNode received change event " + evt); root.setObject(evt.getNewValue(), true); diff --git a/src/eva2/gui/Exp.java b/src/eva2/gui/Exp.java index 3503947a..8a6e962d 100644 --- a/src/eva2/gui/Exp.java +++ b/src/eva2/gui/Exp.java @@ -19,6 +19,7 @@ public class Exp extends DFunction { * (non-Javadoc) * @see eva2.tools.chart2d.DFunction#isDefinedAt(double) */ + @Override public boolean isDefinedAt(double source) { return true; } @@ -27,6 +28,7 @@ public class Exp extends DFunction { * (non-Javadoc) * @see eva2.tools.chart2d.DFunction#isInvertibleAt(double) */ + @Override public boolean isInvertibleAt(double image) { return image > 0; } @@ -35,6 +37,7 @@ public class Exp extends DFunction { * (non-Javadoc) * @see eva2.tools.chart2d.DFunction#getImageOf(double) */ + @Override public double getImageOf(double source) { return Math.exp(source); } @@ -43,6 +46,7 @@ public class Exp extends DFunction { * (non-Javadoc) * @see eva2.tools.chart2d.DFunction#getSourceOf(double) */ + @Override public double getSourceOf(double target) { if (target <= 0) { return Math.log(minValue); // think of a minimal value we want to show in case invalid values are requested diff --git a/src/eva2/gui/ExtActionChangedListener.java b/src/eva2/gui/ExtActionChangedListener.java index dd847ca7..a502b118 100644 --- a/src/eva2/gui/ExtActionChangedListener.java +++ b/src/eva2/gui/ExtActionChangedListener.java @@ -30,6 +30,7 @@ public abstract class ExtActionChangedListener implements PropertyChangeListener /** * */ + @Override public abstract void propertyChange(PropertyChangeEvent e); /** * diff --git a/src/eva2/gui/ExtDesktopManager.java b/src/eva2/gui/ExtDesktopManager.java index 34ad1f4f..0e31e9a2 100644 --- a/src/eva2/gui/ExtDesktopManager.java +++ b/src/eva2/gui/ExtDesktopManager.java @@ -35,11 +35,13 @@ public class ExtDesktopManager extends DefaultDesktopManager { this.desktop = desktop; } + @Override public void activateFrame(JInternalFrame f) { super.activateFrame(f); activeFrame = f; } + @Override public void deactivateFrame(JInternalFrame f) { super.deactivateFrame(f); if (activeFrame == f) { @@ -51,6 +53,7 @@ public class ExtDesktopManager extends DefaultDesktopManager { return activeFrame; } + @Override public void closeFrame(JInternalFrame internalFrame) { LOGGER.log(Level.FINE, "Closing Internal Frame: {0}", internalFrame.getTitle()); super.closeFrame(internalFrame); diff --git a/src/eva2/gui/FunctionArea.java b/src/eva2/gui/FunctionArea.java index 1fa86123..a173e524 100644 --- a/src/eva2/gui/FunctionArea.java +++ b/src/eva2/gui/FunctionArea.java @@ -191,6 +191,7 @@ public class FunctionArea extends DArea implements Serializable { private void addPopup() { addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) { // do nothing @@ -201,6 +202,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, "Rename graph", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { renameGraph(getNearestGraphIndex(FunctionArea.this.xPos, FunctionArea.this.yPos)); } @@ -212,6 +214,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, togGTTName, new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { setShowGraphToolTips(!isShowGraphToolTips()); } @@ -221,6 +224,7 @@ public class FunctionArea extends DArea implements Serializable { + " legend"; addMenuItem(graphPopupMenu, togLName, new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { toggleLegend(); } @@ -228,6 +232,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, "Toggle scientific format", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { toggleScientificY(true); } @@ -237,6 +242,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, "Recolor all graphs", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { recolorAllGraphsByIndex(); } @@ -249,6 +255,7 @@ public class FunctionArea extends DArea implements Serializable { + temp.x + "/" + temp.y + ")", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { DPoint temp = getDMeasures().getDPoint( xPos, yPos); @@ -268,6 +275,7 @@ public class FunctionArea extends DArea implements Serializable { + point.x + "/" + point.y + ")", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { } }, false); @@ -275,6 +283,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, " Remove point", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { removePoint(FunctionArea.this.xPos, FunctionArea.this.yPos); @@ -290,6 +299,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, selectTitle, new ActionListener() { + @Override public void actionPerformed( ActionEvent ee) { ((InterfaceSelectablePointIcon) currentPointIcon).getSelectionListener().individualSelected( @@ -304,6 +314,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, " Show individual", new ActionListener() { + @Override public void actionPerformed( ActionEvent ee) { ((InterfaceDPointWithContent) currentPointIcon).showIndividual(); @@ -325,16 +336,19 @@ public class FunctionArea extends DArea implements Serializable { + getGraphInfo(e.getX(), e.getY()), new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { DPoint temp = FunctionArea.this.getDMeasures().getDPoint( FunctionArea.this.xPos, FunctionArea.this.yPos); DPointIcon icon1 = new DPointIcon() { + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } + @Override public void paint(Graphics g) { g.drawLine(-2, 0, 2, 0); g.drawLine(0, 0, 0, 4); @@ -348,6 +362,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, " Remove graph", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { clearGraph(FunctionArea.this.xPos, FunctionArea.this.yPos); @@ -357,6 +372,7 @@ public class FunctionArea extends DArea implements Serializable { addMenuItem(graphPopupMenu, " Change graph color", new ActionListener() { + @Override public void actionPerformed(ActionEvent ee) { changeColorGraph(FunctionArea.this.xPos, FunctionArea.this.yPos); diff --git a/src/eva2/gui/GOEPanel.java b/src/eva2/gui/GOEPanel.java index cd7b0f22..6dbf83d4 100644 --- a/src/eva2/gui/GOEPanel.java +++ b/src/eva2/gui/GOEPanel.java @@ -100,6 +100,7 @@ public class GOEPanel extends JPanel implements ItemListener { propertySheetPanel.addPropertyChangeListener( new PropertyChangeListener() { + @Override public void propertyChange(final PropertyChangeEvent event) { propChangeSupport.firePropertyChange("", backupObject, genericObjectEditor.getValue()); } diff --git a/src/eva2/gui/GenericArrayEditor.java b/src/eva2/gui/GenericArrayEditor.java index 5520c0e1..13ff8afe 100644 --- a/src/eva2/gui/GenericArrayEditor.java +++ b/src/eva2/gui/GenericArrayEditor.java @@ -75,6 +75,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { private ActionListener innerActionListener = new ActionListener() { // + @Override public void actionPerformed(ActionEvent e) { boolean consistentView = true; // be optimistic... if (view instanceof PropertyText) { // check consistency! @@ -171,6 +172,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { new ListSelectionListener() { // + @Override public void valueChanged(ListSelectionEvent e) { if (e.getSource() == elementList) { @@ -216,6 +218,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { gae = genAE; } + @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); @@ -274,6 +277,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { * @param boolean true if the cell has the focus * @return the rendering component */ + @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, @@ -526,6 +530,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { private ActionListener makeSelectionKnownAL(final ActionListener al) { return new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (selectableList != null) { selectableList.setSelectionByIndices(elementList.getSelectedIndices()); @@ -550,6 +555,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { * * @param o an object that must be an array. */ + @Override public void setValue(Object o) { // Create a new list model, put it in the list and resize? updateEditorType(o); @@ -580,6 +586,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { * * @return the current object array */ + @Override public Object getValue() { if (listModel == null) { return null; @@ -606,6 +613,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { if (m_popupItemList.size() > 0) { elementList.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (selectableList != null) { selectableList.setSelectionByIndices(elementList.getSelectedIndices()); @@ -650,6 +658,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { * * @return the java source code initialisation string */ + @Override public String getJavaInitializationString() { return "null"; } @@ -659,6 +668,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { * * @return true */ + @Override public boolean isPaintable() { return true; } @@ -669,6 +679,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -689,6 +700,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String getAsText() { return null; } @@ -696,6 +708,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -703,6 +716,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String[] getTags() { return null; } @@ -710,6 +724,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public boolean supportsCustomEditor() { return true; } @@ -717,10 +732,12 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public Component getCustomEditor() { return this; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (propChangeSupport == null) { propChangeSupport = new PropertyChangeSupport(this); @@ -728,6 +745,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { propChangeSupport.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (propChangeSupport == null) { propChangeSupport = new PropertyChangeSupport(this); @@ -759,6 +777,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor { this.withDeleteButton = wB; } + @Override public void removeNotify() { super.removeNotify(); } diff --git a/src/eva2/gui/GenericDoubleArrayEditor.java b/src/eva2/gui/GenericDoubleArrayEditor.java index 0a5e0852..00cb5155 100644 --- a/src/eva2/gui/GenericDoubleArrayEditor.java +++ b/src/eva2/gui/GenericDoubleArrayEditor.java @@ -42,12 +42,14 @@ class MyFocusListener implements FocusListener { * (non-Javadoc) * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent) */ + @Override public void focusLost(FocusEvent e) { } /* * (non-Javadoc) * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent) */ + @Override public void focusGained(FocusEvent e) { arrEditor.notifyFocusID(myID);}; }; @@ -100,6 +102,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { this.m_OKButton = new JButton("OK"); this.m_OKButton.setEnabled(true); this.m_OKButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { //m_Backup = copyObject(m_Object); if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { @@ -119,6 +122,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** This action listener adds an element to DoubleArray */ ActionListener addAction = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_DoubleArray.addRowCopy(lastFocussedRow); // copy the last focussed row updateEditor(); @@ -128,6 +132,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** This action listener removes an element from the DoubleArray. */ ActionListener deleteAction = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (!m_DoubleArray.isValidRow(lastFocussedRow)) { m_DoubleArray.deleteRow(m_DoubleArray.getNumRows()-1); @@ -142,6 +147,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { * This action listener nomalizes each columng of the values of the DoubleArray. */ ActionListener normalizeAction = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_DoubleArray.normalizeColumns(); updateEditor(); @@ -151,11 +157,14 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[][] tmpDD = new double[m_InputTextFields.length][m_InputTextFields[0].length]; @@ -235,6 +244,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyDoubleArray) { this.m_DoubleArray = (PropertyDoubleArray) o; @@ -245,10 +255,12 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_DoubleArray; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -256,6 +268,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String getAsText() { return null; } @@ -263,6 +276,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -270,15 +284,18 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -301,6 +318,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -310,6 +328,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -320,6 +339,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -327,6 +347,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_CustomEditor == null) this.initCustomEditor(); return m_CustomEditor; diff --git a/src/eva2/gui/GenericEpsilonConstraintEditor.java b/src/eva2/gui/GenericEpsilonConstraintEditor.java index 596a8f09..c4169091 100644 --- a/src/eva2/gui/GenericEpsilonConstraintEditor.java +++ b/src/eva2/gui/GenericEpsilonConstraintEditor.java @@ -59,6 +59,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd this.m_OKButton = new JButton("OK"); this.m_OKButton.setEnabled(true); this.m_OKButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { //m_Backup = copyObject(m_Object); if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { @@ -75,6 +76,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** This action listener adds an element to DoubleArray */ ItemListener objectiveAction = new ItemListener() { + @Override public void itemStateChanged(ItemEvent event) { m_EpsilonConstraint.m_OptimizeObjective = m_Objective.getSelectedIndex(); updateEditor(); @@ -84,11 +86,14 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[] tmpT = m_EpsilonConstraint.m_TargetValue; @@ -143,6 +148,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyEpsilonConstraint) { this.m_EpsilonConstraint = (PropertyEpsilonConstraint) o; @@ -153,10 +159,12 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_EpsilonConstraint; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -164,6 +172,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** * */ + @Override public String getAsText() { return null; } @@ -171,6 +180,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -178,15 +188,18 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -209,6 +222,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -218,6 +232,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -228,6 +243,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -235,6 +251,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_CustomEditor == null) this.initCustomEditor(); return m_CustomEditor; diff --git a/src/eva2/gui/GenericEpsilonThresholdEditor.java b/src/eva2/gui/GenericEpsilonThresholdEditor.java index f2ad68fa..d5e514fd 100644 --- a/src/eva2/gui/GenericEpsilonThresholdEditor.java +++ b/src/eva2/gui/GenericEpsilonThresholdEditor.java @@ -59,6 +59,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi this.m_OKButton = new JButton("OK"); this.m_OKButton.setEnabled(true); this.m_OKButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { //m_Backup = copyObject(m_Object); if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { @@ -75,6 +76,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** This action listener adds an element to DoubleArray */ ItemListener objectiveAction = new ItemListener() { + @Override public void itemStateChanged(ItemEvent event) { m_EpsilonThreshhold.m_OptimizeObjective = m_Objective.getSelectedIndex(); updateEditor(); @@ -84,11 +86,14 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[] tmpT = m_EpsilonThreshhold.m_TargetValue; double[] tmpP = m_EpsilonThreshhold.m_Punishment; @@ -160,6 +165,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyEpsilonThreshold) { this.m_EpsilonThreshhold = (PropertyEpsilonThreshold) o; @@ -170,10 +176,12 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_EpsilonThreshhold; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -181,6 +189,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** * */ + @Override public String getAsText() { return null; } @@ -188,6 +197,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -195,15 +205,18 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -226,6 +239,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -235,6 +249,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -245,6 +260,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -252,6 +268,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_CustomEditor == null) this.initCustomEditor(); return m_CustomEditor; diff --git a/src/eva2/gui/GenericFilePathEditor.java b/src/eva2/gui/GenericFilePathEditor.java index 2b86f09f..d68e8631 100644 --- a/src/eva2/gui/GenericFilePathEditor.java +++ b/src/eva2/gui/GenericFilePathEditor.java @@ -39,6 +39,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyFilePath) { this.m_FilePath = (PropertyFilePath) o; @@ -48,10 +49,12 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_FilePath; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -59,6 +62,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String getAsText() { return null; } @@ -66,6 +70,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -73,15 +78,18 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -90,6 +98,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -99,6 +108,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -109,6 +119,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -116,6 +127,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { this.m_Panel = new JPanel(); this.m_FileChooser = new JFileChooser(); @@ -131,6 +143,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor { * the SOM to recalculate the mapping. */ ActionListener fileChooserAction = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (event.getActionCommand() == "ApproveSelection") { m_FilePath.setCompleteFilePath(m_FileChooser.getSelectedFile().getAbsolutePath()); diff --git a/src/eva2/gui/GenericIntArrayEditor.java b/src/eva2/gui/GenericIntArrayEditor.java index 3477da95..fd3067a4 100644 --- a/src/eva2/gui/GenericIntArrayEditor.java +++ b/src/eva2/gui/GenericIntArrayEditor.java @@ -53,6 +53,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { this.m_OKButton = new JButton("OK"); this.m_OKButton.setEnabled(true); this.m_OKButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { //m_Backup = copyObject(m_Object); if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { @@ -69,11 +70,14 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** This action listener reads all values */ KeyListener readIntArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { int[] tmpD = new int[m_InputTextField.length]; @@ -122,6 +126,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyIntArray) { this.m_IntArray = (PropertyIntArray) o; @@ -132,10 +137,12 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_IntArray; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -143,6 +150,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String getAsText() { return null; } @@ -150,6 +158,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -157,15 +166,18 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -188,6 +200,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -197,6 +210,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -207,6 +221,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -214,6 +229,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor { /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_CustomEditor == null) this.initCustomEditor(); return m_CustomEditor; diff --git a/src/eva2/gui/GenericObjectEditor.java b/src/eva2/gui/GenericObjectEditor.java index c0b8e317..58304643 100644 --- a/src/eva2/gui/GenericObjectEditor.java +++ b/src/eva2/gui/GenericObjectEditor.java @@ -311,6 +311,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @param o an object that must be a Object. */ + @Override public void setValue(Object o) { //System.err.println("setValue()" + m_ClassType.toString()); @@ -363,6 +364,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return the current Object */ + @Override public Object getValue() { return m_Object; } @@ -374,6 +376,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return the java source code initialization string */ + @Override public String getJavaInitializationString() { return "new " + m_Object.getClass().getName() + "()"; } @@ -383,6 +386,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return true */ + @Override public boolean isPaintable() { return true; } @@ -393,6 +397,7 @@ public class GenericObjectEditor implements PropertyEditor { * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { if (isEnabled && m_Object != null) { int getNameMethod = -1; @@ -435,6 +440,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return null */ + @Override public String getAsText() { return null; } @@ -445,6 +451,7 @@ public class GenericObjectEditor implements PropertyEditor { * @param text the text value * @exception IllegalArgumentException as we don't support getting/setting values as text. */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -454,6 +461,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return null */ + @Override public String[] getTags() { return null; } @@ -463,6 +471,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -472,6 +481,7 @@ public class GenericObjectEditor implements PropertyEditor { * * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (editorComponent == null) { editorComponent = new GOEPanel(m_Object, m_Backup, propertyChangeSupport, this); @@ -490,6 +500,7 @@ public class GenericObjectEditor implements PropertyEditor { editorComponent.setEnabledOkCancelButtons(false); } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (propertyChangeSupport == null) { propertyChangeSupport = new PropertyChangeSupport(this); @@ -497,6 +508,7 @@ public class GenericObjectEditor implements PropertyEditor { propertyChangeSupport.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (propertyChangeSupport == null) { propertyChangeSupport = new PropertyChangeSupport(this); diff --git a/src/eva2/gui/GenericObjectListSelectionEditor.java b/src/eva2/gui/GenericObjectListSelectionEditor.java index 37b10226..6852ef2a 100644 --- a/src/eva2/gui/GenericObjectListSelectionEditor.java +++ b/src/eva2/gui/GenericObjectListSelectionEditor.java @@ -48,6 +48,7 @@ public class GenericObjectListSelectionEditor extends AbstractListSelectionEdito /** Retruns the current object. * @return the current object */ + @Override public Object getValue() { return objList; } diff --git a/src/eva2/gui/GenericOptimizationObjectivesEditor.java b/src/eva2/gui/GenericOptimizationObjectivesEditor.java index e96bf71a..1ffa044f 100644 --- a/src/eva2/gui/GenericOptimizationObjectivesEditor.java +++ b/src/eva2/gui/GenericOptimizationObjectivesEditor.java @@ -194,6 +194,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** This action listener,... */ ActionListener updateTargets = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateTargetList(); } @@ -202,6 +203,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** This action listener,... */ ActionListener addTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_OptimizationObjectives.addTarget((InterfaceOptimizationObjective)m_OptimizationObjectives.getAvailableTargets()[0].clone()); int l = m_OptimizationObjectives.getSelectedTargets().length; @@ -234,6 +236,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** This action listener,... */ ActionListener deleteTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { int l = m_OptimizationObjectives.getSelectedTargets().length, j = 0; GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1]; @@ -266,6 +269,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyOptimizationObjectives) { this.m_OptimizationObjectives= (PropertyOptimizationObjectives) o; @@ -276,10 +280,12 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_OptimizationObjectives; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -287,6 +293,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** * */ + @Override public String getAsText() { return null; } @@ -294,6 +301,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -301,6 +309,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** * */ + @Override public String[] getTags() { return null; } @@ -322,6 +331,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -331,6 +341,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -341,6 +352,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -348,6 +360,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_Editor == null) this.initCustomEditor(); return m_Editor; @@ -363,11 +376,13 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope /********************************* java.beans.PropertyChangeListener *************************/ + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -376,6 +391,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope * editing an object. * @param evt */ + @Override public void propertyChange(PropertyChangeEvent evt) { Object newVal = evt.getNewValue(); Object oldVal = evt.getOldValue(); diff --git a/src/eva2/gui/GenericOptimizationObjectivesWithParamEditor.java b/src/eva2/gui/GenericOptimizationObjectivesWithParamEditor.java index 010e0001..6c2e21f9 100644 --- a/src/eva2/gui/GenericOptimizationObjectivesWithParamEditor.java +++ b/src/eva2/gui/GenericOptimizationObjectivesWithParamEditor.java @@ -218,6 +218,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** This action listener,... */ ActionListener updateTargets = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateTargetList(); } @@ -226,6 +227,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** This action listener,... */ ActionListener addTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_OptimizationObjectivesWithWeights.addTarget((InterfaceOptimizationObjective)m_OptimizationObjectivesWithWeights.getAvailableTargets()[0].clone()); int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length; @@ -258,6 +260,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** This action listener,... */ ActionListener deleteTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length, j = 0; GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1]; @@ -276,6 +279,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** This action listener,... */ ActionListener normalizeWeights = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { double[] newW = m_OptimizationObjectivesWithWeights.getWeights(); double sum = 0; @@ -295,11 +299,14 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[] newW = m_OptimizationObjectivesWithWeights.getWeights(); @@ -332,6 +339,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyOptimizationObjectivesWithParam) { this.m_OptimizationObjectivesWithWeights= (PropertyOptimizationObjectivesWithParam) o; @@ -342,10 +350,12 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_OptimizationObjectivesWithWeights; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -353,6 +363,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** * */ + @Override public String getAsText() { return null; } @@ -360,6 +371,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -367,6 +379,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** * */ + @Override public String[] getTags() { return null; } @@ -388,6 +401,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -397,6 +411,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -407,6 +422,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -414,6 +430,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_Editor == null) this.initCustomEditor(); return m_Editor; @@ -429,11 +446,13 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme /********************************* java.beans.PropertyChangeListener *************************/ + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -442,6 +461,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme * editing an object. * @param evt */ + @Override public void propertyChange(PropertyChangeEvent evt) { Object newVal = evt.getNewValue(); Object oldVal = evt.getOldValue(); diff --git a/src/eva2/gui/GenericRemoteServersEditor.java b/src/eva2/gui/GenericRemoteServersEditor.java index 8ec1193e..77a356e0 100644 --- a/src/eva2/gui/GenericRemoteServersEditor.java +++ b/src/eva2/gui/GenericRemoteServersEditor.java @@ -198,6 +198,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener saveServers = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { String text = m_RemoteServers.writeToText(); JFileChooser saver = new JFileChooser(); @@ -222,6 +223,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener killServers = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_RemoteServers.killServers(); updateServerList(); @@ -231,6 +233,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener startServers = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_RemoteServers.startServers(); updateServerList(); @@ -240,6 +243,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener updateServers = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateServerList(); } @@ -248,6 +252,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener addServer = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_RemoteServers.addServerNode("noname-"+m_RemoteServers.size(), 1); updateServerList(); @@ -258,6 +263,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener deleteServer = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { for (int i = 0; i < m_Delete.length; i++) { if (event.getSource().equals(m_Delete[i])) m_RemoteServers.removeServerNode(m_RemoteServers.get(i).m_ServerName); @@ -270,6 +276,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener,... */ ActionListener loadServers = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { String text = ""; JFileChooser reader = new JFileChooser(); @@ -300,10 +307,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener reads all values */ KeyListener loginListener = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { m_RemoteServers.setLogin(m_Login.getText()); } @@ -312,10 +322,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener reads all values */ KeyListener passwordListener = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { m_RemoteServers.setPassword(m_Password.getPassword()); } @@ -324,10 +337,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener reads all values */ KeyListener serverNameListener = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { for (int i = 0; i < m_Names.length; i++) { if (event.getSource().equals(m_Names[i])) m_RemoteServers.setNameFor(i, m_Names[i].getText()); @@ -338,6 +354,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This action listener adds an element to DoubleArray */ ItemListener cpuStateListener = new ItemListener() { + @Override public void itemStateChanged(ItemEvent event) { for (int i = 0; i < m_CPUs.length; i++) { if (event.getSource().equals(m_CPUs[i])) m_RemoteServers.setCPUsFor(i, m_CPUs[i].getSelectedIndex()+1); @@ -358,6 +375,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyRemoteServers) { this.m_RemoteServers = (PropertyRemoteServers) o; @@ -368,10 +386,12 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_RemoteServers; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -379,6 +399,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** * */ + @Override public String getAsText() { return null; } @@ -386,6 +407,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -393,15 +415,18 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -424,6 +449,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -433,6 +459,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -443,6 +470,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -450,6 +478,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_Editor == null) this.initCustomEditor(); return m_Editor; diff --git a/src/eva2/gui/GenericWeigthedLPTchebycheffEditor.java b/src/eva2/gui/GenericWeigthedLPTchebycheffEditor.java index 8282b53a..779f6a6b 100644 --- a/src/eva2/gui/GenericWeigthedLPTchebycheffEditor.java +++ b/src/eva2/gui/GenericWeigthedLPTchebycheffEditor.java @@ -58,6 +58,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper this.m_OKButton = new JButton("OK"); this.m_OKButton.setEnabled(true); this.m_OKButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { //m_Backup = copyObject(m_Object); if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { @@ -74,11 +75,14 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** This action listener reads all values */ KeyListener readDoubleAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { try { int d = new Integer(m_PValue.getText()).intValue(); @@ -92,11 +96,14 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[] tmpT = m_WLPT.m_IdealValue; double[] tmpP = m_WLPT.m_Weights; @@ -167,6 +174,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyWeightedLPTchebycheff) { this.m_WLPT = (PropertyWeightedLPTchebycheff) o; @@ -177,10 +185,12 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_WLPT; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -188,6 +198,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** * */ + @Override public String getAsText() { return null; } @@ -195,6 +206,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -202,15 +214,18 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** * */ + @Override public String[] getTags() { return null; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -233,6 +248,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -242,6 +258,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -252,6 +269,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -259,6 +277,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_CustomEditor == null) this.initCustomEditor(); return m_CustomEditor; diff --git a/src/eva2/gui/GraphPointSetLegend.java b/src/eva2/gui/GraphPointSetLegend.java index df24060a..bb2e6b5d 100644 --- a/src/eva2/gui/GraphPointSetLegend.java +++ b/src/eva2/gui/GraphPointSetLegend.java @@ -43,6 +43,7 @@ public class GraphPointSetLegend { * * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ + @Override public int compare(Pair o1, Pair o2) { int comp = o1.car().compareTo(o2.car()); // Same text; let us see if the color is also identical. diff --git a/src/eva2/gui/HtmlDemo.java b/src/eva2/gui/HtmlDemo.java index c48b3a71..46120ecf 100644 --- a/src/eva2/gui/HtmlDemo.java +++ b/src/eva2/gui/HtmlDemo.java @@ -104,6 +104,7 @@ public class HtmlDemo { */ public HyperlinkListener createHyperLinkListener() { return new HyperlinkListener() { + @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e instanceof HTMLFrameHyperlinkEvent) { diff --git a/src/eva2/gui/JEFrame.java b/src/eva2/gui/JEFrame.java index a6fad905..9233b7ed 100644 --- a/src/eva2/gui/JEFrame.java +++ b/src/eva2/gui/JEFrame.java @@ -81,6 +81,7 @@ public class JEFrame extends JInternalFrame { this.getRootPane().getActionMap().put( "ctrlFpressed", new AbstractAction("ctrlFpressed") { + @Override public void actionPerformed(ActionEvent actionEvent) { JEFrameRegister.getInstance().getFrameList().get(0).toFront(); } @@ -93,6 +94,7 @@ public class JEFrame extends JInternalFrame { this.getRootPane().getActionMap().put( "ctrlOpressed", new AbstractAction("ctrlOpressed") { + @Override public void actionPerformed(ActionEvent actionEvent) { java.util.List frameList = JEFrameRegister.getInstance().getFrameList(); for (JEFrame frame : frameList) { @@ -109,6 +111,7 @@ public class JEFrame extends JInternalFrame { this.getRootPane().getActionMap().put( "ctrlSmallerpressed", new AbstractAction("ctrlSmallerpressed") { + @Override public void actionPerformed(ActionEvent actionEvent) { JEFrameRegister.getInstance().setFocusToNext(self); } diff --git a/src/eva2/gui/JExtDesktopPane.java b/src/eva2/gui/JExtDesktopPane.java index 6ff84ff2..5b52045a 100644 --- a/src/eva2/gui/JExtDesktopPane.java +++ b/src/eva2/gui/JExtDesktopPane.java @@ -206,6 +206,7 @@ public class JExtDesktopPane extends JDesktopPane { public int getFrameCount() { return getComponentCount(new ComponentFilter() { + @Override public boolean accept(Component c) { return c instanceof JInternalFrame || (c instanceof JInternalFrame.JDesktopIcon @@ -237,6 +238,7 @@ public class JExtDesktopPane extends JDesktopPane { } } + @Override public void addImpl(Component comp, Object constraints, int index) { super.addImpl(comp, constraints, index); //System.out.println("JExtDesktopPane.addImpl"); diff --git a/src/eva2/gui/JExtFileChooser.java b/src/eva2/gui/JExtFileChooser.java index e787bb57..8b802ee5 100644 --- a/src/eva2/gui/JExtFileChooser.java +++ b/src/eva2/gui/JExtFileChooser.java @@ -26,6 +26,7 @@ public class JExtFileChooser extends JFileChooser{ return overwriteWarning; } + @Override public void approveSelection(){ if(getDialogType() == JFileChooser.SAVE_DIALOG && overwriteWarning){ File f = getSelectedFile(); diff --git a/src/eva2/gui/JExtMenu.java b/src/eva2/gui/JExtMenu.java index b173707a..624df34c 100644 --- a/src/eva2/gui/JExtMenu.java +++ b/src/eva2/gui/JExtMenu.java @@ -45,6 +45,7 @@ public class JExtMenu extends JMenu{ /** * */ + @Override public JMenuItem add(Action a){ JMenuItem item = super.add(a); Object o; @@ -59,8 +60,10 @@ public class JExtMenu extends JMenu{ /** * */ + @Override protected PropertyChangeListener createActionChangeListener(JMenuItem b){ return new ExtActionChangedListener(b){ + @Override public void propertyChange(PropertyChangeEvent e) { JMenuItem menuItem = (JMenuItem)component; if(menuItem == null) return; diff --git a/src/eva2/gui/JExtToolBar.java b/src/eva2/gui/JExtToolBar.java index 13226546..33a0b8de 100644 --- a/src/eva2/gui/JExtToolBar.java +++ b/src/eva2/gui/JExtToolBar.java @@ -18,6 +18,7 @@ import javax.swing.*; * */ public class JExtToolBar extends JToolBar{ + @Override public JButton add(Action a){ JButton button = super.add(a); button.setText(null); @@ -49,8 +50,10 @@ public class JExtToolBar extends JToolBar{ return result.toString(); } + @Override protected PropertyChangeListener createActionChangeListener(JButton b){ return new ExtActionChangedListener(b){ + @Override public void propertyChange(PropertyChangeEvent e){ JButton button = (JButton)component; diff --git a/src/eva2/gui/JParaPanel.java b/src/eva2/gui/JParaPanel.java index 6f05e79c..edd0d3e4 100644 --- a/src/eva2/gui/JParaPanel.java +++ b/src/eva2/gui/JParaPanel.java @@ -39,6 +39,7 @@ public class JParaPanel implements Serializable, PanelMaker { /** */ + @Override public JComponent makePanel() { PropertyEditorProvider.installEditors(); diff --git a/src/eva2/gui/JTextEditorInternalFrame.java b/src/eva2/gui/JTextEditorInternalFrame.java index b24118ab..276ee88e 100644 --- a/src/eva2/gui/JTextEditorInternalFrame.java +++ b/src/eva2/gui/JTextEditorInternalFrame.java @@ -34,6 +34,7 @@ public class JTextEditorInternalFrame extends JDocFrame{ setEnabled(false); } + @Override public void actionPerformed(ActionEvent e){ try{ undo.undo(); @@ -64,6 +65,7 @@ public class JTextEditorInternalFrame extends JDocFrame{ setEnabled(false); } + @Override public void actionPerformed(ActionEvent e) { try{ undo.redo(); @@ -93,16 +95,19 @@ public class JTextEditorInternalFrame extends JDocFrame{ /////////////////////////////////////////// // ///////////////////////////////////////// + @Override public String[] getActionGroups(){ return actionGroups; } private JMenu mnuEdit; private JToolBar barEdit; + @Override public JMenu getMenu(String group){ if(GROUP_EDIT.equals(group)) return mnuEdit; else return null; } + @Override public JToolBar getToolBar(String group){ if(GROUP_EDIT.equals(group)) return barEdit; return null; @@ -203,20 +208,24 @@ public class JTextEditorInternalFrame extends JDocFrame{ setChanged(true); } + @Override public void changedUpdate(DocumentEvent e){ changed(); } + @Override public void insertUpdate(DocumentEvent e){ changed(); } + @Override public void removeUpdate(DocumentEvent e){ changed(); } }); textArea.getDocument().addUndoableEditListener(new UndoableEditListener(){ + @Override public void undoableEditHappened(UndoableEditEvent e){ undo.addEdit(e.getEdit()); actUndo.update(); @@ -259,6 +268,7 @@ public class JTextEditorInternalFrame extends JDocFrame{ createActions(); } + @Override public void save(File f){ FileWriter out = null; try{ @@ -276,6 +286,7 @@ public class JTextEditorInternalFrame extends JDocFrame{ super.save(f); } + @Override public void setSelected(boolean value) throws java.beans.PropertyVetoException{ super.setSelected(value); diff --git a/src/eva2/gui/JTextoutputFrame.java b/src/eva2/gui/JTextoutputFrame.java index d39537f5..f37bf8b4 100644 --- a/src/eva2/gui/JTextoutputFrame.java +++ b/src/eva2/gui/JTextoutputFrame.java @@ -41,6 +41,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen /** * */ + @Override public void print(String text) { if (textArea == null) { createFrame(); @@ -49,10 +50,12 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen textArea.repaint(); } + @Override public void println(String txt) { print(txt + '\n'); } + @Override public void setShow(boolean bShow) { if (frame.isVisible() != bShow) { if (frame.isVisible()) { @@ -100,6 +103,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen private int lastHeight; // + @Override public void stateChanged(ChangeEvent e) { JViewport viewport = (JViewport) e.getSource(); int Height = viewport.getViewSize().height; @@ -131,6 +135,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen textArea.addMouseListener(popupListener); } + @Override public void actionPerformed(ActionEvent e) { JMenuItem src = (JMenuItem) e.getSource(); if (src == clearItem) { @@ -157,10 +162,12 @@ class PopupListener extends MouseAdapter { popup = pm; } + @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } + @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } diff --git a/src/eva2/gui/LoggingPanel.java b/src/eva2/gui/LoggingPanel.java index ab567a4c..55de26ac 100644 --- a/src/eva2/gui/LoggingPanel.java +++ b/src/eva2/gui/LoggingPanel.java @@ -70,6 +70,7 @@ public class LoggingPanel extends JPanel { scrollpane.getViewport().addChangeListener(new ChangeListener() { private int lastHeight; // + @Override public void stateChanged(ChangeEvent e) { JViewport viewport = (JViewport)e.getSource(); int height = viewport.getViewSize().height; diff --git a/src/eva2/gui/MultiLineStringEditor.java b/src/eva2/gui/MultiLineStringEditor.java index 56906b3a..62028a11 100644 --- a/src/eva2/gui/MultiLineStringEditor.java +++ b/src/eva2/gui/MultiLineStringEditor.java @@ -17,23 +17,31 @@ import java.awt.event.*; public class MultiLineStringEditor implements PropertyEditor { protected MultiLineString value; // The value we will be editing. + @Override public void setValue(Object o) { value=(MultiLineString) o;} + @Override public Object getValue() { return value; } + @Override public void setAsText(String s) { value.setString(s); } + @Override public String getAsText() { return value.getString(); } + @Override public String[] getTags() { return null; } // not enumerated; no tags // Say that we allow custom editing. + @Override public boolean supportsCustomEditor() { return true; } // Return the custom editor. This just creates and returns a TextArea // to edit the multi-line text. But it also registers a listener on the // text area to update the value as the user types and to fire the // property change events that property editors are required to fire. + @Override public Component getCustomEditor() { final TextArea t = new TextArea(value.string); t.setSize(300, 150); // TextArea doesn't have a preferred size, so set one t.addTextListener(new TextListener() { + @Override public void textValueChanged(TextEvent e) { value.setString(t.getText()); listeners.firePropertyChange(null, null, null); @@ -45,8 +53,10 @@ public class MultiLineStringEditor implements PropertyEditor { // Visual display of the value, for use with the custom editor. // Just print some instructions and hope they fit in the in the box. // This could be more sophisticated. + @Override public boolean isPaintable() { return true; } + @Override public void paintValue(Graphics g, Rectangle r) { g.setClip(r); g.drawString("Click to edit...", r.x+5, r.y+15); @@ -54,17 +64,20 @@ public class MultiLineStringEditor implements PropertyEditor { // Important method for code generators. Note that it // ought to add any necessary escape sequences. + @Override public String getJavaInitializationString() { return "\"" + value + "\""; } // This code uses the PropertyChangeSupport class to maintain a list of // listeners interested in the edits we make to the value. protected PropertyChangeSupport listeners = new PropertyChangeSupport(this); + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (listeners == null) listeners = new PropertyChangeSupport(this); listeners.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (listeners == null) listeners = new PropertyChangeSupport(this); listeners.removePropertyChangeListener(l); diff --git a/src/eva2/gui/Plot.java b/src/eva2/gui/Plot.java index 83afbb3b..867f9cda 100644 --- a/src/eva2/gui/Plot.java +++ b/src/eva2/gui/Plot.java @@ -109,6 +109,7 @@ public class Plot implements PlotInterface, Serializable { JButton ClearButton = new JButton("Clear"); ClearButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { clearAll(); } @@ -117,6 +118,7 @@ public class Plot implements PlotInterface, Serializable { LOGButton.setToolTipText("Toggle between a linear and a log scale on the y-axis."); LOGButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { m_PlotArea.toggleLog(); } @@ -125,6 +127,7 @@ public class Plot implements PlotInterface, Serializable { ExportButton.setToolTipText("Exports the graph data to a simple TSV file."); ExportButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { exportPlot(); } @@ -133,6 +136,7 @@ public class Plot implements PlotInterface, Serializable { DumpButton.setToolTipText("Dump the graph data to standard output"); DumpButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { m_PlotArea.exportToAscii(); } @@ -141,6 +145,7 @@ public class Plot implements PlotInterface, Serializable { JButton saveImageButton = new JButton("Save as PNG..."); saveImageButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { try { Robot robot = new Robot(); @@ -211,6 +216,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void init() { m_Frame = new JEFrame("Plot: " + plotName); BasicResourceLoader loader = BasicResourceLoader.instance(); @@ -315,6 +321,7 @@ public class Plot implements PlotInterface, Serializable { * * @return true if the Plot object is valid */ + @Override public boolean isValid() { return (m_Frame != null) && (m_PlotArea != null); } @@ -322,10 +329,12 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void setConnectedPoint(double x, double y, int func) { m_PlotArea.setConnectedPoint(x, y, func); } + @Override public int getPointCount(int graphLabel) { return m_PlotArea.getPointCount(graphLabel); } @@ -333,6 +342,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void addGraph(int g1, int g2, boolean forceAdd) { m_PlotArea.addGraph(g1, g2, forceAdd); } @@ -340,6 +350,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void setUnconnectedPoint(double x, double y, int GraphLabel) { m_PlotArea.setUnconnectedPoint(x, y, GraphLabel); } @@ -347,6 +358,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void clearAll() { m_PlotArea.clearAll(); m_PlotArea.removeAllDElements(); @@ -357,6 +369,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void clearGraph(int GraphNumber) { m_PlotArea.clearGraph(GraphNumber); } @@ -364,6 +377,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void setInfoString(int GraphLabel, String Info, float stroke) { m_PlotArea.setInfoString(GraphLabel, Info, stroke); } @@ -371,6 +385,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public void jump() { m_PlotArea.jump(); } @@ -471,6 +486,7 @@ public class Plot implements PlotInterface, Serializable { /** * */ + @Override public String getName() { return this.plotName; } diff --git a/src/eva2/gui/PropertyBoolSelector.java b/src/eva2/gui/PropertyBoolSelector.java index 4f9da241..afddf8da 100644 --- a/src/eva2/gui/PropertyBoolSelector.java +++ b/src/eva2/gui/PropertyBoolSelector.java @@ -22,6 +22,7 @@ public class PropertyBoolSelector extends JCheckBox { setSelected(false); addItemListener(new ItemListener () { + @Override public void itemStateChanged (ItemEvent evt) { if (evt.getStateChange() == ItemEvent.SELECTED) { m_Editor.setValue(Boolean.TRUE); diff --git a/src/eva2/gui/PropertyDoubleArray.java b/src/eva2/gui/PropertyDoubleArray.java index 0acbbc58..e643c35f 100644 --- a/src/eva2/gui/PropertyDoubleArray.java +++ b/src/eva2/gui/PropertyDoubleArray.java @@ -42,6 +42,7 @@ public class PropertyDoubleArray implements java.io.Serializable { } } + @Override public Object clone() { return (Object) new PropertyDoubleArray(this); } @@ -165,6 +166,7 @@ public class PropertyDoubleArray implements java.io.Serializable { return (k>=0) && (k implements java.io.Serializable { } } + @Override public Object clone() { return (Object) new PropertySelectableList(this); } diff --git a/src/eva2/gui/PropertySheetPanel.java b/src/eva2/gui/PropertySheetPanel.java index d36d813f..116f7b1b 100644 --- a/src/eva2/gui/PropertySheetPanel.java +++ b/src/eva2/gui/PropertySheetPanel.java @@ -108,6 +108,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener * * @param evt a value of type 'PropertyChangeEvent' */ + @Override public void propertyChange(PropertyChangeEvent evt) { wasModified(evt); // Let our panel update before guys downstream propertyChangeSupport.removePropertyChangeListener(this); @@ -115,6 +116,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener propertyChangeSupport.addPropertyChangeListener(this); } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (propertyChangeSupport == null) { propertyChangeSupport = new PropertyChangeSupport(this); @@ -122,6 +124,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener propertyChangeSupport.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (propertyChangeSupport == null) { propertyChangeSupport = new PropertyChangeSupport(this); diff --git a/src/eva2/gui/PropertySheetPanelStat.java b/src/eva2/gui/PropertySheetPanelStat.java index bef95f67..c2661a24 100644 --- a/src/eva2/gui/PropertySheetPanelStat.java +++ b/src/eva2/gui/PropertySheetPanelStat.java @@ -117,6 +117,7 @@ class JCheckBoxFlag extends JCheckBox { m_Flag = flag; addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent evt) { if (evt.getStateChange() == evt.SELECTED) { m_Flag = true; diff --git a/src/eva2/gui/PropertySlider.java b/src/eva2/gui/PropertySlider.java index 60c48b40..5e89f8f2 100644 --- a/src/eva2/gui/PropertySlider.java +++ b/src/eva2/gui/PropertySlider.java @@ -44,12 +44,14 @@ class PropertySlider extends JPanel { this.add(slider); propertyEditor.addPropertyChangeListener(new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { updateUs(); } }); addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { // if (e.getKeyCode() == KeyEvent.VK_ENTER) updateEditor(); @@ -57,6 +59,7 @@ class PropertySlider extends JPanel { }); addFocusListener(new FocusAdapter() { + @Override public void focusLost(FocusEvent e) { updateEditor(); } @@ -95,6 +98,7 @@ class PropertySlider extends JPanel { public SliderListener() { } + @Override public void stateChanged(ChangeEvent e) { JSlider s1 = (JSlider) e.getSource(); System.out.println("slider" + s1.getValue()); diff --git a/src/eva2/gui/PropertyValueSelector.java b/src/eva2/gui/PropertyValueSelector.java index bfe1ca3f..ea9fc745 100644 --- a/src/eva2/gui/PropertyValueSelector.java +++ b/src/eva2/gui/PropertyValueSelector.java @@ -31,6 +31,7 @@ public class PropertyValueSelector extends JComboBox { /** * */ + @Override public Object getSelectedItem() { return propertyEditor.getAsText(); } @@ -38,6 +39,7 @@ public class PropertyValueSelector extends JComboBox { /** * */ + @Override public void setSelectedItem(Object o) { propertyEditor.setAsText((String) o); } diff --git a/src/eva2/gui/PropertyWeightedLPTchebycheff.java b/src/eva2/gui/PropertyWeightedLPTchebycheff.java index 8ea601e3..6abfcf7e 100644 --- a/src/eva2/gui/PropertyWeightedLPTchebycheff.java +++ b/src/eva2/gui/PropertyWeightedLPTchebycheff.java @@ -28,6 +28,7 @@ public class PropertyWeightedLPTchebycheff implements java.io.Serializable { this.m_P = e.m_P; } + @Override public Object clone() { return (Object) new PropertyWeightedLPTchebycheff(this); } diff --git a/src/eva2/gui/StatisticsEditor.java b/src/eva2/gui/StatisticsEditor.java index e14f9fb6..5b771512 100644 --- a/src/eva2/gui/StatisticsEditor.java +++ b/src/eva2/gui/StatisticsEditor.java @@ -32,6 +32,7 @@ public class StatisticsEditor implements PropertyEditor { m_StatPanel.addPropertyChangeListener( new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { m_Support.firePropertyChange("", null, null); } @@ -47,6 +48,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public void setValue(Object value) { if (value instanceof GenericStatistics) { m_Value = (GenericStatistics) value; @@ -58,6 +60,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public Object getValue() { System.out.println("getValue !!!!!!!!!!!!"); m_Value.setState(m_StatPanel.getState()); @@ -67,6 +70,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public String getJavaInitializationString() { return "null"; } @@ -74,6 +78,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public boolean isPaintable() { return true; } @@ -81,6 +86,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -91,6 +97,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public String getAsText() { return null; } @@ -98,6 +105,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -105,6 +113,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public String[] getTags() { return null; } @@ -112,6 +121,7 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public boolean supportsCustomEditor() { return true; } @@ -119,10 +129,12 @@ public class StatisticsEditor implements PropertyEditor { /** * */ + @Override public Component getCustomEditor() { return m_Panel; } + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) { m_Support = new PropertyChangeSupport(this); @@ -130,6 +142,7 @@ public class StatisticsEditor implements PropertyEditor { m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) { m_Support = new PropertyChangeSupport(this); diff --git a/src/eva2/gui/TagEditor.java b/src/eva2/gui/TagEditor.java index e890de08..79d1dfca 100644 --- a/src/eva2/gui/TagEditor.java +++ b/src/eva2/gui/TagEditor.java @@ -32,6 +32,7 @@ public class TagEditor extends PropertyEditorSupport { * * @return a value of type 'String' */ + @Override public String getJavaInitializationString() { SelectedTag s = (SelectedTag)getValue(); @@ -56,6 +57,7 @@ public class TagEditor extends PropertyEditorSupport { * * @return a value of type 'String' */ + @Override public String getAsText() { SelectedTag s = (SelectedTag)getValue(); return s.getSelectedTag().getString(); @@ -67,6 +69,7 @@ public class TagEditor extends PropertyEditorSupport { * @param text the text of the selected tag. * @exception java.lang.IllegalArgumentException if an error occurs */ + @Override public void setAsText(String text) throws java.lang.IllegalArgumentException { SelectedTag s = (SelectedTag)getValue(); Tag [] tags = s.getTags(); @@ -87,6 +90,7 @@ public class TagEditor extends PropertyEditorSupport { * * @return an array of string tags. */ + @Override public String[] getTags() { SelectedTag s = (SelectedTag)getValue(); @@ -123,6 +127,7 @@ public class TagEditor extends PropertyEditorSupport { byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true); f.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes)); f.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent e) { System.exit(0); } diff --git a/src/eva2/gui/utils/CustomTabbedPaneUI.java b/src/eva2/gui/utils/CustomTabbedPaneUI.java index bea077ce..a5d7e68a 100644 --- a/src/eva2/gui/utils/CustomTabbedPaneUI.java +++ b/src/eva2/gui/utils/CustomTabbedPaneUI.java @@ -68,10 +68,12 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { contentInsets = new Insets(i, i, i, i); } + @Override public int getTabRunCount(JTabbedPane pane) { return 1; } + @Override protected void installDefaults() { super.installDefaults(); @@ -87,15 +89,18 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { return false; } + @Override protected Insets getContentBorderInsets(int tabPlacement) { return contentInsets; } + @Override protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) { return 21; } + @Override protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) { int w = super.calculateTabWidth(tabPlacement, tabIndex, metrics); @@ -104,10 +109,12 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { return w; } + @Override protected int calculateMaxTabHeight(int tabPlacement) { return 21; } + @Override protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) { Graphics2D g2d = (Graphics2D) g; g2d.setPaint(new GradientPaint(0, 0, defaultColorSet.topGradColor1, 0, @@ -125,6 +132,7 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { } } + @Override protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Graphics2D g2d = (Graphics2D) g; @@ -164,6 +172,7 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { } } + @Override protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Rectangle rect = getTabBounds(tabIndex, new Rectangle(x, y, w, h)); @@ -171,31 +180,37 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { g.drawLine(rect.x + rect.width, 0, rect.x + rect.width, 20); } + @Override protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { } + @Override protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { // Do nothing } + @Override protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { // Do nothing } + @Override protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { // Do nothing } + @Override protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) { // Do nothing } + @Override protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) { return 0; @@ -212,26 +227,33 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI { private class RollOverListener implements MouseMotionListener, MouseListener { + @Override public void mouseDragged(MouseEvent e) { } + @Override public void mouseMoved(MouseEvent e) { checkRollOver(); } + @Override public void mouseClicked(MouseEvent e) { } + @Override public void mousePressed(MouseEvent e) { } + @Override public void mouseReleased(MouseEvent e) { } + @Override public void mouseEntered(MouseEvent e) { checkRollOver(); } + @Override public void mouseExited(MouseEvent e) { tabPane.repaint(); } diff --git a/src/eva2/server/EvAMainAdapterImpl.java b/src/eva2/server/EvAMainAdapterImpl.java index 93a34412..0cdf0b44 100644 --- a/src/eva2/server/EvAMainAdapterImpl.java +++ b/src/eva2/server/EvAMainAdapterImpl.java @@ -26,14 +26,17 @@ public class EvAMainAdapterImpl extends MainAdapterImpl implements EvAMainAdapte moduleServer = new ModuleServer(EvAInfo.getProperties()); } + @Override public String[] getModuleNameList() { return moduleServer.getModuleNameList(); } + @Override public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, MainAdapterClient client) { return getModuleAdapter(selectedModule, withoutRMI, hostAddress, null, null, client); } + @Override public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, InterfaceGOParameters goParams, String noGuiStatsFile, MainAdapterClient client) { return moduleServer.createModuleAdapter(selectedModule, client, withoutRMI, hostAddress, goParams, noGuiStatsFile); } diff --git a/src/eva2/server/RMIServerEvA.java b/src/eva2/server/RMIServerEvA.java index 17f21505..036049b1 100644 --- a/src/eva2/server/RMIServerEvA.java +++ b/src/eva2/server/RMIServerEvA.java @@ -27,6 +27,7 @@ public class RMIServerEvA extends RMIServer { return (RMIServerEvA)instance; } + @Override protected void createMainRemoteObject(String mainAdapterName) { try { mainRemoteObject = new EvAMainAdapterImpl(); diff --git a/src/eva2/server/go/GOStandaloneVersion.java b/src/eva2/server/go/GOStandaloneVersion.java index 3f45f414..f686fe2c 100644 --- a/src/eva2/server/go/GOStandaloneVersion.java +++ b/src/eva2/server/go/GOStandaloneVersion.java @@ -118,6 +118,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu this.m_Frame.setSize(500, 400); this.m_Frame.setLocation(530, 50); this.m_Frame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.exit(0); } @@ -197,11 +198,14 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu /** This action listener, called by the "Run/Restart" button, will init the problem and start the computation. */ ActionListener runListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { worker = new SwingWorker() { + @Override public Object construct() { return doWork(); } + @Override public void finished() { m_RunButton.setEnabled(true); m_Continue.setEnabled(true); @@ -221,6 +225,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu * the doWork() method handles InterruptedExceptions cleanly. */ ActionListener stopListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_RunButton.setEnabled(true); m_Continue.setEnabled(true); @@ -235,12 +240,15 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu * the doWork() method handles InterruptedExceptions cleanly. */ ActionListener continueListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // todo something need to be done here... worker = new SwingWorker() { + @Override public Object construct() { return doWork(); } + @Override public void finished() { m_RunButton.setEnabled(true); m_Continue.setEnabled(true); @@ -264,6 +272,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu * currently best solution in a frame. */ ActionListener showSolListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { JFrame frame = new JFrame(); frame.setTitle("The current best solution for "+m_GO.getProblem().getName()); @@ -278,6 +287,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu /** This method gives the experimental settings and starts the work. */ + @Override public void startExperiment() { // This is for the CBN-TEST RUNS this.m_GO.setOptimizer(new EvolutionStrategies()); @@ -508,6 +518,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu void updateStatus(final int i) { if (this.m_ProgressBar != null) { Runnable doSetProgressBarValue = new Runnable() { + @Override public void run() { m_ProgressBar.setValue(i); } @@ -533,6 +544,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu } } + @Override public void setShow(boolean t) { this.show = t; } @@ -541,6 +553,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu * @param source The source of the event. * @param name Could be used to indicate the nature of the event. */ + @Override public void registerPopulationStateChanged(Object source, String name) { if (name.equals(Population.nextGenerationPerformed)) { Population population = ((InterfaceOptimizer)source).getPopulation(); diff --git a/src/eva2/server/go/InterfaceTerminator.java b/src/eva2/server/go/InterfaceTerminator.java index d10793b9..06d37fe5 100644 --- a/src/eva2/server/go/InterfaceTerminator.java +++ b/src/eva2/server/go/InterfaceTerminator.java @@ -19,6 +19,7 @@ public interface InterfaceTerminator { public boolean isTerminated(PopulationInterface pop); public boolean isTerminated(InterfaceSolutionSet pop); + @Override public String toString(); public String lastTerminationMessage(); public void init(InterfaceOptimizationProblem prob); diff --git a/src/eva2/server/go/MOCCOStandalone.java b/src/eva2/server/go/MOCCOStandalone.java index eef7d792..0eca9906 100644 --- a/src/eva2/server/go/MOCCOStandalone.java +++ b/src/eva2/server/go/MOCCOStandalone.java @@ -58,6 +58,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati this.m_JFrame.setSize(1200, 750); this.m_JFrame.setLocation(50, 50); this.m_JFrame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.exit(0); } @@ -359,6 +360,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati /** This method starts the actual optimization procedure */ + @Override public void startExperiment() { if (this.m_JFrame != null) { } @@ -370,9 +372,11 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati if (this.m_State.m_Optimizer.getPopulation().size() == 0) this.m_State.m_Optimizer.init(); this.m_State.m_Optimizer.addPopulationChangedEventListener(this); worker = new SwingWorker() { + @Override public Object construct() { return doWork(); } + @Override public void finished() { Population[] pop = null; if (m_State.m_Optimizer instanceof IslandModelEA) { @@ -406,6 +410,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati void updateStatus(final String t, final int i) { if (this.m_ProgressBar != null) { Runnable doSetProgressBarValue = new Runnable() { + @Override public void run() { m_ProgressBar.setValue(i); } @@ -438,6 +443,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati return "All Done"; } + @Override public void setShow(boolean t) { // i guess this is not necessary in this environment } @@ -449,6 +455,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati * @param source The source of the event. * @param name Could be used to indicate the nature of the event. */ + @Override public void registerPopulationStateChanged(Object source, String name) { int currentProgress; if (name.equals(Population.nextGenerationPerformed)) { diff --git a/src/eva2/server/go/SwingWorker.java b/src/eva2/server/go/SwingWorker.java index b8aafdc3..10c3d286 100644 --- a/src/eva2/server/go/SwingWorker.java +++ b/src/eva2/server/go/SwingWorker.java @@ -89,10 +89,12 @@ public abstract class SwingWorker { */ public SwingWorker() { final Runnable doFinished = new Runnable() { + @Override public void run() { finished(); } }; Runnable doConstruct = new Runnable() { + @Override public void run() { try { setValue(construct()); diff --git a/src/eva2/server/go/individuals/AbstractEAIndividual.java b/src/eva2/server/go/individuals/AbstractEAIndividual.java index 025182a3..84c2ef6e 100644 --- a/src/eva2/server/go/individuals/AbstractEAIndividual.java +++ b/src/eva2/server/go/individuals/AbstractEAIndividual.java @@ -81,6 +81,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java. * * @return The clone */ + @Override public abstract Object clone(); /** @@ -595,6 +596,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java. * * @return The complete fitness array */ + @Override public double[] getFitness() { return this.m_Fitness; } @@ -620,6 +622,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java. * @param fitness The new fitness array * @deprecated */ + @Override public void setFitness(double[] fitness) { this.m_Fitness = fitness; } diff --git a/src/eva2/server/go/individuals/AbstractEAIndividualComparator.java b/src/eva2/server/go/individuals/AbstractEAIndividualComparator.java index 5a8316f8..c7508b87 100644 --- a/src/eva2/server/go/individuals/AbstractEAIndividualComparator.java +++ b/src/eva2/server/go/individuals/AbstractEAIndividualComparator.java @@ -108,6 +108,7 @@ public class AbstractEAIndividualComparator implements Comparator, Seria preferFeasible = other.preferFeasible; } + @Override public Object clone() { return new AbstractEAIndividualComparator(this); } @@ -120,6 +121,7 @@ public class AbstractEAIndividualComparator implements Comparator, Seria * @param o2 the second AbstractEAIndividual to compare * @return -1 if the first is dominant, 1 if the second is dominant, otherwise 0 */ + @Override public int compare(Object o1, Object o2) { boolean o1domO2, o2domO1; diff --git a/src/eva2/server/go/individuals/ESIndividualBinaryData.java b/src/eva2/server/go/individuals/ESIndividualBinaryData.java index 0cadac90..6ff16595 100644 --- a/src/eva2/server/go/individuals/ESIndividualBinaryData.java +++ b/src/eva2/server/go/individuals/ESIndividualBinaryData.java @@ -65,6 +65,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new ESIndividualBinaryData(this); } @@ -73,6 +74,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof ESIndividualBinaryData) { ESIndividualBinaryData indy = (ESIndividualBinaryData) individual; @@ -95,6 +97,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to request a certain amount of binary data * @param length The lenght of the BitSet that is to be optimized */ + @Override public void setBinaryDataLength(int length) { this.m_Genotype = new double[length]; this.m_Range = new double[length][2]; @@ -107,6 +110,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method returns the length of the binary data set * @return The number of bits stored */ + @Override public int size() { return this.m_Genotype.length; } @@ -114,6 +118,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBinaryData() { if (this.m_UseHardSwitch) { // In this case it is only tested if the genotyp is bigger than 0.5 @@ -141,6 +146,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte * an update from the genotype * @return BitSet representing the binary data. */ + @Override public BitSet getBinaryDataWithoutUpdate() { return this.m_Phenotype; } @@ -148,6 +154,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to set the binary data. * @param binaryData The new binary data. */ + @Override public void SetBinaryPhenotype(BitSet binaryData) { this.m_Phenotype = binaryData; } @@ -155,6 +162,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte * memetic algorithms. * @param binaryData The new binary data. */ + @Override public void SetBinaryGenotype(BitSet binaryData) { this.SetBinaryPhenotype(binaryData); for (int i = 0; i < this.m_Genotype.length; i++) { @@ -176,6 +184,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof BitSet) { BitSet bs = (BitSet) obj; @@ -192,6 +201,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "ESIndividual coding double: ("; @@ -215,6 +225,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method will allow the user to read the ES 'genotype' * @return BitSet */ + @Override public double[] getDGenotype() { return this.m_Genotype; } @@ -222,6 +233,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method will allow the user to set the current ES 'genotype'. * @param b The new genotype of the Individual */ + @Override public void SetDGenotype(double[] b) { this.m_Genotype = b; for (int i = 0; i < this.m_Genotype.length; i++) { @@ -242,16 +254,19 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { return this.m_Range; } /** This method performs a simple one element mutation on the double vector */ + @Override public void defaultMutate() { ESIndividualDoubleData.defaultMutate(m_Genotype, m_Range); } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange()); else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range); @@ -263,6 +278,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte * name to the current object. * @return The name. */ + @Override public String getName() { return "ES individual"; } diff --git a/src/eva2/server/go/individuals/ESIndividualDoubleData.java b/src/eva2/server/go/individuals/ESIndividualDoubleData.java index 52b1cd07..831bcd76 100644 --- a/src/eva2/server/go/individuals/ESIndividualDoubleData.java +++ b/src/eva2/server/go/individuals/ESIndividualDoubleData.java @@ -66,6 +66,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new ESIndividualDoubleData(this); } @@ -74,6 +75,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof ESIndividualDoubleData) { ESIndividualDoubleData indy = (ESIndividualDoubleData) individual; @@ -98,6 +100,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setDoubleDataLength (int length) { double[] newDesPa = new double[length]; double[][] newRange = new double[length][2]; @@ -131,6 +134,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method returns the length of the double data set * @return The number of bits stored */ + @Override public int size() { return this.m_Genotype.length; } @@ -140,6 +144,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * ranges. * @param range The new range for the double data. */ + @Override public void SetDoubleRange(double[][] range) { if (range.length != this.m_Range.length) { System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " @@ -154,6 +159,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { return this.m_Range; } @@ -162,6 +168,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * and the genotype copied. * @return BitSet representing the double data. */ + @Override public double[] getDoubleData() { // since the phenotype is set to null if the genotype is changed, // it should now be save to only perform the copy if the phenotype is null @@ -178,6 +185,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * an update from the genotype. * @return double[] representing the double data. */ + @Override public double[] getDoubleDataWithoutUpdate() { if (m_Phenotype==null) return getDoubleData(); else return this.m_Phenotype; @@ -187,6 +195,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * use SetDoubleDataLamarckian(). * @param doubleData The new double data. */ + @Override public void SetDoublePhenotype(double[] doubleData) { this.m_Phenotype = doubleData; } @@ -195,6 +204,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * memetic algorithms. * @param doubleData The new double data. */ + @Override public void SetDoubleGenotype(double[] doubleData) { // this.SetDoublePhenotype(doubleData); this.SetDoublePhenotype(null); // tag it as invalid @@ -208,6 +218,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method will allow a default initialisation of the individual * @param opt The optimization problem that is to be solved. */ + @Override public void init(InterfaceOptimizationProblem opt) { super.init(opt); // evil operators may not respect the range, so at least give some hint @@ -219,6 +230,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof double[]) { double[] bs = (double[]) obj; @@ -236,6 +248,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { StringBuilder strB = new StringBuilder(200); strB.append("ESIndividual coding double: (Fitness {"); @@ -264,6 +277,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method will allow the user to read the ES 'genotype' * @return BitSet */ + @Override public double[] getDGenotype() { return this.m_Genotype; } @@ -271,6 +285,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method will allow the user to set the current ES 'genotype'. * @param b The new genotype of the Individual */ + @Override public void SetDGenotype(double[] b) { this.m_Genotype = b; this.m_Phenotype=null; // mark it as invalid @@ -290,6 +305,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method performs a simple one element mutation on the double vector */ + @Override public void defaultMutate() { ESIndividualDoubleData.defaultMutate(this.m_Genotype, this.m_Range); m_Phenotype=null; // mark it as invalid @@ -310,6 +326,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte if (genotype[mutationIndex] > range[mutationIndex][1]) genotype[mutationIndex] = range[mutationIndex][1]; } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange()); else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range); @@ -336,6 +353,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte * name to the current object. * @return The name. */ + @Override public String getName() { return "ES individual"; } diff --git a/src/eva2/server/go/individuals/ESIndividualIntegerData.java b/src/eva2/server/go/individuals/ESIndividualIntegerData.java index eb415d09..4897adda 100644 --- a/src/eva2/server/go/individuals/ESIndividualIntegerData.java +++ b/src/eva2/server/go/individuals/ESIndividualIntegerData.java @@ -61,6 +61,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new ESIndividualIntegerData(this); } @@ -69,6 +70,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof ESIndividualIntegerData) { ESIndividualIntegerData indy = (ESIndividualIntegerData) individual; @@ -91,6 +93,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to request a certain amount of int data * @param length The lenght of the int[] that is to be optimized */ + @Override public void setIntegerDataLength (int length) { double[] newDesPa = new double[length]; int[][] newRange = new int[length][2]; @@ -115,6 +118,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method returns the length of the int data set * @return The number of ints stored */ + @Override public int size() { return this.m_Genotype.length; } @@ -124,6 +128,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * ranges. * @param range The new range for the int data. */ + @Override public void SetIntRange(int[][] range) { if (range.length != this.m_Range.length) { System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " @@ -138,6 +143,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will return the range for all int attributes. * @return The range array. */ + @Override public int[][] getIntRange() { return this.m_Range; } @@ -145,6 +151,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to read the int data * @return int[] representing the int data. */ + @Override public int[] getIntegerData() { this.m_Phenotype = new int[this.m_Genotype.length]; for (int i = 0; i < this.m_Phenotype.length; i++) { @@ -159,6 +166,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * an update from the genotype * @return int[] representing the int data. */ + @Override public int[] getIntegerDataWithoutUpdate() { return this.m_Phenotype; } @@ -166,6 +174,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to set the int data. * @param intData The new int data. */ + @Override public void SetIntPhenotype(int[] intData) { this.m_Phenotype = intData; } @@ -174,6 +183,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * memetic algorithms. * @param intData The new int data. */ + @Override public void SetIntGenotype(int[] intData) { for (int i = 0; i < this.m_Genotype.length; i++) { m_Genotype[i]=(double)intData[i]; @@ -190,6 +200,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof int[]) { int[] bs = (int[]) obj; @@ -207,6 +218,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "ESIndividual coding int: ("; @@ -229,6 +241,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will allow the user to read the ES 'genotype' * @return BitSet */ + @Override public double[] getDGenotype() { return this.m_Genotype; } @@ -236,6 +249,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will allow the user to set the current ES 'genotype'. * @param b The new genotype of the Individual */ + @Override public void SetDGenotype(double[] b) { this.m_Genotype = b; for (int i = 0; i < this.m_Genotype.length; i++) { @@ -246,6 +260,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method performs a simple one element mutation on the double vector */ + @Override public void defaultMutate() { int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1); this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RNG.gaussianDouble(0.05f); @@ -256,6 +271,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { double[][] result = new double[this.m_Range.length][2]; for (int i = 0; i < this.m_Range.length; i++) { @@ -265,6 +281,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int return result; } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { int[][] range = m_Range; if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange(); @@ -279,6 +296,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int * name to the current object. * @return The name. */ + @Override public String getName() { return "ES individual"; } diff --git a/src/eva2/server/go/individuals/ESIndividualPermutationData.java b/src/eva2/server/go/individuals/ESIndividualPermutationData.java index b1698d58..50501474 100644 --- a/src/eva2/server/go/individuals/ESIndividualPermutationData.java +++ b/src/eva2/server/go/individuals/ESIndividualPermutationData.java @@ -79,6 +79,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements } + @Override public Object clone() { return (Object) new ESIndividualPermutationData(this); } @@ -87,6 +88,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof ESIndividualPermutationData) { ESIndividualPermutationData indy = (ESIndividualPermutationData) individual; @@ -108,6 +110,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements * InterfaceDataTypePermutation methods */ + @Override public void setPermutationDataLength(int[] length){ this.m_Genotype = new double[length.length][]; @@ -126,6 +129,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements } } + @Override public int[] sizePermutation() { int[] res = new int[m_Genotype.length]; for (int i = 0; i < m_Genotype.length; i++) { @@ -134,6 +138,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements return res; } + @Override public void SetPermutationPhenotype(int[][] perm){ this.m_Phenotype = perm; this.m_Range = new double[perm.length][][]; @@ -147,6 +152,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements } + @Override public void SetPermutationGenotype(int[][] perm){ this.SetPermutationPhenotype(perm); @@ -170,6 +176,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements } + @Override public int[][] getPermutationData() { this.m_Phenotype = new int[this.m_Genotype.length][]; for (int p = 0; p < m_Genotype.length; p++) { @@ -200,6 +207,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements * an update from the genotype * @return int[] representing the permutation. */ + @Override public int[][] getPermutationDataWithoutUpdate() { return this.m_Phenotype; } @@ -207,6 +215,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements public int[] getFirstindex() { return firstindex; } + @Override public void setFirstindex(int[] firstindex) { this.firstindex = firstindex; } @@ -220,6 +229,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof int[][]) { int[][] bs = (int[][]) obj; @@ -237,6 +247,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "ESIndividual coding permutation: ("; @@ -259,6 +270,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements /** This method will allow the user to read the ES 'genotype' * @return BitSet */ + @Override public double[] getDGenotype() { return mapMatrixToVector(m_Genotype); } @@ -297,6 +309,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements /** This method will allow the user to set the current ES 'genotype'. * @param b The new genotype of the Individual */ + @Override public void SetDGenotype(double[] b) { this.m_Genotype = mapVectorToMatrix(b, this.sizePermutation()); for (int i = 0; i < this.m_Genotype.length; i++) { @@ -311,12 +324,14 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements /** This method performs a one element mutation on every permutation coded by a double vector. */ + @Override public void defaultMutate() { for (int i = 0; i < m_Genotype.length; i++) { ESIndividualDoubleData.defaultMutate(m_Genotype[i], m_Range[i]); } } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { double[][][] range = m_Range; if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (double[][][])((InterfaceHasInitRange)prob).getInitRange(); @@ -329,6 +344,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { int sumentries = 0; for (int i = 0; i < this.m_Range.length; i++) { @@ -353,6 +369,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements * name to the current object. * @return The name. */ + @Override public String getName() { return "ES individual"; } diff --git a/src/eva2/server/go/individuals/GAESIndividualBinaryDoubleData.java b/src/eva2/server/go/individuals/GAESIndividualBinaryDoubleData.java index ee26ad7b..e4c49a7d 100644 --- a/src/eva2/server/go/individuals/GAESIndividualBinaryDoubleData.java +++ b/src/eva2/server/go/individuals/GAESIndividualBinaryDoubleData.java @@ -48,6 +48,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GAESIndividualBinaryDoubleData(this); } @@ -56,6 +57,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GAESIndividualBinaryDoubleData) { GAESIndividualBinaryDoubleData indy = (GAESIndividualBinaryDoubleData)individual; @@ -70,11 +72,13 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method will allow a default initialisation of the individual * @param opt The optimization problem that is to be solved. */ + @Override public void init(InterfaceOptimizationProblem opt) { ((AbstractEAIndividual)this.m_Numbers).init(opt); ((AbstractEAIndividual)this.m_BitSet).init(opt); } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { ((AbstractEAIndividual)this.m_Numbers).defaultInit(prob); ((AbstractEAIndividual)this.m_BitSet).defaultInit(prob); @@ -85,6 +89,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof Object[]) { if (((Object[])obj)[0] instanceof double[]) { @@ -103,11 +108,13 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method will mutate the individual randomly */ + @Override public void mutate() { if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_BitSet).mutate(); } + @Override public void defaultMutate() { ((AbstractEAIndividual)this.m_Numbers).defaultMutate(); ((AbstractEAIndividual)this.m_BitSet).defaultMutate(); @@ -118,6 +125,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param partners The possible partners * @return offsprings */ + @Override public AbstractEAIndividual[] mateWith(Population partners) { AbstractEAIndividual[] result; if (RNG.flipCoin(this.m_CrossoverProbability)) { @@ -172,6 +180,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = "This is a hybrid Individual:\n"; result += "The Numbers Part:\n"+((AbstractEAIndividual)this.m_Numbers).getStringRepresentation(); @@ -185,6 +194,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setDoubleDataLength (int length) { this.m_Numbers.setDoubleDataLength(length); this.m_BitSet.setBinaryDataLength(length); @@ -193,6 +203,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method returns the length of the double data set * @return The number of bits stored */ + @Override public int size() { return this.m_Numbers.size(); } @@ -202,6 +213,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * for dimension d. * @param range The new range for the double data. */ + @Override public void SetDoubleRange(double[][] range) { this.m_Numbers.SetDoubleRange(range); } @@ -209,6 +221,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { return this.m_Numbers.getDoubleRange(); } @@ -216,6 +229,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method allows you to read the double data * @return BitSet representing the double data. */ + @Override public double[] getDoubleData() { return this.m_Numbers.getDoubleData(); } @@ -224,6 +238,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * an update from the genotype * @return double[] representing the double data. */ + @Override public double[] getDoubleDataWithoutUpdate() { return this.m_Numbers.getDoubleDataWithoutUpdate(); } @@ -232,6 +247,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param doubleData The new double data. * @see InterfaceDataTypeDouble.SetDoubleData() */ + @Override public void SetDoublePhenotype(double[] doubleData) { this.m_Numbers.SetDoublePhenotype(doubleData); } @@ -241,6 +257,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param doubleData The new double data. * @see InterfaceDataTypeDouble.SetDoubleDataLamarckian() */ + @Override public void SetDoubleGenotype(double[] doubleData) { this.m_Numbers.SetDoubleGenotype(doubleData); } @@ -251,6 +268,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method allows you to request a certain amount of binary data * @param length The lenght of the BitSet that is to be optimized */ + @Override public void setBinaryDataLength (int length) { this.m_Numbers.setDoubleDataLength(length); this.m_BitSet.setBinaryDataLength(length); @@ -266,6 +284,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBinaryData() { return this.m_BitSet.getBinaryData(); } @@ -274,6 +293,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * an update from the genotype * @return BitSet representing the binary data. */ + @Override public BitSet getBinaryDataWithoutUpdate() { return this.m_BitSet.getBinaryDataWithoutUpdate(); } @@ -282,6 +302,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param binaryData The new binary data. * @see InterfaceDataTypeBinary.SetBinaryData() */ + @Override public void SetBinaryPhenotype(BitSet binaryData) { this.m_BitSet.SetBinaryPhenotype(binaryData); } @@ -291,6 +312,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * @param binaryData The new binary data. * @see InterfaceBinaryData.SetBinaryDataLamarckian() */ + @Override public void SetBinaryGenotype(BitSet binaryData) { this.m_BitSet.SetBinaryGenotype(binaryData); } @@ -302,6 +324,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme * name to the current object. * @return The name. */ + @Override public String getName() { return "GA/ES individual"; } diff --git a/src/eva2/server/go/individuals/GAIndividualBinaryData.java b/src/eva2/server/go/individuals/GAIndividualBinaryData.java index 7896be9a..cadf8694 100644 --- a/src/eva2/server/go/individuals/GAIndividualBinaryData.java +++ b/src/eva2/server/go/individuals/GAIndividualBinaryData.java @@ -61,6 +61,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GAIndividualBinaryData(this); } @@ -69,6 +70,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GAIndividualBinaryData) { GAIndividualBinaryData indy = (GAIndividualBinaryData) individual; @@ -101,6 +103,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof BitSet) { BitSet bs = (BitSet) obj; @@ -118,6 +121,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * double[] is used instead of a single double. * @return The complete fitness array */ + @Override public double[] getFitness() { return this.m_Fitness; } @@ -126,6 +130,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "GAIndividual: ("; @@ -151,6 +156,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBGenotype() { return this.m_Genotype; } @@ -159,6 +165,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * memetic algorithms. * @param binaryData The new binary data. */ + @Override public void SetBGenotype(BitSet binaryData) { this.m_Genotype = binaryData; } @@ -168,10 +175,12 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * of the last significant bit. * @return The length of the genotype. */ + @Override public int getGenotypeLength() { return this.m_GenotypeLength; } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { for (int i = 0; i < this.m_GenotypeLength; i++) { if (RNG.flipCoin(0.5)) this.m_Genotype.set(i); @@ -181,6 +190,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method performs a simple one point mutation in the genotype */ + @Override public void defaultMutate() { int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength); //if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor()); @@ -195,6 +205,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to request a certain amount of binary data * @param length The lenght of the BitSet that is to be optimized */ + @Override public void setBinaryDataLength(int length) { this.m_GenotypeLength = length; } @@ -202,6 +213,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method returns the length of the binary data set * @return The number of bits stored */ + @Override public int size() { return this.m_GenotypeLength; } @@ -209,6 +221,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBinaryData() { this.m_Phenotype = (BitSet)this.m_Genotype.clone(); return this.m_Phenotype; @@ -218,6 +231,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * an update from the genotype * @return BitSet representing the binary data. */ + @Override public BitSet getBinaryDataWithoutUpdate() { return this.m_Phenotype; } @@ -225,6 +239,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte /** This method allows you to set the binary data. * @param binaryData The new binary data. */ + @Override public void SetBinaryPhenotype(BitSet binaryData) { this.m_Phenotype = binaryData; } @@ -233,6 +248,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * memetic algorithms. * @param binaryData The new binary data. */ + @Override public void SetBinaryGenotype(BitSet binaryData) { this.SetBinaryPhenotype(binaryData); this.m_Genotype =(BitSet)binaryData.clone(); @@ -245,6 +261,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte * name to the current object. * @return The name. */ + @Override public String getName() { return "GA binary individual"; } diff --git a/src/eva2/server/go/individuals/GAIndividualDoubleData.java b/src/eva2/server/go/individuals/GAIndividualDoubleData.java index b7c0b39d..c727f433 100644 --- a/src/eva2/server/go/individuals/GAIndividualDoubleData.java +++ b/src/eva2/server/go/individuals/GAIndividualDoubleData.java @@ -73,6 +73,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GAIndividualDoubleData(this); } @@ -81,6 +82,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GAIndividualDoubleData) { GAIndividualDoubleData indy = (GAIndividualDoubleData) individual; @@ -104,6 +106,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setDoubleDataLength (int length) { double[] newDesPa = new double[length]; double[][] newRange = new double[length][2]; @@ -134,6 +137,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method returns the length of the double data set * @return The number of bits stored */ + @Override public int size() { return this.m_Range.length; } @@ -143,6 +147,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * ranges. * @param range The new range for the double data. */ + @Override public void SetDoubleRange(double[][] range) { if (range.length != this.m_Range.length) { System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " @@ -157,6 +162,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { return this.m_Range; } @@ -164,6 +170,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method allows you to read the double data * @return BitSet representing the double data. */ + @Override public double[] getDoubleData() { int[] locus = new int[2]; this.m_Phenotype = new double[this.m_Range.length]; @@ -179,6 +186,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * an update from the genotype * @return double[] representing the double data. */ + @Override public double[] getDoubleDataWithoutUpdate() { return this.m_Phenotype; } @@ -187,6 +195,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * use SetDoubleDataLamarckian. * @param doubleData The new double data. */ + @Override public void SetDoublePhenotype(double[] doubleData) { this.m_Phenotype = doubleData; } @@ -195,6 +204,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * memetic algorithms. * @param doubleData The new double data. */ + @Override public void SetDoubleGenotype(double[] doubleData) { this.SetDoublePhenotype(doubleData); int[] locus = new int[2]; @@ -214,6 +224,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof double[]) { double[] bs = (double[]) obj; @@ -231,6 +242,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "GAIndividual coding double: ("; @@ -261,6 +273,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBGenotype() { return this.m_Genotype; } @@ -269,6 +282,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * memetic algorithms. * @param binaryData The new binary data. */ + @Override public void SetBGenotype(BitSet binaryData) { this.m_Genotype = binaryData; } @@ -278,10 +292,12 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * of the last significat bit. * @return The length of the genotype. */ + @Override public int getGenotypeLength() { return this.m_GenotypeLength; } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { for (int i = 0; i < this.m_GenotypeLength; i++) { if (RNG.flipCoin(0.5)) this.m_Genotype.set(i); @@ -291,6 +307,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte /** This method performs a simple one point mutation in the genotype */ + @Override public void defaultMutate() { int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength); if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex); @@ -303,6 +320,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte * name to the current object. * @return The name. */ + @Override public String getName() { return "GA individual"; } diff --git a/src/eva2/server/go/individuals/GAIndividualIntegerData.java b/src/eva2/server/go/individuals/GAIndividualIntegerData.java index d9c91fab..60c56aef 100644 --- a/src/eva2/server/go/individuals/GAIndividualIntegerData.java +++ b/src/eva2/server/go/individuals/GAIndividualIntegerData.java @@ -72,6 +72,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GAIndividualIntegerData(this); } @@ -81,6 +82,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GAIndividualIntegerData) { GAIndividualIntegerData indy = (GAIndividualIntegerData) individual; @@ -104,6 +106,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setIntegerDataLength (int length) { int[] newDesPa = new int[length]; int[][] newRange = new int[length][2]; @@ -129,6 +132,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method returns the length of the double data set * @return The number of bits stored */ + @Override public int size() { return this.m_Range.length; } @@ -138,6 +142,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * ranges. * @param range The new range for the double data. */ + @Override public void SetIntRange(int[][] range) { if (range.length != this.m_Range.length) { System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " @@ -179,6 +184,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will return the range for all double attributes. * @return The range array. */ + @Override public int[][] getIntRange() { return this.m_Range; } @@ -186,6 +192,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to read the double data * @return BitSet representing the double data. */ + @Override public int[] getIntegerData() { int[] locus = new int[2]; locus[0] = 0; @@ -203,6 +210,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * an update from the genotype * @return int[] representing the int data. */ + @Override public int[] getIntegerDataWithoutUpdate() { return this.m_Phenotype; } @@ -210,6 +218,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to set the double data. * @param doubleData The new double data. */ + @Override public void SetIntPhenotype(int[] doubleData) { this.m_Phenotype = doubleData; } @@ -218,6 +227,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * memetic algorithms. * @param doubleData The new double data. */ + @Override public void SetIntGenotype(int[] doubleData) { this.SetIntPhenotype(doubleData); if (doubleData != null) { @@ -240,6 +250,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof int[]) { int[] bs = (int[]) obj; @@ -257,6 +268,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "GAIndividual coding int: ("; @@ -299,6 +311,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBGenotype() { return this.m_Genotype; } @@ -307,6 +320,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * memetic algorithms. * @param binaryData The new binary data. */ + @Override public void SetBGenotype(BitSet binaryData) { this.m_Genotype = binaryData; } @@ -316,12 +330,14 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * of the last significat bit. * @return The length of the genotype. */ + @Override public int getGenotypeLength() { int overallLength = 0; for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i]; return overallLength; } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { int overallLength = 0; for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i]; @@ -333,6 +349,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int /** This method performs a simple one point mutation in the genotype */ + @Override public void defaultMutate() { int overallLength = 0; for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i]; @@ -383,6 +400,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int * name to the current object. * @return The name. */ + @Override public String getName() { return "GA individual"; } diff --git a/src/eva2/server/go/individuals/GAPIndividualProgramData.java b/src/eva2/server/go/individuals/GAPIndividualProgramData.java index b31d4822..7a9e938b 100644 --- a/src/eva2/server/go/individuals/GAPIndividualProgramData.java +++ b/src/eva2/server/go/individuals/GAPIndividualProgramData.java @@ -47,6 +47,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GAPIndividualProgramData(this); } @@ -55,6 +56,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GAPIndividualProgramData) { GAPIndividualProgramData indy = (GAPIndividualProgramData)individual; @@ -69,11 +71,13 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method will allow a default initialisation of the individual * @param opt The optimization problem that is to be solved. */ + @Override public void init(InterfaceOptimizationProblem opt) { ((AbstractEAIndividual)this.m_Numbers).init(opt); ((AbstractEAIndividual)this.m_Program).init(opt); } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { ((AbstractEAIndividual)this.m_Numbers).defaultInit(prob); ((AbstractEAIndividual)this.m_Program).defaultInit(prob); @@ -84,6 +88,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof Object[]) { if (((Object[])obj)[0] instanceof double[]) { @@ -102,11 +107,13 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method will mutate the individual randomly */ + @Override public void mutate() { if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Program).mutate(); } + @Override public void defaultMutate() { ((AbstractEAIndividual)this.m_Numbers).defaultMutate(); ((AbstractEAIndividual)this.m_Program).defaultMutate(); @@ -117,6 +124,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * @param partners The possible partners * @return offsprings */ + @Override public AbstractEAIndividual[] mateWith(Population partners) { AbstractEAIndividual[] result; if (RNG.flipCoin(this.m_CrossoverProbability)) { @@ -156,6 +164,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = "This is a hybrid Individual:\n"; result += "The Numbers Part:\n"+((AbstractEAIndividual)this.m_Numbers).getStringRepresentation(); @@ -169,6 +178,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setDoubleDataLength (int length) { this.m_Numbers.setDoubleDataLength(length); } @@ -176,6 +186,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method returns the length of the double data set * @return The number of bits stored */ + @Override public int size() { return this.m_Numbers.size(); } @@ -185,6 +196,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * for dimension d. * @param range The new range for the double data. */ + @Override public void SetDoubleRange(double[][] range) { this.m_Numbers.SetDoubleRange(range); } @@ -192,6 +204,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method will return the range for all double attributes. * @return The range array. */ + @Override public double[][] getDoubleRange() { return this.m_Numbers.getDoubleRange(); } @@ -199,6 +212,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to read the double data * @return BitSet representing the double data. */ + @Override public double[] getDoubleData() { return this.m_Numbers.getDoubleData(); } @@ -207,6 +221,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * an update from the genotype * @return double[] representing the double data. */ + @Override public double[] getDoubleDataWithoutUpdate() { return this.m_Numbers.getDoubleDataWithoutUpdate(); } @@ -215,6 +230,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * SetDoubleDataLamarckian(). * @param doubleData The new double data. */ + @Override public void SetDoublePhenotype(double[] doubleData) { this.m_Numbers.SetDoublePhenotype(doubleData); } @@ -223,6 +239,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * memetic algorithms. * @param doubleData The new double data. */ + @Override public void SetDoubleGenotype(double[] doubleData) { this.m_Numbers.SetDoubleGenotype(doubleData); } @@ -233,6 +250,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setProgramDataLength (int length) { this.m_Program.setProgramDataLength(length); } @@ -240,6 +258,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to read the program stored as Koza style node tree * @return AbstractGPNode representing the binary data. */ + @Override public InterfaceProgram[] getProgramData() { return this.m_Program.getProgramData(); } @@ -248,6 +267,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * an update from the genotype * @return InterfaceProgram[] representing the Program. */ + @Override public InterfaceProgram[] getProgramDataWithoutUpdate() { return this.m_Program.getProgramDataWithoutUpdate(); } @@ -255,6 +275,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to set the program. * @param program The new program. */ + @Override public void SetProgramPhenotype(InterfaceProgram[] program) { this.m_Program.SetProgramPhenotype(program); } @@ -262,6 +283,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to set the program. * @param program The new program. */ + @Override public void SetProgramGenotype(InterfaceProgram[] program) { this.m_Program.SetProgramGenotype(program); } @@ -269,6 +291,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to set the function area * @param area The area contains functions and terminals */ + @Override public void SetFunctionArea(Object[] area) { this.m_Program.SetFunctionArea(area); } @@ -276,6 +299,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In /** This method allows you to set the function area * @return The function area */ + @Override public Object[] getFunctionArea() { return this.m_Program.getFunctionArea(); } @@ -287,6 +311,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In * name to the current object. * @return The name. */ + @Override public String getName() { return "GAP individual"; } diff --git a/src/eva2/server/go/individuals/GEIndividualProgramData.java b/src/eva2/server/go/individuals/GEIndividualProgramData.java index fc15f9c1..e00c7ea0 100644 --- a/src/eva2/server/go/individuals/GEIndividualProgramData.java +++ b/src/eva2/server/go/individuals/GEIndividualProgramData.java @@ -108,6 +108,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GEIndividualProgramData(this); } @@ -116,6 +117,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GEIndividualProgramData) { GEIndividualProgramData indy = (GEIndividualProgramData) individual; @@ -302,6 +304,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setProgramDataLength (int length) { GPArea[] oldArea = this.m_Area; Object[][] oldRulz = this.m_Rules; @@ -417,6 +420,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to read the program stored as Koza style node tree * @return GPNode representing the binary data. */ + @Override public InterfaceProgram[] getProgramData() { // if (true) { // String test ="GE decoding:\n"; @@ -453,6 +457,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * an update from the genotype * @return InterfaceProgram[] representing the Program. */ + @Override public InterfaceProgram[] getProgramDataWithoutUpdate() { return this.m_Phenotype; } @@ -460,6 +465,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the program phenotype. * @param program The new program. */ + @Override public void SetProgramPhenotype(InterfaceProgram[] program) { if (program instanceof AbstractGPNode[]) { this.m_Phenotype = new AbstractGPNode[program.length]; @@ -473,6 +479,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * Warning - this is not implemented, it only sets the phenotype using SetProgramData. * @param program The new program. */ + @Override public void SetProgramGenotype(InterfaceProgram[] program) { this.SetProgramPhenotype(program); if (program instanceof AbstractGPNode[]) System.err.println("Warning setProgram() for GEIndividualProgramData not implemented!"); @@ -481,6 +488,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the function area * @param area The area contains functions and terminals */ + @Override public void SetFunctionArea(Object[] area) { if (area instanceof GPArea[]) { this.m_Area = new GPArea[area.length]; @@ -494,6 +502,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the function area * @return The function area */ + @Override public Object[] getFunctionArea() { return this.m_Area; } @@ -506,6 +515,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof InterfaceProgram) { this.SetProgramGenotype((InterfaceProgram[])obj); @@ -521,6 +531,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "GEIndividual coding program:\n"; @@ -544,6 +555,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to read the binary data * @return BitSet representing the binary data. */ + @Override public BitSet getBGenotype() { return this.m_Genotype; } @@ -552,6 +564,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * memetic algorithms. * @param binaryData The new binary data. */ + @Override public void SetBGenotype(BitSet binaryData) { this.m_Genotype = binaryData; } @@ -561,10 +574,12 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * of the last significat bit. * @return The length of the genotype. */ + @Override public int getGenotypeLength() { return this.m_GenotypeLengthPerProgram*this.m_Area.length; } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { for (int i = 0; i < this.m_GenotypeLengthPerProgram*this.m_Area.length; i++) { if (RNG.flipCoin(0.5)) this.m_Genotype.set(i); @@ -574,6 +589,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int /** This method performs a simple one point mutation in the genotype */ + @Override public void defaultMutate() { int mutationIndex = RNG.randomInt(0, this.m_GenotypeLengthPerProgram*this.m_Area.length); //if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor()); @@ -589,6 +605,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int * name to the current object. * @return The name. */ + @Override public String getName() { return "GE individual"; } diff --git a/src/eva2/server/go/individuals/GIIndividualIntegerData.java b/src/eva2/server/go/individuals/GIIndividualIntegerData.java index 6f58a6f6..3a19a4e3 100644 --- a/src/eva2/server/go/individuals/GIIndividualIntegerData.java +++ b/src/eva2/server/go/individuals/GIIndividualIntegerData.java @@ -71,6 +71,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GIIndividualIntegerData(this); } @@ -80,6 +81,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GIIndividualIntegerData) { GIIndividualIntegerData indy = (GIIndividualIntegerData) individual; @@ -102,6 +104,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setIntegerDataLength (int length) { int[] newDesPa = new int[length]; int[][] newRange = new int[length][2]; @@ -126,6 +129,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int /** This method returns the length of the double data set * @return The number of bits stored */ + @Override public int size() { return this.m_Range.length; } @@ -135,6 +139,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * ranges. * @param range The new range for the double data. */ + @Override public void SetIntRange(int[][] range) { if (range.length != this.m_Range.length) { this.setIntegerDataLength(range.length); @@ -148,6 +153,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will return the range for all double attributes. * @return The range array. */ + @Override public int[][] getIntRange() { return this.m_Range; } @@ -155,6 +161,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to read the double data * @return BitSet representing the double data. */ + @Override public int[] getIntegerData() { this.m_Phenotype = new int[this.m_Range.length]; for (int i = 0; i < this.m_Phenotype.length; i++) { @@ -167,6 +174,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * an update from the genotype * @return int[] representing the int data. */ + @Override public int[] getIntegerDataWithoutUpdate() { return this.m_Phenotype; } @@ -174,6 +182,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int /** This method allows you to set the double data. * @param doubleData The new double data. */ + @Override public void SetIntPhenotype(int[] doubleData) { this.m_Phenotype = doubleData; } @@ -182,6 +191,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * memetic algorithms. * @param doubleData The new double data. */ + @Override public void SetIntGenotype(int[] doubleData) { this.SetIntPhenotype(doubleData); this.m_Genotype = new int[this.m_Range.length]; @@ -198,6 +208,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof int[]) { int[] bs = (int[]) obj; @@ -215,6 +226,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "GIIndividual coding int: ("; @@ -244,6 +256,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int /** This method will allow the user to read the GI genotype * @return BitSet */ + @Override public int[] getIGenotype() { return this.m_Genotype; } @@ -254,6 +267,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * this method. * @param b The new genotype of the Individual */ + @Override public void SetIGenotype(int[] b) { this.m_Genotype = b; } @@ -263,17 +277,20 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * of the last significat bit. * @return The length of the genotype. */ + @Override public int getGenotypeLength() { return this.m_Genotype.length; } /** This method performs a simple one point mutation in the genotype */ + @Override public void defaultMutate() { int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1); this.m_Genotype[mutationIndex] = RNG.randomInt(this.m_Range[mutationIndex][0], this.m_Range[mutationIndex][1]); } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { int[][] range = m_Range; if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) { @@ -304,6 +321,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int * name to the current object. * @return The name. */ + @Override public String getName() { return "GI individual"; } diff --git a/src/eva2/server/go/individuals/GIOBGAIndividualIntegerPermutationData.java b/src/eva2/server/go/individuals/GIOBGAIndividualIntegerPermutationData.java index 8337dcbb..df5c2cd5 100644 --- a/src/eva2/server/go/individuals/GIOBGAIndividualIntegerPermutationData.java +++ b/src/eva2/server/go/individuals/GIOBGAIndividualIntegerPermutationData.java @@ -45,6 +45,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GIOBGAIndividualIntegerPermutationData(this); } @@ -53,6 +54,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GIOBGAIndividualIntegerPermutationData) { GIOBGAIndividualIntegerPermutationData indy = (GIOBGAIndividualIntegerPermutationData)individual; @@ -67,11 +69,13 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method will allow a default initialisation of the individual * @param opt The optimization problem that is to be solved. */ + @Override public void init(InterfaceOptimizationProblem opt) { ((AbstractEAIndividual)this.m_Integer).init(opt); ((AbstractEAIndividual)this.m_Permutation).init(opt); } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { ((AbstractEAIndividual)this.m_Integer).defaultInit(prob); ((AbstractEAIndividual)this.m_Permutation).defaultInit(prob); @@ -82,6 +86,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof Object[]) { if (((Object[])obj)[0] instanceof double[]) { @@ -100,11 +105,13 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method will mutate the individual randomly */ + @Override public void mutate() { if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Integer).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Permutation).mutate(); } + @Override public void defaultMutate() { ((AbstractEAIndividual)this.m_Integer).defaultMutate(); ((AbstractEAIndividual)this.m_Permutation).defaultMutate(); @@ -115,6 +122,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * @param partners The possible partners * @return offsprings */ + @Override public AbstractEAIndividual[] mateWith(Population partners) { AbstractEAIndividual[] result; if (RNG.flipCoin(this.m_CrossoverProbability)) { @@ -169,6 +177,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = "This is a hybrid Individual:\n"; result += "The Integer Part:\n"+((AbstractEAIndividual)this.m_Integer).getStringRepresentation(); @@ -182,6 +191,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method allows you to request a certain amount of int data * @param length The lenght of the int[] that is to be optimized */ + @Override public void setIntegerDataLength (int length) { this.m_Integer.setIntegerDataLength(length); } @@ -189,6 +199,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method returns the length of the int data set * @return The number of integers stored */ + @Override public int size() { return this.m_Integer.size(); } @@ -198,6 +209,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * for dimension d. * @param range The new range for the int data. */ + @Override public void SetIntRange(int[][] range) { this.m_Integer.SetIntRange(range); } @@ -205,6 +217,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method will return the range for all int attributes. * @return The range array. */ + @Override public int[][] getIntRange() { return this.m_Integer.getIntRange(); } @@ -212,6 +225,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method allows you to read the int data * @return int[] representing the int data. */ + @Override public int[] getIntegerData() { return this.m_Integer.getIntegerData(); } @@ -220,6 +234,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * an update from the genotype * @return int[] representing the int data. */ + @Override public int[] getIntegerDataWithoutUpdate() { return this.m_Integer.getIntegerDataWithoutUpdate(); } @@ -227,6 +242,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method allows you to set the int data. * @param intData The new int data. */ + @Override public void SetIntPhenotype(int[] intData) { this.m_Integer.SetIntPhenotype(intData); } @@ -235,6 +251,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * memetic algorithms. * @param intData The new int data. */ + @Override public void SetIntGenotype(int[] intData) { this.m_Integer.SetIntGenotype(intData); } @@ -245,6 +262,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** setLength sets the length of the permutation. * @param length int new length */ + @Override public void setPermutationDataLength(int[] length) { this.m_Permutation.setPermutationDataLength(length); this.m_Integer.setIntegerDataLength(length.length); @@ -253,6 +271,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** size returns the size of the permutation. * @return int */ + @Override public int[] sizePermutation() { return this.m_Permutation.sizePermutation(); } @@ -260,6 +279,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method allows you to read the permutation data * @return int[] represent the permutation. */ + @Override public int[][] getPermutationData() { return this.m_Permutation.getPermutationData(); } @@ -268,6 +288,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * an update from the genotype * @return int[] representing the permutation. */ + @Override public int[][] getPermutationDataWithoutUpdate() { return this.m_Permutation.getPermutationDataWithoutUpdate(); } @@ -275,6 +296,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual /** This method allows you to set the permutation. * @param perm The new permutation data. */ + @Override public void SetPermutationPhenotype(int[][] perm) { this.SetPermutationPhenotype(perm); } @@ -283,10 +305,12 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * memetic algorithms. * @param perm The new permutation data. */ + @Override public void SetPermutationGenotype(int[][] perm) { this.SetPermutationGenotype(perm); } + @Override public void setFirstindex(int[] firstindex) { this.m_Permutation.setFirstindex(firstindex); } @@ -298,6 +322,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual * name to the current object. * @return The name. */ + @Override public String getName() { return "GA/ES individual"; } diff --git a/src/eva2/server/go/individuals/GPIndividualProgramData.java b/src/eva2/server/go/individuals/GPIndividualProgramData.java index 3206f8b6..148d3f90 100644 --- a/src/eva2/server/go/individuals/GPIndividualProgramData.java +++ b/src/eva2/server/go/individuals/GPIndividualProgramData.java @@ -78,6 +78,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int cloneAEAObjects((AbstractEAIndividual) individual); } + @Override public Object clone() { return (Object) new GPIndividualProgramData(this); } @@ -86,6 +87,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof GPIndividualProgramData) { GPIndividualProgramData indy = (GPIndividualProgramData) individual; @@ -112,6 +114,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to request a certain amount of double data * @param length The lenght of the double[] that is to be optimized */ + @Override public void setProgramDataLength (int length) { GPArea[] oldArea = this.m_Area; AbstractGPNode[] oldProg = this.m_Genotype; @@ -130,6 +133,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to read the program stored as Koza style node tree * @return AbstractGPNode representing the binary data. */ + @Override public InterfaceProgram[] getProgramData() { this.m_Phenotype = new AbstractGPNode[this.m_Genotype.length]; for (int i = 0; i < this.m_Genotype.length; i++) { @@ -151,6 +155,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int * an update from the genotype * @return InterfaceProgram[] representing the Program. */ + @Override public InterfaceProgram[] getProgramDataWithoutUpdate() { if (this.m_Phenotype==null) return getProgramData(); else return this.m_Phenotype; @@ -159,6 +164,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the program phenotype. * @param program The new program. */ + @Override public void SetProgramPhenotype(InterfaceProgram[] program) { if (program instanceof AbstractGPNode[]) { this.m_Phenotype = new AbstractGPNode[program.length]; @@ -170,6 +176,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the program genotype. * @param program The new program. */ + @Override public void SetProgramGenotype(InterfaceProgram[] program) { this.SetProgramPhenotype(program); if (program instanceof AbstractGPNode[]) { @@ -182,6 +189,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the function area * @param area The area contains functions and terminals */ + @Override public void SetFunctionArea(Object[] area) { if (area instanceof GPArea[]) { this.m_Area = (GPArea[]) area; @@ -191,6 +199,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method allows you to set the function area * @return The function area */ + @Override public Object[] getFunctionArea() { return this.m_Area; } @@ -203,6 +212,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof InterfaceProgram[]) { this.SetProgramGenotype((InterfaceProgram[])obj); @@ -218,6 +228,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "GPIndividual coding program: ("; @@ -240,6 +251,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method will allow the user to read the program genotype * @return AbstractGPNode */ + @Override public AbstractGPNode[] getPGenotype() { return this.m_Genotype; } @@ -247,6 +259,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** This method will allow the user to set the current program 'genotype'. * @param b The new programgenotype of the Individual */ + @Override public void SetPGenotype(AbstractGPNode[] b) { this.m_Genotype = b; this.m_Phenotype=null; @@ -256,6 +269,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int * @param b The new program genotype of the Individual * @param i The index where to insert the new program */ + @Override public void SetPGenotype(AbstractGPNode b, int i) { this.m_Genotype[i] = b; m_Genotype[i].updateDepth(0); @@ -266,6 +280,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int /** * This method performs a simple one element mutation on the program */ + @Override public void defaultMutate() { for (int i = 0; i < this.m_Genotype.length; i++) { AbstractGPNode nodeToMutate = this.m_Genotype[i].getRandomNode(); @@ -291,6 +306,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int m_Phenotype=null; // reset pheno } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { m_Phenotype=null; // reset pheno for (int i = 0; i < this.m_Area.length; i++) { @@ -315,6 +331,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int * name to the current object. * @return The name. */ + @Override public String getName() { return "GP individual"; } @@ -377,6 +394,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int public void setMaxAllowedDepth(int b) { this.m_maxAllowedDepth = b; } + @Override public int getMaxAllowedDepth() { return this.m_maxAllowedDepth; } diff --git a/src/eva2/server/go/individuals/IndividualDistanceComparator.java b/src/eva2/server/go/individuals/IndividualDistanceComparator.java index 376cdce0..084cd5d6 100644 --- a/src/eva2/server/go/individuals/IndividualDistanceComparator.java +++ b/src/eva2/server/go/individuals/IndividualDistanceComparator.java @@ -29,6 +29,7 @@ public class IndividualDistanceComparator implements Comparator, Seriali closerMeansLess = closerIsLess; } + @Override public int compare(Object o1, Object o2) { double d1 = distMetric.distance((AbstractEAIndividual)o1, refIndy); double d2 = distMetric.distance((AbstractEAIndividual)o2, refIndy); diff --git a/src/eva2/server/go/individuals/IndividualWeightedFitnessComparator.java b/src/eva2/server/go/individuals/IndividualWeightedFitnessComparator.java index c8ffd987..aa4f6f7a 100644 --- a/src/eva2/server/go/individuals/IndividualWeightedFitnessComparator.java +++ b/src/eva2/server/go/individuals/IndividualWeightedFitnessComparator.java @@ -68,6 +68,7 @@ public class IndividualWeightedFitnessComparator implements Comparator, * (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ + @Override public int compare(Object o1, Object o2) { double[] f1 = ((AbstractEAIndividual) o1).getFitness(); double[] f2 = ((AbstractEAIndividual) o2).getFitness(); diff --git a/src/eva2/server/go/individuals/OBGAIndividualPermutationData.java b/src/eva2/server/go/individuals/OBGAIndividualPermutationData.java index 571cb904..b8a2f95b 100644 --- a/src/eva2/server/go/individuals/OBGAIndividualPermutationData.java +++ b/src/eva2/server/go/individuals/OBGAIndividualPermutationData.java @@ -69,6 +69,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen * @param individual The individual to compare to. * @return boolean if equal true else false. */ + @Override public boolean equalGenotypes(AbstractEAIndividual individual) { if (individual instanceof OBGAIndividualPermutationData) { OBGAIndividualPermutationData indy = (OBGAIndividualPermutationData) individual; @@ -96,6 +97,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen * @param obj The initial value for the phenotype * @param opt The optimization problem that is to be solved. */ + @Override public void initByValue(Object obj, InterfaceOptimizationProblem opt) { if (obj instanceof int[]) { this.SetPermutationGenotype((int[][]) obj); @@ -112,6 +114,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen * double[] is used instead of a single double. * @return The complete fitness array */ + @Override public double[] getFitness() { return this.m_Fitness; } @@ -120,6 +123,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen * noteably the Genotype. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "OBGAIndividual: ("; @@ -144,6 +148,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen } + @Override public Object clone() { return new OBGAIndividualPermutationData(this); } @@ -152,14 +157,17 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen * InterfaceOBGAIndividual methods */ + @Override public int[][] getOBGenotype() { return this.m_Genotype; } + @Override public void SetOBGenotype(int[][] g) { this.m_Genotype = g; } + @Override public void defaultMutate(){ int[][] permmatrix = this.getPermutationData(); for (int i = 0; i < permmatrix.length; i++) { @@ -174,6 +182,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen this.SetPermutationGenotype(permmatrix); } + @Override public void defaultInit(InterfaceOptimizationProblem prob){ //System.out.println("Default Init!"); int[][] perm = new int[this.m_Genotype.length][]; @@ -200,6 +209,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen */ + @Override public void setPermutationDataLength(int[] length){ this.m_Genotype = new int[length.length][]; for (int i = 0; i < length.length; i++) { @@ -208,6 +218,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen } + @Override public int[] sizePermutation() { int[] res = new int[m_Genotype.length]; for (int i = 0; i )g.m_CompleteList.clone(); } + @Override public Object clone() { return new GPArea(this); } diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeAbs.java b/src/eva2/server/go/individuals/codings/gp/GPNodeAbs.java index 42f41336..b079ffc2 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeAbs.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeAbs.java @@ -18,6 +18,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Abs"; } @@ -25,6 +26,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeAbs(this); } @@ -32,6 +34,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -39,6 +42,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 0; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeAdd.java b/src/eva2/server/go/individuals/codings/gp/GPNodeAdd.java index e6f9ec9d..5d03f454 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeAdd.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeAdd.java @@ -24,6 +24,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Add"; } @@ -31,6 +32,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeAdd(this); } @@ -38,6 +40,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 2; } @@ -45,6 +48,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 0; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeConst.java b/src/eva2/server/go/individuals/codings/gp/GPNodeConst.java index 62a8a973..06c9f936 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeConst.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeConst.java @@ -30,6 +30,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return ""+value; } @@ -37,6 +38,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 0; } @@ -44,6 +46,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { return new Double(value); } diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeCos.java b/src/eva2/server/go/individuals/codings/gp/GPNodeCos.java index 647d52fa..e6a992f1 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeCos.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeCos.java @@ -20,6 +20,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Cos"; } @@ -27,6 +28,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeCos(this); } @@ -34,6 +36,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -41,6 +44,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeDiv.java b/src/eva2/server/go/individuals/codings/gp/GPNodeDiv.java index ac5fd2e6..95b5dd95 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeDiv.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeDiv.java @@ -28,6 +28,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Div"; } @@ -35,6 +36,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeDiv(this); } @@ -42,6 +44,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 2; } @@ -49,6 +52,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeExp.java b/src/eva2/server/go/individuals/codings/gp/GPNodeExp.java index e2dfbeeb..9503b685 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeExp.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeExp.java @@ -20,6 +20,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Exp"; } @@ -27,6 +28,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeExp(this); } @@ -34,6 +36,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -41,6 +44,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec2.java b/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec2.java index fcbf8139..003dcc23 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec2.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec2.java @@ -21,6 +21,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Exec2"; } @@ -28,6 +29,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeFlowExec2(this); } @@ -35,6 +37,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 2; } @@ -42,6 +45,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object[] result = new Object[this.m_Nodes.length]; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec3.java b/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec3.java index 84528dfb..19415a45 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec3.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeFlowExec3.java @@ -21,6 +21,7 @@ public class GPNodeFlowExec3 extends AbstractGPNode implements java.io.Serializa /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Exec3"; } @@ -28,6 +29,7 @@ public class GPNodeFlowExec3 extends AbstractGPNode implements java.io.Serializa /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeFlowExec3(this); } @@ -35,6 +37,7 @@ public class GPNodeFlowExec3 extends AbstractGPNode implements java.io.Serializa /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 3; } @@ -42,6 +45,7 @@ public class GPNodeFlowExec3 extends AbstractGPNode implements java.io.Serializa /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object[] result = new Object[this.m_Nodes.length]; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeInput.java b/src/eva2/server/go/individuals/codings/gp/GPNodeInput.java index beae344a..d610f12d 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeInput.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeInput.java @@ -51,12 +51,14 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Sensor:"+this.m_Identifier; } /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeInput(this); } @@ -64,6 +66,7 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 0; } @@ -71,6 +74,7 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { lastValue = environment.getSensorValue(this.m_Identifier); return lastValue; @@ -79,6 +83,7 @@ public class GPNodeInput extends AbstractGPNode implements java.io.Serializable /** This method returns a string representation * @return string */ + @Override public String getOpIdentifier() { if (this.lastValue == null) return this.m_Identifier; else { diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeMult.java b/src/eva2/server/go/individuals/codings/gp/GPNodeMult.java index d8822051..61206150 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeMult.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeMult.java @@ -21,6 +21,7 @@ public class GPNodeMult extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Mult"; } @@ -28,6 +29,7 @@ public class GPNodeMult extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeMult(this); } @@ -35,6 +37,7 @@ public class GPNodeMult extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 2; } @@ -42,6 +45,7 @@ public class GPNodeMult extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeNeg.java b/src/eva2/server/go/individuals/codings/gp/GPNodeNeg.java index fcb4092e..23fa0273 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeNeg.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeNeg.java @@ -21,6 +21,7 @@ public class GPNodeNeg extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Neg"; } @@ -28,6 +29,7 @@ public class GPNodeNeg extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeNeg(this); } @@ -35,6 +37,7 @@ public class GPNodeNeg extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -42,6 +45,7 @@ public class GPNodeNeg extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 0; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeOne.java b/src/eva2/server/go/individuals/codings/gp/GPNodeOne.java index d36d2cd4..917fd78f 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeOne.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeOne.java @@ -16,6 +16,7 @@ public class GPNodeOne extends GPNodeConst implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeOne(this); } diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeOutput.java b/src/eva2/server/go/individuals/codings/gp/GPNodeOutput.java index 0a2d142d..10136d72 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeOutput.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeOutput.java @@ -46,6 +46,7 @@ public class GPNodeOutput extends AbstractGPNode implements java.io.Serializable /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Actuator:" +this.m_Identifier; } @@ -53,6 +54,7 @@ public class GPNodeOutput extends AbstractGPNode implements java.io.Serializable /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeOutput(this); } @@ -60,6 +62,7 @@ public class GPNodeOutput extends AbstractGPNode implements java.io.Serializable /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 0; } @@ -67,6 +70,7 @@ public class GPNodeOutput extends AbstractGPNode implements java.io.Serializable /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { environment.setActuatorValue(this.m_Identifier, null); return null; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodePi.java b/src/eva2/server/go/individuals/codings/gp/GPNodePi.java index c9b939cc..de77cf3d 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodePi.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodePi.java @@ -16,6 +16,7 @@ public class GPNodePi extends GPNodeConst implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodePi(this); } @@ -23,6 +24,7 @@ public class GPNodePi extends GPNodeConst implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "pi"; } diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodePow2.java b/src/eva2/server/go/individuals/codings/gp/GPNodePow2.java index bad74649..8e6dd056 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodePow2.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodePow2.java @@ -20,6 +20,7 @@ public class GPNodePow2 extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Pow2"; } @@ -27,6 +28,7 @@ public class GPNodePow2 extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodePow2(this); } @@ -34,6 +36,7 @@ public class GPNodePow2 extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -41,6 +44,7 @@ public class GPNodePow2 extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodePow3.java b/src/eva2/server/go/individuals/codings/gp/GPNodePow3.java index 4a9f7ae6..c970fc7a 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodePow3.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodePow3.java @@ -20,6 +20,7 @@ public class GPNodePow3 extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Pow3"; } @@ -27,6 +28,7 @@ public class GPNodePow3 extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodePow3(this); } @@ -34,6 +36,7 @@ public class GPNodePow3 extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -41,6 +44,7 @@ public class GPNodePow3 extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeProd.java b/src/eva2/server/go/individuals/codings/gp/GPNodeProd.java index 1e7e317e..dac9e384 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeProd.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeProd.java @@ -20,18 +20,22 @@ public class GPNodeProd extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Prod"; } + @Override public Object clone() { return (Object) new GPNodeProd(this); } + @Override public int getArity() { return 1; } + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeSin.java b/src/eva2/server/go/individuals/codings/gp/GPNodeSin.java index 06fb1536..abcc96e8 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeSin.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeSin.java @@ -20,6 +20,7 @@ public class GPNodeSin extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Sin"; } @@ -27,6 +28,7 @@ public class GPNodeSin extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeSin(this); } @@ -34,6 +36,7 @@ public class GPNodeSin extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -41,6 +44,7 @@ public class GPNodeSin extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeSqrt.java b/src/eva2/server/go/individuals/codings/gp/GPNodeSqrt.java index 9446f48e..a157cecf 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeSqrt.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeSqrt.java @@ -21,6 +21,7 @@ public class GPNodeSqrt extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Sqrt"; } @@ -28,6 +29,7 @@ public class GPNodeSqrt extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeSqrt(this); } @@ -35,6 +37,7 @@ public class GPNodeSqrt extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -42,6 +45,7 @@ public class GPNodeSqrt extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 1; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeSub.java b/src/eva2/server/go/individuals/codings/gp/GPNodeSub.java index 1a91d572..99d7817e 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeSub.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeSub.java @@ -21,6 +21,7 @@ public class GPNodeSub extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Sub"; } @@ -28,6 +29,7 @@ public class GPNodeSub extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeSub(this); } @@ -35,6 +37,7 @@ public class GPNodeSub extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 2; } @@ -42,6 +45,7 @@ public class GPNodeSub extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 0; diff --git a/src/eva2/server/go/individuals/codings/gp/GPNodeSum.java b/src/eva2/server/go/individuals/codings/gp/GPNodeSum.java index dc057dc7..878fde84 100644 --- a/src/eva2/server/go/individuals/codings/gp/GPNodeSum.java +++ b/src/eva2/server/go/individuals/codings/gp/GPNodeSum.java @@ -20,6 +20,7 @@ public class GPNodeSum extends AbstractGPNode implements java.io.Serializable { /** This method will be used to identify the node in the GPAreaEditor * @return The name. */ + @Override public String getName() { return "Sum"; } @@ -27,6 +28,7 @@ public class GPNodeSum extends AbstractGPNode implements java.io.Serializable { /** This method allows you to clone the Nodes * @return the clone */ + @Override public Object clone() { return (Object) new GPNodeSum(this); } @@ -34,6 +36,7 @@ public class GPNodeSum extends AbstractGPNode implements java.io.Serializable { /** This method will return the current arity * @return Arity. */ + @Override public int getArity() { return 1; } @@ -41,6 +44,7 @@ public class GPNodeSum extends AbstractGPNode implements java.io.Serializable { /** This method will evaluate a given node * @param environment */ + @Override public Object evaluate(InterfaceProgramProblem environment) { Object tmpObj; double result = 0; diff --git a/src/eva2/server/go/mocco/MOCCOChooseMOStrategy.java b/src/eva2/server/go/mocco/MOCCOChooseMOStrategy.java index 62ccbd15..47502b3a 100644 --- a/src/eva2/server/go/mocco/MOCCOChooseMOStrategy.java +++ b/src/eva2/server/go/mocco/MOCCOChooseMOStrategy.java @@ -33,6 +33,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); this.m_Mocco.m_JPanelParameters.removeAll(); @@ -149,6 +150,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces } ActionListener choosenMOEA = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelParameters.removeAll(); @@ -157,6 +159,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces } }; ActionListener choosenSTEP = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelParameters.removeAll(); @@ -165,6 +168,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces } }; ActionListener choosenREFP = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelParameters.removeAll(); @@ -173,6 +177,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces } }; ActionListener choosenTBCH = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelParameters.removeAll(); @@ -181,6 +186,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces } }; ActionListener choosenGDF = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelParameters.removeAll(); diff --git a/src/eva2/server/go/mocco/MOCCOChooseReferencePoint.java b/src/eva2/server/go/mocco/MOCCOChooseReferencePoint.java index e35de1d1..36df5a83 100644 --- a/src/eva2/server/go/mocco/MOCCOChooseReferencePoint.java +++ b/src/eva2/server/go/mocco/MOCCOChooseReferencePoint.java @@ -31,6 +31,7 @@ public class MOCCOChooseReferencePoint extends MOCCOPhase implements InterfacePr /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -97,6 +98,7 @@ public class MOCCOChooseReferencePoint extends MOCCOPhase implements InterfacePr } ActionListener refPointEdited = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { for (int i = 0; i < m_JTextField.length; i++) { m_Mocco.m_View.m_ReferencePoint[i] = new Double(m_JTextField[i].getText()).doubleValue(); @@ -106,6 +108,7 @@ public class MOCCOChooseReferencePoint extends MOCCOPhase implements InterfacePr }; ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_ReferencePoint = m_Mocco.m_View.m_ReferencePoint; m_Mocco.m_View.setRefPointSelectable(false); @@ -126,6 +129,7 @@ public class MOCCOChooseReferencePoint extends MOCCOPhase implements InterfacePr * a full vector since it is only 2d * @param point The selected point, most likely 2d */ + @Override public void refPointGiven(double[] point) { this.m_ReferencePoint = point; this.updateSelected(); diff --git a/src/eva2/server/go/mocco/MOCCOChooseReferenceSolution.java b/src/eva2/server/go/mocco/MOCCOChooseReferenceSolution.java index 9aa56452..46222024 100644 --- a/src/eva2/server/go/mocco/MOCCOChooseReferenceSolution.java +++ b/src/eva2/server/go/mocco/MOCCOChooseReferenceSolution.java @@ -32,6 +32,7 @@ public class MOCCOChooseReferenceSolution extends MOCCOPhase implements Interfac /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -111,6 +112,7 @@ public class MOCCOChooseReferenceSolution extends MOCCOPhase implements Interfac } ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (m_ReferenceSolution != null) { m_Mocco.m_View.setRefSolutionSelectable(false); @@ -138,6 +140,7 @@ public class MOCCOChooseReferenceSolution extends MOCCOPhase implements Interfac * Individual has been selected * @param indy The selected individual */ + @Override public void individualSelected(AbstractEAIndividual indy) { Population pop = this.m_Mocco.m_State.m_ParetoFront.getMarkedIndividuals(); if (pop.size() == 1) { diff --git a/src/eva2/server/go/mocco/MOCCOInitialPopulationSize.java b/src/eva2/server/go/mocco/MOCCOInitialPopulationSize.java index a2eda29d..c578622c 100644 --- a/src/eva2/server/go/mocco/MOCCOInitialPopulationSize.java +++ b/src/eva2/server/go/mocco/MOCCOInitialPopulationSize.java @@ -28,6 +28,7 @@ public class MOCCOInitialPopulationSize extends MOCCOPhase implements InterfaceP /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -61,6 +62,7 @@ public class MOCCOInitialPopulationSize extends MOCCOPhase implements InterfaceP ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelControl.validate(); @@ -70,6 +72,7 @@ public class MOCCOInitialPopulationSize extends MOCCOPhase implements InterfaceP }; ActionListener popSizeEdited = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { String s = m_JTextField.getText(); try { diff --git a/src/eva2/server/go/mocco/MOCCOParameterizeGDF.java b/src/eva2/server/go/mocco/MOCCOParameterizeGDF.java index 268056b3..c87e559d 100644 --- a/src/eva2/server/go/mocco/MOCCOParameterizeGDF.java +++ b/src/eva2/server/go/mocco/MOCCOParameterizeGDF.java @@ -44,6 +44,7 @@ public class MOCCOParameterizeGDF extends MOCCOPhase implements InterfaceProcess /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -183,6 +184,7 @@ public class MOCCOParameterizeGDF extends MOCCOPhase implements InterfaceProcess } ActionListener weightListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { double[] w = new double [m_TradeOff.length]; double sum = 0; @@ -203,6 +205,7 @@ public class MOCCOParameterizeGDF extends MOCCOPhase implements InterfaceProcess }; ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { double[] w = new double [m_TradeOff.length]; for (int i = 0; i < m_TradeOff.length; i++) { diff --git a/src/eva2/server/go/mocco/MOCCOParameterizeMO.java b/src/eva2/server/go/mocco/MOCCOParameterizeMO.java index 79cee67d..d762963f 100644 --- a/src/eva2/server/go/mocco/MOCCOParameterizeMO.java +++ b/src/eva2/server/go/mocco/MOCCOParameterizeMO.java @@ -38,6 +38,7 @@ public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessE /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -134,6 +135,7 @@ public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessE } ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { //m_Mocco.m_State.m_Optimizer = (InterfaceOptimizer)m_Optimizer.clone(); m_Mocco.m_JPanelControl.removeAll(); diff --git a/src/eva2/server/go/mocco/MOCCOParameterizeRefPoint.java b/src/eva2/server/go/mocco/MOCCOParameterizeRefPoint.java index f575a0ce..58234561 100644 --- a/src/eva2/server/go/mocco/MOCCOParameterizeRefPoint.java +++ b/src/eva2/server/go/mocco/MOCCOParameterizeRefPoint.java @@ -49,6 +49,7 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -194,12 +195,14 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr } ActionListener satisfiedChanged = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { } }; ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // first read the values try { diff --git a/src/eva2/server/go/mocco/MOCCOParameterizeSO.java b/src/eva2/server/go/mocco/MOCCOParameterizeSO.java index c744d1ee..3eb22331 100644 --- a/src/eva2/server/go/mocco/MOCCOParameterizeSO.java +++ b/src/eva2/server/go/mocco/MOCCOParameterizeSO.java @@ -38,6 +38,7 @@ public class MOCCOParameterizeSO extends MOCCOPhase implements InterfaceProcessE /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -128,6 +129,7 @@ public class MOCCOParameterizeSO extends MOCCOPhase implements InterfaceProcessE } ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelParameters.removeAll(); diff --git a/src/eva2/server/go/mocco/MOCCOParameterizeSTEP.java b/src/eva2/server/go/mocco/MOCCOParameterizeSTEP.java index e45133d5..fd949e11 100644 --- a/src/eva2/server/go/mocco/MOCCOParameterizeSTEP.java +++ b/src/eva2/server/go/mocco/MOCCOParameterizeSTEP.java @@ -52,6 +52,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -224,6 +225,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces } ActionListener satisfiedChanged = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { InterfaceOptimizationObjective[] obj = ((InterfaceMultiObjectiveDeNovoProblem)m_Mocco.m_State.m_CurrentProblem).getProblemObjectives(); for (int i = 0; i < m_Satisfied.length; i++) { @@ -245,6 +247,7 @@ public class MOCCOParameterizeSTEP extends MOCCOPhase implements InterfaceProces }; ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // first fetch the data from the choice and set constraints InterfaceOptimizationObjective[] obj = ((InterfaceMultiObjectiveDeNovoProblem)m_Mocco.m_State.m_CurrentProblem).getProblemObjectives(); diff --git a/src/eva2/server/go/mocco/MOCCOParameterizeTchebycheff.java b/src/eva2/server/go/mocco/MOCCOParameterizeTchebycheff.java index 6a746f80..b4b25195 100644 --- a/src/eva2/server/go/mocco/MOCCOParameterizeTchebycheff.java +++ b/src/eva2/server/go/mocco/MOCCOParameterizeTchebycheff.java @@ -50,6 +50,7 @@ public class MOCCOParameterizeTchebycheff extends MOCCOPhase implements Interfac /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -217,6 +218,7 @@ public class MOCCOParameterizeTchebycheff extends MOCCOPhase implements Interfac } ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // first read the values try { diff --git a/src/eva2/server/go/mocco/MOCCOPhase.java b/src/eva2/server/go/mocco/MOCCOPhase.java index 32ca19be..85e8ae8b 100644 --- a/src/eva2/server/go/mocco/MOCCOPhase.java +++ b/src/eva2/server/go/mocco/MOCCOPhase.java @@ -24,11 +24,13 @@ public abstract class MOCCOPhase implements InterfaceProcessElement { /** This method will call the init method and will go to stall */ + @Override public abstract void initProcessElementParametrization(); /** This method will wait for the parametrisation result * @return boolean Result */ + @Override public boolean isFinished() { return this.m_Finished; } @@ -37,6 +39,7 @@ public abstract class MOCCOPhase implements InterfaceProcessElement { * */ ActionListener saveState2FileForOfflineOptimization = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { // @todo } diff --git a/src/eva2/server/go/mocco/MOCCOProblemInitialization.java b/src/eva2/server/go/mocco/MOCCOProblemInitialization.java index 86dadeae..550e4706 100644 --- a/src/eva2/server/go/mocco/MOCCOProblemInitialization.java +++ b/src/eva2/server/go/mocco/MOCCOProblemInitialization.java @@ -28,6 +28,7 @@ public class MOCCOProblemInitialization extends MOCCOPhase implements InterfaceP /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -80,6 +81,7 @@ public class MOCCOProblemInitialization extends MOCCOPhase implements InterfaceP } ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_JPanelControl.removeAll(); m_Mocco.m_JPanelControl.validate(); @@ -89,6 +91,7 @@ public class MOCCOProblemInitialization extends MOCCOPhase implements InterfaceP }; ActionListener problemChanged = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { String className = (String)m_ProblemChooser.getSelectedItem(); m_Mocco.m_JPanelParameters.removeAll(); diff --git a/src/eva2/server/go/mocco/MOCCOProblemRedefinition.java b/src/eva2/server/go/mocco/MOCCOProblemRedefinition.java index ef323163..736a1104 100644 --- a/src/eva2/server/go/mocco/MOCCOProblemRedefinition.java +++ b/src/eva2/server/go/mocco/MOCCOProblemRedefinition.java @@ -29,6 +29,7 @@ public class MOCCOProblemRedefinition extends MOCCOPhase implements InterfacePro /** This method will call the init method and will go to stall */ + @Override public void initProcessElementParametrization() { this.m_Mocco.m_JPanelControl.removeAll(); @@ -72,6 +73,7 @@ public class MOCCOProblemRedefinition extends MOCCOPhase implements InterfacePro } ActionListener continue2 = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_State.m_CurrentProblem = (InterfaceOptimizationProblem)m_Problem.clone(); m_Mocco.m_JPanelParameters.removeAll(); @@ -81,6 +83,7 @@ public class MOCCOProblemRedefinition extends MOCCOPhase implements InterfacePro } }; ActionListener reevaluate = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Mocco.m_State.m_CurrentProblem = (InterfaceOptimizationProblem)m_Problem.clone(); m_Mocco.m_State.m_CurrentProblem = m_Problem; diff --git a/src/eva2/server/go/mocco/paretofrontviewer/MOCCOViewer.java b/src/eva2/server/go/mocco/paretofrontviewer/MOCCOViewer.java index 813f34df..1bc05cdf 100644 --- a/src/eva2/server/go/mocco/paretofrontviewer/MOCCOViewer.java +++ b/src/eva2/server/go/mocco/paretofrontviewer/MOCCOViewer.java @@ -156,6 +156,7 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener, // } ActionListener paretoFrontViewChanged = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { JComboBox tmpC = (JComboBox)event.getSource(); int index = tmpC.getSelectedIndex(); @@ -194,6 +195,7 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener, }; ActionListener saveParetoFront = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { SimpleDateFormat formatter = new SimpleDateFormat("E'_'yyyy.MM.dd'_'HH.mm.ss"); String m_StartDate = formatter.format(new Date()); @@ -395,6 +397,7 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener, * Individual has been selected * @param indy The selected individual */ + @Override public void individualSelected(AbstractEAIndividual indy) { if (indy.isMarked()) indy.unmark(); else { @@ -448,6 +451,7 @@ public class MOCCOViewer extends JPanel implements InterfaceRefSolutionListener, /** This method will notify the listener that a point has been selected * @param point The selected point, most likely 2d */ + @Override public void refPointGiven(double[] point) { this.m_ReferencePoint = point; if (this.m_RefPointListener != null) this.m_RefPointListener.refPointGiven(point); diff --git a/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontView2D.java b/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontView2D.java index 42c503fc..8fff01f4 100644 --- a/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontView2D.java +++ b/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontView2D.java @@ -85,12 +85,14 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie this.updateView(); } ActionListener jcomboboxListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateView(); } }; ActionListener jcombobox2Listener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateObjectiveComboBoxes(); } @@ -150,6 +152,7 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie * the data has changed most likely due to changes in * the problem definition */ + @Override public void updateView() { // i assume that all the populations are evaluated // all using the same problem @@ -348,6 +351,7 @@ public class ParetoFrontView2D extends JPanel implements InterfaceParetoFrontVie * a full vector since it is only 2d * @param point The selected point, most likely 2d */ + @Override public void refPointGiven(double[] point) { if (this.m_JCFitObj.getSelectedIndex() == 1) { JOptionPane.showMessageDialog(this.m_MOCCOViewer.m_MOCCO.m_JFrame, diff --git a/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewParallelAxsis.java b/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewParallelAxsis.java index a59f55e0..6f530278 100644 --- a/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewParallelAxsis.java +++ b/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewParallelAxsis.java @@ -21,6 +21,7 @@ public class ParetoFrontViewParallelAxsis extends JPanel implements InterfacePar * the data has changed most likely due to changes in * the problem definition */ + @Override public void updateView() { } diff --git a/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewScatterPlot.java b/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewScatterPlot.java index f154f608..831f6f61 100644 --- a/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewScatterPlot.java +++ b/src/eva2/server/go/mocco/paretofrontviewer/ParetoFrontViewScatterPlot.java @@ -230,6 +230,7 @@ class SimpleView extends JComponent implements InterfaceRefPointListener { * a full vector since it is only 2d * @param point The selected point, most likely 2d */ + @Override public void refPointGiven(double[] point) { if (this.m_Dad.m_JCFitObj.getSelectedIndex() == 1) { JOptionPane.showMessageDialog(this.m_Dad.m_MOCCOViewer.m_MOCCO.m_JFrame, @@ -303,6 +304,7 @@ public class ParetoFrontViewScatterPlot extends JPanel implements InterfaceParet this.updateView(); } ActionListener jcomboboxListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateView(); } @@ -325,6 +327,7 @@ public class ParetoFrontViewScatterPlot extends JPanel implements InterfaceParet * the data has changed most likely due to changes in * the problem definition */ + @Override public void updateView() { if (this.m_MOCCOViewer.m_MOCCO.m_State.m_CurrentProblem == null) { this.m_Scatter = null; diff --git a/src/eva2/server/go/operators/archiving/AbstractArchiving.java b/src/eva2/server/go/operators/archiving/AbstractArchiving.java index 977aab24..ccff58a9 100644 --- a/src/eva2/server/go/operators/archiving/AbstractArchiving.java +++ b/src/eva2/server/go/operators/archiving/AbstractArchiving.java @@ -27,6 +27,7 @@ public abstract class AbstractArchiving implements InterfaceArchiving, java.io.S * the object * @return the deep clone */ + @Override public abstract Object clone(); /** This mehtod will test if a given individual is dominant within diff --git a/src/eva2/server/go/operators/archiving/ArchivingAllDominating.java b/src/eva2/server/go/operators/archiving/ArchivingAllDominating.java index 95a64259..e4710f0a 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingAllDominating.java +++ b/src/eva2/server/go/operators/archiving/ArchivingAllDominating.java @@ -22,6 +22,7 @@ public class ArchivingAllDominating extends AbstractArchiving implements java.io this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new ArchivingAllDominating(this); } @@ -31,6 +32,7 @@ public class ArchivingAllDominating extends AbstractArchiving implements java.io * remove elements from the archive if the archive target size is exceeded. * @param pop The population that may add Individuals to the archive. */ + @Override public void addElementsToArchive(Population pop) { if (pop.getArchive() == null) pop.SetArchive(new Population()); diff --git a/src/eva2/server/go/operators/archiving/ArchivingMaxiMin.java b/src/eva2/server/go/operators/archiving/ArchivingMaxiMin.java index 43358fd2..505e3bbe 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingMaxiMin.java +++ b/src/eva2/server/go/operators/archiving/ArchivingMaxiMin.java @@ -32,6 +32,7 @@ public class ArchivingMaxiMin implements InterfaceArchiving, java.io.Serializabl this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new ArchivingMaxiMin(this); } @@ -41,6 +42,7 @@ public class ArchivingMaxiMin implements InterfaceArchiving, java.io.Serializabl * remove elements from the archive if the archive target size is exceeded. * @param pop The population that may add Individuals to the archive. */ + @Override public void addElementsToArchive(Population pop) { Population archive; double[] tmpD; diff --git a/src/eva2/server/go/operators/archiving/ArchivingNSGA.java b/src/eva2/server/go/operators/archiving/ArchivingNSGA.java index be9361c6..3afbb286 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingNSGA.java +++ b/src/eva2/server/go/operators/archiving/ArchivingNSGA.java @@ -21,6 +21,7 @@ public class ArchivingNSGA extends AbstractArchiving implements java.io.Serializ this.m_Cleaner = (InterfaceRemoveSurplusIndividuals) a.m_Cleaner.clone(); } + @Override public Object clone() { return (Object) new ArchivingNSGA(this); } @@ -30,6 +31,7 @@ public class ArchivingNSGA extends AbstractArchiving implements java.io.Serializ * remove elements from the archive if the archive target size is exceeded. * @param pop The population that may add Individuals to the archive. */ + @Override public void addElementsToArchive(Population pop) { if (pop.getArchive() == null) pop.SetArchive(new Population()); diff --git a/src/eva2/server/go/operators/archiving/ArchivingNSGAII.java b/src/eva2/server/go/operators/archiving/ArchivingNSGAII.java index 2c88ccac..d4218229 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingNSGAII.java +++ b/src/eva2/server/go/operators/archiving/ArchivingNSGAII.java @@ -22,6 +22,7 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab public ArchivingNSGAII(ArchivingNSGAII a) { } + @Override public Object clone() { return (Object) new ArchivingNSGAII(this); } @@ -31,6 +32,7 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab * remove elements from the archive if the archive target size is exceeded. * @param pop The population that may add Individuals to the archive. */ + @Override public void addElementsToArchive(Population pop) { if (pop.getArchive() == null) pop.SetArchive(new Population()); @@ -188,6 +190,7 @@ public class ArchivingNSGAII extends ArchivingNSGA implements java.io.Serializab /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "NSGA II"; } diff --git a/src/eva2/server/go/operators/archiving/ArchivingNSGAIISMeasure.java b/src/eva2/server/go/operators/archiving/ArchivingNSGAIISMeasure.java index de85763c..3f46ec8c 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingNSGAIISMeasure.java +++ b/src/eva2/server/go/operators/archiving/ArchivingNSGAIISMeasure.java @@ -11,6 +11,7 @@ public class ArchivingNSGAIISMeasure extends ArchivingNSGAII { * for all individuals * @param fronts The pareto fronts */ + @Override public void calculateCrowdingDistance(Population[] fronts) { //TODO Dimension der Zielfunktion checken diff --git a/src/eva2/server/go/operators/archiving/ArchivingPESAII.java b/src/eva2/server/go/operators/archiving/ArchivingPESAII.java index c4d3d0ce..7c3de9e8 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingPESAII.java +++ b/src/eva2/server/go/operators/archiving/ArchivingPESAII.java @@ -30,6 +30,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial this.m_GridSize = a.m_GridSize; } + @Override public Object clone() { return (Object) new ArchivingPESAII(this); } @@ -39,6 +40,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial * remove elements from the archive if the archive target size is exceeded. * @param pop The population that may add Individuals to the archive. */ + @Override public void addElementsToArchive(Population pop) { if (pop.getArchive() == null) pop.SetArchive(new Population()); diff --git a/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java b/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java index 270f1cfe..d01c7552 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java +++ b/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java @@ -31,6 +31,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial this.m_Metric = (InterfaceDistanceMetric)a.m_Metric.clone(); } + @Override public Object clone() { return (Object) new ArchivingSPEAII(this); } @@ -40,6 +41,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial * remove elements from the archive if the archive target size is exceeded. * @param pop The population that may add Individuals to the archive. */ + @Override public void addElementsToArchive(Population pop) { if (pop.getArchive() == null) pop.SetArchive(new Population()); diff --git a/src/eva2/server/go/operators/archiving/InformationRetrievalInserting.java b/src/eva2/server/go/operators/archiving/InformationRetrievalInserting.java index 22889d45..bc792bfa 100644 --- a/src/eva2/server/go/operators/archiving/InformationRetrievalInserting.java +++ b/src/eva2/server/go/operators/archiving/InformationRetrievalInserting.java @@ -19,6 +19,7 @@ public class InformationRetrievalInserting implements InterfaceInformationRetrie public InformationRetrievalInserting(InformationRetrievalInserting a) { } + @Override public Object clone() { return (Object) new InformationRetrievalInserting(this); } @@ -27,6 +28,7 @@ public class InformationRetrievalInserting implements InterfaceInformationRetrie * an already existing population. * @param pop The population. */ + @Override public void retrieveInformationFrom(Population pop) { Population archive = pop.getArchive(); diff --git a/src/eva2/server/go/operators/archiving/InformationRetrievalNone.java b/src/eva2/server/go/operators/archiving/InformationRetrievalNone.java index d0aaaaee..97a74c3e 100644 --- a/src/eva2/server/go/operators/archiving/InformationRetrievalNone.java +++ b/src/eva2/server/go/operators/archiving/InformationRetrievalNone.java @@ -18,6 +18,7 @@ public class InformationRetrievalNone implements InterfaceInformationRetrieval, public InformationRetrievalNone(InformationRetrievalNone a) { } + @Override public Object clone() { return (Object) new InformationRetrievalNone(this); } @@ -26,6 +27,7 @@ public class InformationRetrievalNone implements InterfaceInformationRetrieval, * an already existing population. * @param pop The population. */ + @Override public void retrieveInformationFrom(Population pop) { // no InterfaceInformation Retrieval is performed return; diff --git a/src/eva2/server/go/operators/archiving/InformationRetrievalReplacing.java b/src/eva2/server/go/operators/archiving/InformationRetrievalReplacing.java index 91ef9409..b2192b23 100644 --- a/src/eva2/server/go/operators/archiving/InformationRetrievalReplacing.java +++ b/src/eva2/server/go/operators/archiving/InformationRetrievalReplacing.java @@ -19,6 +19,7 @@ public class InformationRetrievalReplacing implements InterfaceInformationRetrie public InformationRetrievalReplacing(InformationRetrievalReplacing a) { } + @Override public Object clone() { return (Object) new InformationRetrievalReplacing(this); } @@ -27,6 +28,7 @@ public class InformationRetrievalReplacing implements InterfaceInformationRetrie * an already existing population. * @param pop The population. */ + @Override public void retrieveInformationFrom(Population pop) { Population archive = pop.getArchive(); if (archive == null) return; diff --git a/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsDynamicHyperCube.java b/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsDynamicHyperCube.java index a092436f..b5abe144 100644 --- a/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsDynamicHyperCube.java +++ b/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsDynamicHyperCube.java @@ -23,6 +23,7 @@ public class RemoveSurplusIndividualsDynamicHyperCube implements InterfaceRemove public RemoveSurplusIndividualsDynamicHyperCube(RemoveSurplusIndividualsDynamicHyperCube a) { } + @Override public Object clone() { return (Object) new RemoveSurplusIndividualsDynamicHyperCube(this); } @@ -31,6 +32,7 @@ public class RemoveSurplusIndividualsDynamicHyperCube implements InterfaceRemove * from a given archive. Note archive will be altered! * @param archive */ + @Override public void removeSurplusIndividuals(Population archive) { double[][] fitness; double[] space; diff --git a/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsSMetric.java b/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsSMetric.java index cbcba36e..504b7a05 100644 --- a/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsSMetric.java +++ b/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsSMetric.java @@ -23,6 +23,7 @@ public class RemoveSurplusIndividualsSMetric implements InterfaceRemoveSurplusIn public RemoveSurplusIndividualsSMetric(RemoveSurplusIndividualsSMetric a) { } + @Override public Object clone() { return (Object) new RemoveSurplusIndividualsSMetric(this); } @@ -31,6 +32,7 @@ public class RemoveSurplusIndividualsSMetric implements InterfaceRemoveSurplusIn * from a given archive. Note archive will be altered! * @param archive */ + @Override public void removeSurplusIndividuals(Population archive) { double[][] fitness; double[] space; diff --git a/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsStaticHyperCube.java b/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsStaticHyperCube.java index 7c2b0b72..99d9caaf 100644 --- a/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsStaticHyperCube.java +++ b/src/eva2/server/go/operators/archiving/RemoveSurplusIndividualsStaticHyperCube.java @@ -23,6 +23,7 @@ public class RemoveSurplusIndividualsStaticHyperCube extends RemoveSurplusIndivi public RemoveSurplusIndividualsStaticHyperCube(RemoveSurplusIndividualsStaticHyperCube a) { } + @Override public Object clone() { return (Object) new RemoveSurplusIndividualsStaticHyperCube(this); } @@ -31,6 +32,7 @@ public class RemoveSurplusIndividualsStaticHyperCube extends RemoveSurplusIndivi * from a given archive. Note archive will be altered! * @param archive */ + @Override public void removeSurplusIndividuals(Population archive) { double[][] fitness; double[] space; diff --git a/src/eva2/server/go/operators/classification/ClassificationSelfOrganizingMaps.java b/src/eva2/server/go/operators/classification/ClassificationSelfOrganizingMaps.java index 9c0dfa24..f00ea0a6 100644 --- a/src/eva2/server/go/operators/classification/ClassificationSelfOrganizingMaps.java +++ b/src/eva2/server/go/operators/classification/ClassificationSelfOrganizingMaps.java @@ -80,6 +80,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I * the object * @return the deep clone */ + @Override public Object clone() { return (Object) new ClassificationSelfOrganizingMaps(this); } @@ -88,6 +89,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I * @param space The double[n][d] space * @param type The classes [0,1,..] */ + @Override public void init(double[][] space, int[] type) { this.m_AlternativeClasses = 0; for (int i = 0; i < type.length; i++) { @@ -145,6 +147,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I * @param space The double[n][d] space * @param type The int[n] classes [0,1,..] */ + @Override public void train(double[][] space, int[] type) { // first init the assignment to zero for (int i = 0; i < this.m_SOM.length; i++) { @@ -304,6 +307,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I * @param point The double[d] data point. * @return type The resulting class. */ + @Override public int getClassFor(double[] point) { int[] winner = this.findWinningNeuron(point); int mostClasses = 0; @@ -329,6 +333,7 @@ public class ClassificationSelfOrganizingMaps implements java.io.Serializable, I frame.setSize(500, 500); frame.setLocation(530, 50); frame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.exit(0); } diff --git a/src/eva2/server/go/operators/cluster/ClusterAll.java b/src/eva2/server/go/operators/cluster/ClusterAll.java index 67458734..cfb75901 100644 --- a/src/eva2/server/go/operators/cluster/ClusterAll.java +++ b/src/eva2/server/go/operators/cluster/ClusterAll.java @@ -15,6 +15,7 @@ public class ClusterAll implements InterfaceClustering, Serializable { private boolean assignLoners = false; // should loners be assigned? + @Override public Object clone() { return new ClusterAll(); } @@ -35,6 +36,7 @@ public class ClusterAll implements InterfaceClustering, Serializable { * @param referenceSet a reference population for dynamic measures * @return associative list matching loners to species. */ + @Override public int[] associateLoners(Population loners, Population[] species, Population referenceSet) { if (loners!=null && (loners.size()>0)) { @@ -49,6 +51,7 @@ public class ClusterAll implements InterfaceClustering, Serializable { * (non-Javadoc) * @see eva2.server.go.operators.cluster.InterfaceClustering#cluster(eva2.server.go.populations.Population, eva2.server.go.populations.Population) */ + @Override public Population[] cluster(Population pop, Population referenceSet) { // first pop is empty (there are no loners), second pop is complete return new Population[]{pop.cloneWithoutInds(), pop.cloneShallowInds()}; @@ -58,6 +61,7 @@ public class ClusterAll implements InterfaceClustering, Serializable { * (non-Javadoc) * @see eva2.server.go.operators.cluster.InterfaceClustering#initClustering(eva2.server.go.populations.Population) */ + @Override public String initClustering(Population pop) { return null; } @@ -66,6 +70,7 @@ public class ClusterAll implements InterfaceClustering, Serializable { * (non-Javadoc) * @see eva2.server.go.operators.cluster.InterfaceClustering#mergingSpecies(eva2.server.go.populations.Population, eva2.server.go.populations.Population, eva2.server.go.populations.Population) */ + @Override public boolean mergingSpecies(Population species1, Population species2, Population referenceSet) { return true; diff --git a/src/eva2/server/go/operators/cluster/ClusteringDensityBased.java b/src/eva2/server/go/operators/cluster/ClusteringDensityBased.java index 1ccfb061..765462d3 100644 --- a/src/eva2/server/go/operators/cluster/ClusteringDensityBased.java +++ b/src/eva2/server/go/operators/cluster/ClusteringDensityBased.java @@ -83,10 +83,12 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam, * the object * @return the deep clone */ + @Override public Object clone() { return (Object) new ClusteringDensityBased(this); } + @Override public Population[] cluster(Population pop, Population referencePop) { ConnectionMatrix = new boolean[pop.size()][pop.size()]; Clustered = new boolean[pop.size()]; @@ -158,6 +160,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam, * @param species2 The second species. * @return True if species converge, else False. */ + @Override public boolean mergingSpecies(Population species1, Population species2, Population referencePop) { if (m_TestConvergingSpeciesOnBestOnly) { double specDist = this.m_Metric.distance(species1.getBestEAIndividual(), species2.getBestEAIndividual()); @@ -200,6 +203,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam, * @param species * @return associative list matching loners to species. */ + @Override public int[] associateLoners(Population loners, Population[] species, Population referencePop) { int[] res = new int[loners.size()]; for (int l=0; l[][] closestPerSpecList = new Pair[loners.size()][species.length]; int[] res = new int[loners.size()]; @@ -191,6 +193,7 @@ public class ClusteringNearestBetter implements InterfaceClustering, Serializabl * Perform one clustering step to measure the mean distance to the * nearest better individual (only if used). */ + @Override public String initClustering(Population pop) { if (this.isAdaptiveThreshold()) { ArrayList sorted = pop.getSorted(comparator); @@ -205,6 +208,7 @@ public class ClusteringNearestBetter implements InterfaceClustering, Serializabl } else return null; } + @Override public Population[] cluster(Population pop, Population referenceSet) { if (pop.isEmpty()) return new Population[]{pop.cloneWithoutInds()}; ArrayList sorted = pop.getSorted(comparator); @@ -339,6 +343,7 @@ public class ClusteringNearestBetter implements InterfaceClustering, Serializabl * @param species2 The second species. * @return True if species converge, else False. */ + @Override public boolean mergingSpecies(Population species1, Population species2, Population referenceSet) { getRefData(referenceSet, species1); if (testConvergingSpeciesOnBestOnly) { diff --git a/src/eva2/server/go/operators/cluster/ClusteringXMeans.java b/src/eva2/server/go/operators/cluster/ClusteringXMeans.java index ba774df1..9c8005b7 100644 --- a/src/eva2/server/go/operators/cluster/ClusteringXMeans.java +++ b/src/eva2/server/go/operators/cluster/ClusteringXMeans.java @@ -44,6 +44,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab * the object * @return the deep clone */ + @Override public Object clone() { return (Object) new ClusteringXMeans(this); } @@ -55,6 +56,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab * @param pop The population of individuals that is to be clustered. * @return Population[] */ + @Override public Population[] cluster(Population pop, Population referencePop) { ClusteringKMeans kmeans = new ClusteringKMeans(); Population[][] tmpResults = new Population[this.m_MaxK][]; @@ -223,6 +225,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab * @param species2 The second species. * @return True if species converge, else False. */ + @Override public boolean mergingSpecies(Population species1, Population species2, Population referencePop) { // @todo i could use the BIC metric from X-means to calculate this return false; @@ -238,6 +241,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab // return false; // } + @Override public int[] associateLoners(Population loners, Population[] species, Population referencePop) { int[] res=new int[loners.size()]; System.err.println("Warning, associateLoners not implemented for " + this.getClass()); @@ -380,6 +384,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab return "Toggle between search/objective space distance."; } + @Override public String initClustering(Population pop) { return null; } diff --git a/src/eva2/server/go/operators/constraint/AbstractConstraint.java b/src/eva2/server/go/operators/constraint/AbstractConstraint.java index cbff10c6..21227d82 100644 --- a/src/eva2/server/go/operators/constraint/AbstractConstraint.java +++ b/src/eva2/server/go/operators/constraint/AbstractConstraint.java @@ -45,6 +45,7 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S setRelation(getRelation()); } + @Override public abstract Object clone(); public InterfaceParameterControl getParamControl() { @@ -59,6 +60,7 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S /** * Return the absolute (positive) degree of violation or zero if the constraint is fulfilled. */ + @Override public double getViolation(double[] indyX) { double viol = getRawViolationValue(indyX); return getViolationConsideringRelation(viol); @@ -167,6 +169,7 @@ public abstract class AbstractConstraint implements InterfaceDoubleConstraint, S return (getViolation(pos)>0); } + @Override public boolean isSatisfied(double[] pos) { return (getViolation(pos)==0.); } diff --git a/src/eva2/server/go/operators/constraint/ConstBelongsToDifferentClass.java b/src/eva2/server/go/operators/constraint/ConstBelongsToDifferentClass.java index 4eb31467..5ab07881 100644 --- a/src/eva2/server/go/operators/constraint/ConstBelongsToDifferentClass.java +++ b/src/eva2/server/go/operators/constraint/ConstBelongsToDifferentClass.java @@ -40,6 +40,7 @@ public class ConstBelongsToDifferentClass implements InterfaceConstraint, java.i } } + @Override public Object clone() { return (Object) new ConstBelongsToDifferentClass(this); } @@ -49,6 +50,7 @@ public class ConstBelongsToDifferentClass implements InterfaceConstraint, java.i * @param indy The individual to check. * @return true if valid false else. */ + @Override public boolean isValid(AbstractEAIndividual indy) { double[] data; if (this.m_UsePhenotype && (indy instanceof InterfaceDataTypeDouble)) { diff --git a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanLinear.java b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanLinear.java index 79143a57..f2202111 100644 --- a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanLinear.java +++ b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanLinear.java @@ -26,6 +26,7 @@ public class ConstObjectivesInEqualityBiggerThanLinear implements InterfaceConst this.m = a.m; } + @Override public Object clone() { return (Object) new ConstObjectivesInEqualityBiggerThanLinear(this); } @@ -35,6 +36,7 @@ public class ConstObjectivesInEqualityBiggerThanLinear implements InterfaceConst * @param indy The individual to check. * @return true if valid false else. */ + @Override public boolean isValid(AbstractEAIndividual indy) { double[] d = indy.getFitness(); if (d.length != 2) return true; diff --git a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanSurface.java b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanSurface.java index 8aa68545..3a8214dd 100644 --- a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanSurface.java +++ b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityBiggerThanSurface.java @@ -26,6 +26,7 @@ public class ConstObjectivesInEqualityBiggerThanSurface implements InterfaceCons this.norm = a.norm; } + @Override public Object clone() { return (Object) new ConstObjectivesInEqualityBiggerThanSurface(this); } @@ -35,6 +36,7 @@ public class ConstObjectivesInEqualityBiggerThanSurface implements InterfaceCons * @param indy The individual to check. * @return true if valid false else. */ + @Override public boolean isValid(AbstractEAIndividual indy) { double[] d = indy.getFitness(); if (this.getScalarProduct(norm, this.getSubstraction(d, base)) >= 0) return true; diff --git a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityLesserThanLinear.java b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityLesserThanLinear.java index b487f87f..83b28ad7 100644 --- a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityLesserThanLinear.java +++ b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualityLesserThanLinear.java @@ -26,6 +26,7 @@ public class ConstObjectivesInEqualityLesserThanLinear implements InterfaceConst this.m = a.m; } + @Override public Object clone() { return (Object) new ConstObjectivesInEqualityLesserThanLinear(this); } @@ -35,6 +36,7 @@ public class ConstObjectivesInEqualityLesserThanLinear implements InterfaceConst * @param indy The individual to check. * @return true if valid false else. */ + @Override public boolean isValid(AbstractEAIndividual indy) { double[] d = indy.getFitness(); if (d.length != 2) return true; diff --git a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualitySmallerThanSurface.java b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualitySmallerThanSurface.java index f423de17..8a70e930 100644 --- a/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualitySmallerThanSurface.java +++ b/src/eva2/server/go/operators/constraint/ConstObjectivesInEqualitySmallerThanSurface.java @@ -26,6 +26,7 @@ public class ConstObjectivesInEqualitySmallerThanSurface implements InterfaceCon this.norm = a.norm; } + @Override public Object clone() { return (Object) new ConstObjectivesInEqualitySmallerThanSurface(this); } @@ -35,6 +36,7 @@ public class ConstObjectivesInEqualitySmallerThanSurface implements InterfaceCon * @param indy The individual to check. * @return true if valid false else. */ + @Override public boolean isValid(AbstractEAIndividual indy) { double[] d = indy.getFitness(); if (this.getScalarProduct(norm, this.getSubstraction(d, base)) < 0) return true; diff --git a/src/eva2/server/go/operators/constraint/DummyConstraint.java b/src/eva2/server/go/operators/constraint/DummyConstraint.java index 0cfaad40..2b0f87c3 100644 --- a/src/eva2/server/go/operators/constraint/DummyConstraint.java +++ b/src/eva2/server/go/operators/constraint/DummyConstraint.java @@ -14,6 +14,7 @@ public class DummyConstraint extends AbstractConstraint { return new DummyConstraint(); } + @Override public void hideHideable() { GenericObjectEditor.setHideAllProperties(this.getClass(), true); } diff --git a/src/eva2/server/go/operators/constraint/GenericConstraint.java b/src/eva2/server/go/operators/constraint/GenericConstraint.java index 9cc46c1d..70530191 100644 --- a/src/eva2/server/go/operators/constraint/GenericConstraint.java +++ b/src/eva2/server/go/operators/constraint/GenericConstraint.java @@ -53,6 +53,7 @@ public class GenericConstraint extends AbstractConstraint implements InterfaceDo // compileConstraint(constraintString); } + @Override public Object clone() { return new GenericConstraint(this); } diff --git a/src/eva2/server/go/operators/constraint/IntervalConstraint.java b/src/eva2/server/go/operators/constraint/IntervalConstraint.java index 9771eab5..6db56b7d 100644 --- a/src/eva2/server/go/operators/constraint/IntervalConstraint.java +++ b/src/eva2/server/go/operators/constraint/IntervalConstraint.java @@ -23,6 +23,7 @@ public class IntervalConstraint extends AbstractConstraint implements InterfaceD genericConstr = null; } + @Override public void hideHideable() { GenericObjectEditor.setHideProperty(this.getClass(), "relation", true); } diff --git a/src/eva2/server/go/operators/crossover/AdaptiveCrossoverEAMixer.java b/src/eva2/server/go/operators/crossover/AdaptiveCrossoverEAMixer.java index d0238af4..b780c2ef 100644 --- a/src/eva2/server/go/operators/crossover/AdaptiveCrossoverEAMixer.java +++ b/src/eva2/server/go/operators/crossover/AdaptiveCrossoverEAMixer.java @@ -90,11 +90,13 @@ public class AdaptiveCrossoverEAMixer extends CrossoverEAMixer implements Interf return this.initialized; } + @Override public void adaptAfterSelection(Population oldPop, Population selectedPop) { // Nothing to to here } + @Override public void adaptGenerational(Population oldPop, Population selectedPop, Population newPop, boolean updateSelected) { // TODO Perform adaption here by checking how often individuals in newPop have used which operator diff --git a/src/eva2/server/go/operators/crossover/CM1.java b/src/eva2/server/go/operators/crossover/CM1.java index 34c5b2e9..d062ca82 100644 --- a/src/eva2/server/go/operators/crossover/CM1.java +++ b/src/eva2/server/go/operators/crossover/CM1.java @@ -26,10 +26,12 @@ public class CM1 implements InterfaceCrossover, java.io.Serializable { this.m_OptimizationProblem = c.m_OptimizationProblem; } + @Override public Object clone(){ return new CM1(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -54,11 +56,13 @@ public class CM1 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return getName(); } diff --git a/src/eva2/server/go/operators/crossover/CM2.java b/src/eva2/server/go/operators/crossover/CM2.java index 5129c49b..ec377342 100644 --- a/src/eva2/server/go/operators/crossover/CM2.java +++ b/src/eva2/server/go/operators/crossover/CM2.java @@ -26,10 +26,12 @@ public class CM2 implements InterfaceCrossover, java.io.Serializable { this.m_OptimizationProblem = c.m_OptimizationProblem; } + @Override public Object clone(){ return new CM2(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -53,11 +55,13 @@ public class CM2 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return getName(); } diff --git a/src/eva2/server/go/operators/crossover/CM3.java b/src/eva2/server/go/operators/crossover/CM3.java index 433ac2c4..a3237360 100644 --- a/src/eva2/server/go/operators/crossover/CM3.java +++ b/src/eva2/server/go/operators/crossover/CM3.java @@ -26,6 +26,7 @@ public class CM3 implements InterfaceCrossover, java.io.Serializable { this.m_OptimizationProblem = c.m_OptimizationProblem; } + @Override public Object clone(){ return new CM3(this); } @@ -44,6 +45,7 @@ public class CM3 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -65,11 +67,13 @@ public class CM3 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CM4.java b/src/eva2/server/go/operators/crossover/CM4.java index f2a2d9da..19f739e3 100644 --- a/src/eva2/server/go/operators/crossover/CM4.java +++ b/src/eva2/server/go/operators/crossover/CM4.java @@ -26,6 +26,7 @@ public class CM4 implements InterfaceCrossover, java.io.Serializable { this.m_OptimizationProblem = c.m_OptimizationProblem; } + @Override public Object clone(){ return new CM4(this); } @@ -44,6 +45,7 @@ public class CM4 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -67,11 +69,13 @@ public class CM4 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CM5.java b/src/eva2/server/go/operators/crossover/CM5.java index bcddcbfd..ab40594b 100644 --- a/src/eva2/server/go/operators/crossover/CM5.java +++ b/src/eva2/server/go/operators/crossover/CM5.java @@ -26,10 +26,12 @@ public class CM5 implements InterfaceCrossover, java.io.Serializable { this.m_OptimizationProblem = c.m_OptimizationProblem; } + @Override public Object clone(){ return new CM5(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -50,11 +52,13 @@ public class CM5 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CM6.java b/src/eva2/server/go/operators/crossover/CM6.java index ddad8d52..71f12e40 100644 --- a/src/eva2/server/go/operators/crossover/CM6.java +++ b/src/eva2/server/go/operators/crossover/CM6.java @@ -28,10 +28,12 @@ public class CM6 implements InterfaceCrossover, java.io.Serializable { this.m_OptimizationProblem = c.m_OptimizationProblem; } + @Override public Object clone(){ return new CM6(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -56,11 +58,13 @@ public class CM6 implements InterfaceCrossover, java.io.Serializable { return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return getName(); } diff --git a/src/eva2/server/go/operators/crossover/CM7.java b/src/eva2/server/go/operators/crossover/CM7.java index 69a547ca..266ee99f 100644 --- a/src/eva2/server/go/operators/crossover/CM7.java +++ b/src/eva2/server/go/operators/crossover/CM7.java @@ -27,10 +27,12 @@ public class CM7 implements InterfaceCrossover, java.io.Serializable, InterfaceE this.evaluations = c.evaluations; } + @Override public Object clone(){ return new CM7(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -71,15 +73,18 @@ public class CM7 implements InterfaceCrossover, java.io.Serializable, InterfaceE return result; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return getName(); } + @Override public int getEvaluations(){ return this.evaluations; } @@ -97,6 +102,7 @@ public class CM7 implements InterfaceCrossover, java.io.Serializable, InterfaceE return ""; } + @Override public void resetEvaluations() { this.evaluations = 0; } diff --git a/src/eva2/server/go/operators/crossover/CrossoverEAMixer.java b/src/eva2/server/go/operators/crossover/CrossoverEAMixer.java index b7180c4c..2e567bdf 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverEAMixer.java +++ b/src/eva2/server/go/operators/crossover/CrossoverEAMixer.java @@ -73,6 +73,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverEAMixer(this); } @@ -81,6 +82,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof CrossoverEAMixer) { CrossoverEAMixer mut = (CrossoverEAMixer)mutator; @@ -93,6 +95,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ InterfaceCrossover[] crossers = this.m_Crossers.getSelectedCrossers(); for (int i = 0; i < crossers.length; i++) crossers[i].init(individual, opt); @@ -103,6 +106,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { this.m_Crossers.normalizeWeights(); double[] probs = this.m_Crossers.getWeights(); @@ -151,6 +155,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "EA mutation mixer"; } @@ -226,6 +231,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating return "Set the value for tau1."; } + @Override public int getEvaluations() { int numEvals=0; InterfaceCrossover[] crossers = this.m_Crossers.getSelectedCrossers(); @@ -237,6 +243,7 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating return numEvals; } + @Override public void resetEvaluations() { InterfaceCrossover[] crossers = this.m_Crossers.getSelectedCrossers(); for (int i = 0; i < crossers.length; i++) { diff --git a/src/eva2/server/go/operators/crossover/CrossoverESArithmetical.java b/src/eva2/server/go/operators/crossover/CrossoverESArithmetical.java index 5a6858c5..fff64f7f 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESArithmetical.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESArithmetical.java @@ -31,6 +31,7 @@ public class CrossoverESArithmetical implements InterfaceCrossover, java.io.Seri /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESArithmetical(this); } @@ -39,6 +40,7 @@ public class CrossoverESArithmetical implements InterfaceCrossover, java.io.Seri * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -90,6 +92,7 @@ public class CrossoverESArithmetical implements InterfaceCrossover, java.io.Seri * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESArithmetical) return true; else return false; @@ -102,10 +105,12 @@ public class CrossoverESArithmetical implements InterfaceCrossover, java.io.Seri * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESBLXAlpha.java b/src/eva2/server/go/operators/crossover/CrossoverESBLXAlpha.java index 213fa631..898fa04e 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESBLXAlpha.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESBLXAlpha.java @@ -28,6 +28,7 @@ public class CrossoverESBLXAlpha implements InterfaceCrossover, java.io.Serializ /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESBLXAlpha(this); } @@ -37,6 +38,7 @@ public class CrossoverESBLXAlpha implements InterfaceCrossover, java.io.Serializ * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -87,6 +89,7 @@ public class CrossoverESBLXAlpha implements InterfaceCrossover, java.io.Serializ * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESBLXAlpha) { CrossoverESBLXAlpha cross = (CrossoverESBLXAlpha)crossover; @@ -103,10 +106,12 @@ public class CrossoverESBLXAlpha implements InterfaceCrossover, java.io.Serializ * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESDefault.java b/src/eva2/server/go/operators/crossover/CrossoverESDefault.java index 055efc7a..84681474 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESDefault.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESDefault.java @@ -26,6 +26,7 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESDefault(this); } @@ -36,6 +37,7 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -88,6 +90,7 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESDefault) return true; else return false; @@ -100,10 +103,12 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESFlat.java b/src/eva2/server/go/operators/crossover/CrossoverESFlat.java index da577c6c..79f9d307 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESFlat.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESFlat.java @@ -33,6 +33,7 @@ public class CrossoverESFlat implements InterfaceCrossover, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESFlat(this); } @@ -42,6 +43,7 @@ public class CrossoverESFlat implements InterfaceCrossover, java.io.Serializable * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -91,6 +93,7 @@ public class CrossoverESFlat implements InterfaceCrossover, java.io.Serializable * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESFlat) return true; else return false; @@ -103,10 +106,12 @@ public class CrossoverESFlat implements InterfaceCrossover, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESIntermediate.java b/src/eva2/server/go/operators/crossover/CrossoverESIntermediate.java index e25d1dc1..068b9f88 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESIntermediate.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESIntermediate.java @@ -24,6 +24,7 @@ public class CrossoverESIntermediate implements InterfaceCrossover, java.io.Seri /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESIntermediate(this); } @@ -33,6 +34,7 @@ public class CrossoverESIntermediate implements InterfaceCrossover, java.io.Seri * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -74,6 +76,7 @@ public class CrossoverESIntermediate implements InterfaceCrossover, java.io.Seri * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESIntermediate) return true; else return false; @@ -86,10 +89,12 @@ public class CrossoverESIntermediate implements InterfaceCrossover, java.io.Seri * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscrete.java b/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscrete.java index f455ca06..b8be6a4f 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscrete.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscrete.java @@ -28,6 +28,7 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se /** This method will enable you to clone a given crossover operator * @return The clone */ + @Override public Object clone() { return new CrossoverESNPointDiscrete(this); } @@ -37,6 +38,7 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -86,6 +88,7 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESNPointDiscrete) { CrossoverESNPointDiscrete cross = (CrossoverESNPointDiscrete)crossover; @@ -102,10 +105,12 @@ public class CrossoverESNPointDiscrete implements InterfaceCrossover, java.io.Se * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscreteDislocation.java b/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscreteDislocation.java index efbed06f..8619df89 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscreteDislocation.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESNPointDiscreteDislocation.java @@ -28,6 +28,7 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover, /** This method will enable you to clone a given crossover operator * @return The clone */ + @Override public Object clone() { return new CrossoverESNPointDiscreteDislocation(this); } @@ -37,6 +38,7 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover, * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -99,6 +101,7 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover, * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESNPointDiscreteDislocation) { CrossoverESNPointDiscreteDislocation cross = (CrossoverESNPointDiscreteDislocation)crossover; @@ -114,10 +117,12 @@ public class CrossoverESNPointDiscreteDislocation implements InterfaceCrossover, * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESPCX.java b/src/eva2/server/go/operators/crossover/CrossoverESPCX.java index 69e02256..89e6edca 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESPCX.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESPCX.java @@ -37,6 +37,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESPCX(this); } @@ -46,6 +47,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -175,6 +177,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESUNDX) return true; else return false; @@ -187,6 +190,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } @@ -271,6 +275,7 @@ public class CrossoverESPCX implements InterfaceCrossover, java.io.Serializable } } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESSBX.java b/src/eva2/server/go/operators/crossover/CrossoverESSBX.java index 92b33827..53c91559 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESSBX.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESSBX.java @@ -36,6 +36,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESSBX(this); } @@ -45,6 +46,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -90,6 +92,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESSBX) { CrossoverESSBX cross = (CrossoverESSBX)crossover; @@ -106,6 +109,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } @@ -175,6 +179,7 @@ public class CrossoverESSBX implements InterfaceCrossover, java.io.Serializable } } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESSPX.java b/src/eva2/server/go/operators/crossover/CrossoverESSPX.java index c1165d41..9b0208f7 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESSPX.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESSPX.java @@ -32,6 +32,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESSPX(this); } @@ -41,6 +42,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -101,6 +103,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESSPX) return true; else return false; @@ -113,6 +116,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } @@ -196,6 +200,7 @@ public class CrossoverESSPX implements InterfaceCrossover, java.io.Serializable } } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESUNDX.java b/src/eva2/server/go/operators/crossover/CrossoverESUNDX.java index 61f31231..1fee0401 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESUNDX.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESUNDX.java @@ -53,6 +53,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverESUNDX(this); } @@ -62,6 +63,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -180,6 +182,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESUNDX) return true; else return false; @@ -192,6 +195,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } @@ -276,6 +280,7 @@ public class CrossoverESUNDX implements InterfaceCrossover, java.io.Serializable } } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverESUniformDiscrete.java b/src/eva2/server/go/operators/crossover/CrossoverESUniformDiscrete.java index 3ef07f4d..0150e972 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverESUniformDiscrete.java +++ b/src/eva2/server/go/operators/crossover/CrossoverESUniformDiscrete.java @@ -26,6 +26,7 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S /** This method will enable you to clone a given crossover operator * @return The clone */ + @Override public Object clone() { return new CrossoverESUniformDiscrete(this); } @@ -35,6 +36,7 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; double[][] parents, children; @@ -80,6 +82,7 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESUniformDiscrete) return true; else return false; @@ -92,10 +95,12 @@ public class CrossoverESUniformDiscrete implements InterfaceCrossover, java.io.S * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGABitSimulated.java b/src/eva2/server/go/operators/crossover/CrossoverGABitSimulated.java index 96a36445..00c63685 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGABitSimulated.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGABitSimulated.java @@ -28,6 +28,7 @@ public class CrossoverGABitSimulated implements InterfaceCrossover, java.io.Seri /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverGABitSimulated(this); } @@ -37,6 +38,7 @@ public class CrossoverGABitSimulated implements InterfaceCrossover, java.io.Seri * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -81,6 +83,7 @@ public class CrossoverGABitSimulated implements InterfaceCrossover, java.io.Seri * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGABitSimulated) return true; else return false; @@ -93,10 +96,12 @@ public class CrossoverGABitSimulated implements InterfaceCrossover, java.io.Seri * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGADefault.java b/src/eva2/server/go/operators/crossover/CrossoverGADefault.java index b05286fd..0bdc0c4c 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGADefault.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGADefault.java @@ -32,6 +32,7 @@ public class CrossoverGADefault implements InterfaceCrossover, * * @return The clone */ + @Override public Object clone() { return new CrossoverGADefault(this); } @@ -45,6 +46,7 @@ public class CrossoverGADefault implements InterfaceCrossover, * @param partners * The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; @@ -97,6 +99,7 @@ public class CrossoverGADefault implements InterfaceCrossover, * @param crossover * The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGADefault) return true; @@ -114,11 +117,13 @@ public class CrossoverGADefault implements InterfaceCrossover, * @param opt * The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGAGINPoint.java b/src/eva2/server/go/operators/crossover/CrossoverGAGINPoint.java index 6c560aae..a9e0123b 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGAGINPoint.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGAGINPoint.java @@ -41,6 +41,7 @@ public class CrossoverGAGINPoint implements InterfaceCrossover, java.io.Serializ /** This method will enable you to clone a given crossover operator * @return The clone */ + @Override public Object clone() { return new CrossoverGAGINPoint(this); } @@ -55,6 +56,7 @@ public class CrossoverGAGINPoint implements InterfaceCrossover, java.io.Serializ return genotype; } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual individual, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -209,6 +211,7 @@ public class CrossoverGAGINPoint implements InterfaceCrossover, java.io.Serializ * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGAGINPoint) { CrossoverGAGINPoint cross = (CrossoverGAGINPoint)crossover; @@ -224,10 +227,12 @@ public class CrossoverGAGINPoint implements InterfaceCrossover, java.io.Serializ * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { // this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGAGINPointSegmentwise.java b/src/eva2/server/go/operators/crossover/CrossoverGAGINPointSegmentwise.java index 6245c003..c127481f 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGAGINPointSegmentwise.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGAGINPointSegmentwise.java @@ -27,6 +27,7 @@ public class CrossoverGAGINPointSegmentwise extends CrossoverGAGINPoint { setSegmentLength(segmentLen); } + @Override public Object clone() { return new CrossoverGAGINPointSegmentwise(this); } @@ -49,6 +50,7 @@ public class CrossoverGAGINPointSegmentwise extends CrossoverGAGINPoint { return cPoints; } + @Override public String getName() { return "GA-GI N-Point segment-wise crossover"; } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGAUniform.java b/src/eva2/server/go/operators/crossover/CrossoverGAUniform.java index ad011669..bd67e354 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGAUniform.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGAUniform.java @@ -28,6 +28,7 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverGAUniform(this); } @@ -37,6 +38,7 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -79,6 +81,7 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGAUniform) return true; else return false; @@ -91,10 +94,12 @@ public class CrossoverGAUniform implements InterfaceCrossover, java.io.Serializa * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGIDefault.java b/src/eva2/server/go/operators/crossover/CrossoverGIDefault.java index 1b958f3f..6469702b 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGIDefault.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGIDefault.java @@ -27,6 +27,7 @@ public class CrossoverGIDefault implements InterfaceCrossover, java.io.Serializa /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverGIDefault(this); } @@ -36,6 +37,7 @@ public class CrossoverGIDefault implements InterfaceCrossover, java.io.Serializa * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; int[][] parents, children; @@ -87,6 +89,7 @@ public class CrossoverGIDefault implements InterfaceCrossover, java.io.Serializa * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverESDefault) return true; else return false; @@ -99,10 +102,12 @@ public class CrossoverGIDefault implements InterfaceCrossover, java.io.Serializa * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGINPoint.java b/src/eva2/server/go/operators/crossover/CrossoverGINPoint.java index 2a8b344a..43e520bd 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGINPoint.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGINPoint.java @@ -28,6 +28,7 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab /** This method will enable you to clone a given crossover operator * @return The clone */ + @Override public Object clone() { return new CrossoverGINPoint(this); } @@ -37,6 +38,7 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -89,6 +91,7 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGINPoint) { CrossoverGINPoint cross = (CrossoverGINPoint)crossover; @@ -104,10 +107,12 @@ public class CrossoverGINPoint implements InterfaceCrossover, java.io.Serializab * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGINPointVL.java b/src/eva2/server/go/operators/crossover/CrossoverGINPointVL.java index 18e78e5a..37e35071 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGINPointVL.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGINPointVL.java @@ -29,6 +29,7 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ /** This method will enable you to clone a given crossover operator * @return The clone */ + @Override public Object clone() { return new CrossoverGINPointVL(this); } @@ -38,6 +39,7 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -145,6 +147,7 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGINPointVL) { CrossoverGINPointVL cross = (CrossoverGINPointVL)crossover; @@ -160,10 +163,12 @@ public class CrossoverGINPointVL implements InterfaceCrossover, java.io.Serializ * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGIUniform.java b/src/eva2/server/go/operators/crossover/CrossoverGIUniform.java index c4b60ead..a7480e4c 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGIUniform.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGIUniform.java @@ -29,6 +29,7 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverGIUniform(this); } @@ -38,6 +39,7 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -83,6 +85,7 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGIUniform) return true; else return false; @@ -95,10 +98,12 @@ public class CrossoverGIUniform implements InterfaceCrossover, java.io.Serializa * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverGPDefault.java b/src/eva2/server/go/operators/crossover/CrossoverGPDefault.java index 710e3242..ed76aebc 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverGPDefault.java +++ b/src/eva2/server/go/operators/crossover/CrossoverGPDefault.java @@ -36,6 +36,7 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverGPDefault(this); } @@ -46,6 +47,7 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa * @param indy1 The first individual * @param partners The second individual */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { if (partners.size()>1) System.err.println("Warning, crossover may not work on more than one partner! " + this.getClass()); AbstractEAIndividual[] result = null; @@ -108,6 +110,7 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverGPDefault) return true; else return false; @@ -120,10 +123,12 @@ public class CrossoverGPDefault implements InterfaceCrossover, java.io.Serializa * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverOBGAPMX.java b/src/eva2/server/go/operators/crossover/CrossoverOBGAPMX.java index cc602697..b2f9d898 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverOBGAPMX.java +++ b/src/eva2/server/go/operators/crossover/CrossoverOBGAPMX.java @@ -27,10 +27,12 @@ public class CrossoverOBGAPMX implements InterfaceCrossover, java.io.Serializabl /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverOBGAPMX(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size()+1]; @@ -81,15 +83,18 @@ public class CrossoverOBGAPMX implements InterfaceCrossover, java.io.Serializabl * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverOBGAPMX) return true; else return false; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { // nothing to init! } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/CrossoverOBGAPMXUniform.java b/src/eva2/server/go/operators/crossover/CrossoverOBGAPMXUniform.java index 8795e08d..93c9beda 100644 --- a/src/eva2/server/go/operators/crossover/CrossoverOBGAPMXUniform.java +++ b/src/eva2/server/go/operators/crossover/CrossoverOBGAPMXUniform.java @@ -26,10 +26,12 @@ public class CrossoverOBGAPMXUniform implements InterfaceCrossover, java.io.Seri /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new CrossoverOBGAPMXUniform(this); } + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; result = new AbstractEAIndividual[partners.size() + 1]; @@ -76,16 +78,19 @@ public class CrossoverOBGAPMXUniform implements InterfaceCrossover, java.io.Seri * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof CrossoverOBGAPMXUniform) return true; else return false; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { // nothing to init! } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/InterfaceCrossover.java b/src/eva2/server/go/operators/crossover/InterfaceCrossover.java index bf311be5..9851816d 100644 --- a/src/eva2/server/go/operators/crossover/InterfaceCrossover.java +++ b/src/eva2/server/go/operators/crossover/InterfaceCrossover.java @@ -45,5 +45,6 @@ public interface InterfaceCrossover { * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover); } diff --git a/src/eva2/server/go/operators/crossover/NoCrossover.java b/src/eva2/server/go/operators/crossover/NoCrossover.java index a844d148..4a0336e9 100644 --- a/src/eva2/server/go/operators/crossover/NoCrossover.java +++ b/src/eva2/server/go/operators/crossover/NoCrossover.java @@ -25,6 +25,7 @@ public class NoCrossover implements InterfaceCrossover, java.io.Serializable { /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new NoCrossover(); } @@ -34,6 +35,7 @@ public class NoCrossover implements InterfaceCrossover, java.io.Serializable { * @param indy1 The first individual * @param partners The partner individuals */ + @Override public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) { AbstractEAIndividual[] result = null; //result = new AbstractEAIndividual[2]; /// by MK @@ -51,6 +53,7 @@ public class NoCrossover implements InterfaceCrossover, java.io.Serializable { * are actually the same. * @param crossover The other crossover operator */ + @Override public boolean equals(Object crossover) { if (crossover instanceof NoCrossover) return true; else return false; @@ -63,10 +66,12 @@ public class NoCrossover implements InterfaceCrossover, java.io.Serializable { * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { this.m_OptimizationProblem = opt; } + @Override public String getStringRepresentation() { return this.getName(); } diff --git a/src/eva2/server/go/operators/crossover/PropertyCrossoverMixer.java b/src/eva2/server/go/operators/crossover/PropertyCrossoverMixer.java index ffb981dd..305494a8 100644 --- a/src/eva2/server/go/operators/crossover/PropertyCrossoverMixer.java +++ b/src/eva2/server/go/operators/crossover/PropertyCrossoverMixer.java @@ -41,6 +41,7 @@ public class PropertyCrossoverMixer implements java.io.Serializable { } } + @Override public Object clone() { return (Object) new PropertyCrossoverMixer(this); } diff --git a/src/eva2/server/go/operators/crossover/PropertyCrossoverMixerEditor.java b/src/eva2/server/go/operators/crossover/PropertyCrossoverMixerEditor.java index d1a00220..e9a36c10 100644 --- a/src/eva2/server/go/operators/crossover/PropertyCrossoverMixerEditor.java +++ b/src/eva2/server/go/operators/crossover/PropertyCrossoverMixerEditor.java @@ -221,6 +221,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** This action listener,... */ ActionListener updateTargets = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateTargetList(); } @@ -229,6 +230,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** This action listener,... */ ActionListener addTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_CrossoversWithWeights.addCrossers((InterfaceCrossover)m_CrossoversWithWeights.getAvailableCrossers()[0].clone()); int l = m_CrossoversWithWeights.getSelectedCrossers().length; @@ -261,6 +263,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** This action listener,... */ ActionListener deleteTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { int l = m_CrossoversWithWeights.getSelectedCrossers().length, j = 0; GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1]; @@ -279,6 +282,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** This action listener,... */ ActionListener normalizeWeights = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_CrossoversWithWeights.normalizeWeights(); updateTargetList(); @@ -288,11 +292,14 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[] newW = m_CrossoversWithWeights.getWeights(); @@ -325,6 +332,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyCrossoverMixer) { this.m_CrossoversWithWeights= (PropertyCrossoverMixer) o; @@ -335,10 +343,12 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_CrossoversWithWeights; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -346,6 +356,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** * */ + @Override public String getAsText() { return null; } @@ -353,6 +364,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -360,6 +372,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** * */ + @Override public String[] getTags() { return null; } @@ -381,6 +394,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -390,6 +404,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -400,6 +415,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -407,6 +423,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_Component == null) { this.initCustomEditor(); @@ -425,11 +442,13 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit /********************************* java.beans.PropertyChangeListener *************************/ + @Override public void addPropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { if (m_Support == null) m_Support = new PropertyChangeSupport(this); m_Support.removePropertyChangeListener(l); @@ -438,6 +457,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit * editing an object. * @param evt */ + @Override public void propertyChange(PropertyChangeEvent evt) { Object newVal = evt.getNewValue(); Object oldVal = evt.getOldValue(); diff --git a/src/eva2/server/go/operators/crossover/TestESCrossover.java b/src/eva2/server/go/operators/crossover/TestESCrossover.java index 76816478..371a5f54 100644 --- a/src/eva2/server/go/operators/crossover/TestESCrossover.java +++ b/src/eva2/server/go/operators/crossover/TestESCrossover.java @@ -53,6 +53,7 @@ public class TestESCrossover implements java.io.Serializable { this.m_Frame.setSize(300, 400); this.m_Frame.setLocation(530, 50); this.m_Frame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.exit(0); } @@ -94,6 +95,7 @@ public class TestESCrossover implements java.io.Serializable { } ActionListener initListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Partners = new Population(); m_Partners.setTargetSize(m_NumberOfPartners); @@ -132,6 +134,7 @@ public class TestESCrossover implements java.io.Serializable { }; ActionListener init2Listener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Partners = new Population(); m_Partners.setTargetSize(2); @@ -175,6 +178,7 @@ public class TestESCrossover implements java.io.Serializable { }; ActionListener init3Listener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_Partners = new Population(); m_Partners.setTargetSize(3); @@ -224,6 +228,7 @@ public class TestESCrossover implements java.io.Serializable { }; ActionListener XListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { double[] x; AbstractEAIndividual[] result; diff --git a/src/eva2/server/go/operators/distancemetric/DoubleIntegralMetric.java b/src/eva2/server/go/operators/distancemetric/DoubleIntegralMetric.java index 52fa6795..87f0ab0d 100644 --- a/src/eva2/server/go/operators/distancemetric/DoubleIntegralMetric.java +++ b/src/eva2/server/go/operators/distancemetric/DoubleIntegralMetric.java @@ -26,10 +26,12 @@ public class DoubleIntegralMetric implements InterfaceDistanceMetric, Serializab oneNormed = normed; } + @Override public Object clone() { return new DoubleIntegralMetric(oneNormed); } + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { double[] dIndy1=null, dIndy2=null; // String indyDataKey = ParticleSwarmOptimization.partBestPosKey; diff --git a/src/eva2/server/go/operators/distancemetric/EuclideanMetric.java b/src/eva2/server/go/operators/distancemetric/EuclideanMetric.java index 45192d1e..3c5d6637 100644 --- a/src/eva2/server/go/operators/distancemetric/EuclideanMetric.java +++ b/src/eva2/server/go/operators/distancemetric/EuclideanMetric.java @@ -16,6 +16,7 @@ import eva2.server.go.individuals.InterfaceDataTypeDouble; public class EuclideanMetric implements InterfaceDistanceMetric, Serializable { private boolean normedByDblRange = false; + @Override public Object clone() { return (Object) new EuclideanMetric(this); } @@ -31,6 +32,7 @@ public class EuclideanMetric implements InterfaceDistanceMetric, Serializable { setNormedByDblRange(normed); } + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { double[] dIndy1, dIndy2; double result = 0; diff --git a/src/eva2/server/go/operators/distancemetric/GenotypeMetricBitSet.java b/src/eva2/server/go/operators/distancemetric/GenotypeMetricBitSet.java index 2ac82f24..940f96f6 100644 --- a/src/eva2/server/go/operators/distancemetric/GenotypeMetricBitSet.java +++ b/src/eva2/server/go/operators/distancemetric/GenotypeMetricBitSet.java @@ -20,6 +20,7 @@ public class GenotypeMetricBitSet implements InterfaceDistanceMetric, java.io.Se public GenotypeMetricBitSet(GenotypeMetricBitSet a) { } + @Override public Object clone() { return (Object) new GenotypeMetricBitSet(this); } @@ -31,6 +32,7 @@ public class GenotypeMetricBitSet implements InterfaceDistanceMetric, java.io.Se * @param indy2 The second individual. * @return double */ + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { return GenotypeMetricBitSet.dist(indy1, indy2); } diff --git a/src/eva2/server/go/operators/distancemetric/IndividualDataMetric.java b/src/eva2/server/go/operators/distancemetric/IndividualDataMetric.java index 2e8f6879..0caccb1c 100644 --- a/src/eva2/server/go/operators/distancemetric/IndividualDataMetric.java +++ b/src/eva2/server/go/operators/distancemetric/IndividualDataMetric.java @@ -41,10 +41,12 @@ public class IndividualDataMetric implements InterfaceDistanceMetric, Serializab * the object * @return the deep clone */ + @Override public Object clone() { return new IndividualDataMetric(this); } + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { if (dataKey==null) throw new RuntimeException("Error, no data key defined in " + this.getClass().getName() + "::distance()"); else { diff --git a/src/eva2/server/go/operators/distancemetric/ObjectiveSpaceMetric.java b/src/eva2/server/go/operators/distancemetric/ObjectiveSpaceMetric.java index 4c099171..4c24fe39 100644 --- a/src/eva2/server/go/operators/distancemetric/ObjectiveSpaceMetric.java +++ b/src/eva2/server/go/operators/distancemetric/ObjectiveSpaceMetric.java @@ -18,6 +18,7 @@ public class ObjectiveSpaceMetric implements InterfaceDistanceMetric, java.io.Se public ObjectiveSpaceMetric(ObjectiveSpaceMetric a) { } + @Override public Object clone() { return (Object) new ObjectiveSpaceMetric(this); } @@ -29,6 +30,7 @@ public class ObjectiveSpaceMetric implements InterfaceDistanceMetric, java.io.Se * @param indy2 The second individual. * @return double */ + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { double[] dIndy1, dIndy2; double result = 0; diff --git a/src/eva2/server/go/operators/distancemetric/PhenotypeMetric.java b/src/eva2/server/go/operators/distancemetric/PhenotypeMetric.java index 91860070..75204958 100644 --- a/src/eva2/server/go/operators/distancemetric/PhenotypeMetric.java +++ b/src/eva2/server/go/operators/distancemetric/PhenotypeMetric.java @@ -29,6 +29,7 @@ public class PhenotypeMetric implements InterfaceDistanceMetric, java.io.Seriali public PhenotypeMetric(PhenotypeMetric a) { } + @Override public Object clone() { return (Object) new PhenotypeMetric(this); } @@ -86,6 +87,7 @@ public class PhenotypeMetric implements InterfaceDistanceMetric, java.io.Seriali * @param indy2 The second individual. * @return double */ + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { double result = 0; // results are added up because individuals can implement several data types! diff --git a/src/eva2/server/go/operators/distancemetric/SigmaSingleMetricGlobalMutation.java b/src/eva2/server/go/operators/distancemetric/SigmaSingleMetricGlobalMutation.java index eabf9f05..3d7acb44 100644 --- a/src/eva2/server/go/operators/distancemetric/SigmaSingleMetricGlobalMutation.java +++ b/src/eva2/server/go/operators/distancemetric/SigmaSingleMetricGlobalMutation.java @@ -23,6 +23,7 @@ public class SigmaSingleMetricGlobalMutation implements InterfaceDistanceMetric, public SigmaSingleMetricGlobalMutation(SigmaSingleMetricGlobalMutation a) { } + @Override public Object clone() { return (Object) new SigmaSingleMetricGlobalMutation(this); } @@ -34,6 +35,7 @@ public class SigmaSingleMetricGlobalMutation implements InterfaceDistanceMetric, * @param indy2 The second individual. * @return double */ + @Override public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2) { double[] dIndy1, dIndy2; double[][] range1, range2; diff --git a/src/eva2/server/go/operators/fitnessmodifier/FitnessAdaptiveClustering.java b/src/eva2/server/go/operators/fitnessmodifier/FitnessAdaptiveClustering.java index 4ab48dea..5367eaae 100644 --- a/src/eva2/server/go/operators/fitnessmodifier/FitnessAdaptiveClustering.java +++ b/src/eva2/server/go/operators/fitnessmodifier/FitnessAdaptiveClustering.java @@ -22,6 +22,7 @@ public class FitnessAdaptiveClustering implements java.io.Serializable, Interfac * your problem to store the unaltered fitness somewhere else so that * you may still fetch it! */ + @Override public void modifyFitness(Population population) { // prepare the calculation double[][] data = new double[population.size()][]; diff --git a/src/eva2/server/go/operators/fitnessmodifier/FitnessModifierNone.java b/src/eva2/server/go/operators/fitnessmodifier/FitnessModifierNone.java index 53b1407a..30609e38 100644 --- a/src/eva2/server/go/operators/fitnessmodifier/FitnessModifierNone.java +++ b/src/eva2/server/go/operators/fitnessmodifier/FitnessModifierNone.java @@ -17,6 +17,7 @@ public class FitnessModifierNone implements java.io.Serializable, InterfaceFitne * your problem to store the unaltered fitness somewhere else so that * you may still fetch it! */ + @Override public void modifyFitness(Population population) { // as the name might suggest this guy is pretty lazy } diff --git a/src/eva2/server/go/operators/fitnessmodifier/FitnessSharing.java b/src/eva2/server/go/operators/fitnessmodifier/FitnessSharing.java index 3027d1c0..89f250f5 100644 --- a/src/eva2/server/go/operators/fitnessmodifier/FitnessSharing.java +++ b/src/eva2/server/go/operators/fitnessmodifier/FitnessSharing.java @@ -23,6 +23,7 @@ public class FitnessSharing implements java.io.Serializable, InterfaceFitnessMod * your problem to store the unaltered fitness somewhere else so that * you may still fetch it! */ + @Override public void modifyFitness(Population population) { // prepare the calculation double[][] data = new double[population.size()][]; diff --git a/src/eva2/server/go/operators/initialization/DefaultInitialization.java b/src/eva2/server/go/operators/initialization/DefaultInitialization.java index a05dad5c..200e1466 100644 --- a/src/eva2/server/go/operators/initialization/DefaultInitialization.java +++ b/src/eva2/server/go/operators/initialization/DefaultInitialization.java @@ -14,10 +14,12 @@ public class DefaultInitialization implements InterfaceInitialization, java.io.S public DefaultInitialization() {} + @Override public void initialize(AbstractEAIndividual indy, InterfaceOptimizationProblem problem) { indy.defaultInit(problem); } + @Override public InterfaceInitialization clone() { return new DefaultInitialization(); } diff --git a/src/eva2/server/go/operators/initialization/GAGIInitializeSegmentwise.java b/src/eva2/server/go/operators/initialization/GAGIInitializeSegmentwise.java index 4a5c9301..a9f0a8f7 100644 --- a/src/eva2/server/go/operators/initialization/GAGIInitializeSegmentwise.java +++ b/src/eva2/server/go/operators/initialization/GAGIInitializeSegmentwise.java @@ -90,6 +90,7 @@ public class GAGIInitializeSegmentwise implements InterfaceInitialization, java. this.disturbanceDegree = disturbRatio; } + @Override public InterfaceInitialization clone() { return new GAGIInitializeSegmentwise(this); } @@ -102,6 +103,7 @@ public class GAGIInitializeSegmentwise implements InterfaceInitialization, java. // System.out.println(indy.getStringRepresentation()); // } + @Override public void initialize(AbstractEAIndividual indy, InterfaceOptimizationProblem problem) { if (indy instanceof InterfaceGAIndividual || indy instanceof InterfaceGIIndividual) { diff --git a/src/eva2/server/go/operators/migration/MOBestMigration.java b/src/eva2/server/go/operators/migration/MOBestMigration.java index ae7ab27a..09b640d3 100644 --- a/src/eva2/server/go/operators/migration/MOBestMigration.java +++ b/src/eva2/server/go/operators/migration/MOBestMigration.java @@ -21,6 +21,7 @@ public class MOBestMigration implements InterfaceMigration, java.io.Serializable /** The ever present clone method */ + @Override public Object clone() { return new MOBestMigration(); } @@ -28,6 +29,7 @@ public class MOBestMigration implements InterfaceMigration, java.io.Serializable /** Typically i'll need some initialization method for * every bit of code i write.... */ + @Override public void initMigration(InterfaceOptimizer[] islands) { // pff at a later stage i could initialize a topology here } @@ -42,6 +44,7 @@ public class MOBestMigration implements InterfaceMigration, java.io.Serializable * you call getPopulation() on an island it is not a reference * to the population but a serialized copy of the population!! */ + @Override public void migrate(InterfaceOptimizer[] islands) { Population[] oldIPOP = new Population[islands.length]; Population[] newIPOP = new Population[islands.length]; diff --git a/src/eva2/server/go/operators/migration/MOClusteringSeparation.java b/src/eva2/server/go/operators/migration/MOClusteringSeparation.java index 6ed687b5..1316a4a3 100644 --- a/src/eva2/server/go/operators/migration/MOClusteringSeparation.java +++ b/src/eva2/server/go/operators/migration/MOClusteringSeparation.java @@ -57,6 +57,7 @@ public class MOClusteringSeparation implements InterfaceMigration, java.io.Seria /** The ever present clone method */ + @Override public Object clone() { return new MOClusteringSeparation(this); } @@ -64,6 +65,7 @@ public class MOClusteringSeparation implements InterfaceMigration, java.io.Seria /** Typically i'll need some initialization method for * every bit of code i write.... */ + @Override public void initMigration(InterfaceOptimizer[] islands) { // pff at a later stage i could initialize a topology here if (this.m_ReuseC) this.m_KMeans.resetC(); @@ -79,6 +81,7 @@ public class MOClusteringSeparation implements InterfaceMigration, java.io.Seria * you call getPopulation() on an island it is not a reference * to the population but a serialized copy of the population!! */ + @Override public void migrate(InterfaceOptimizer[] islands) { Population[] oldIPOP = new Population[islands.length]; Population[] newIPOP = new Population[islands.length]; diff --git a/src/eva2/server/go/operators/migration/MOConeSeparation.java b/src/eva2/server/go/operators/migration/MOConeSeparation.java index 37b9bbc4..207e5f24 100644 --- a/src/eva2/server/go/operators/migration/MOConeSeparation.java +++ b/src/eva2/server/go/operators/migration/MOConeSeparation.java @@ -53,6 +53,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl /** The ever present clone method */ + @Override public Object clone() { return new MOConeSeparation(this); } @@ -60,6 +61,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl /** Typically i'll need some initialization method for * every bit of code i write.... */ + @Override public void initMigration(InterfaceOptimizer[] islands) { // pff at a later stage i could initialize a topology here } @@ -74,6 +76,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl * you call getPopulation() on an island it is not a reference * to the population but a serialized copy of the population!! */ + @Override public void migrate(InterfaceOptimizer[] islands) { Population[] oldIPOP = new Population[islands.length]; Population[] newIPOP = new Population[islands.length]; diff --git a/src/eva2/server/go/operators/migration/MOXMeansSeparation.java b/src/eva2/server/go/operators/migration/MOXMeansSeparation.java index 4217c62a..dd1398f9 100644 --- a/src/eva2/server/go/operators/migration/MOXMeansSeparation.java +++ b/src/eva2/server/go/operators/migration/MOXMeansSeparation.java @@ -58,6 +58,7 @@ public class MOXMeansSeparation implements InterfaceMigration, java.io.Serializa /** The ever present clone method */ + @Override public Object clone() { return new MOXMeansSeparation(this); } @@ -65,6 +66,7 @@ public class MOXMeansSeparation implements InterfaceMigration, java.io.Serializa /** Typically i'll need some initialization method for * every bit of code i write.... */ + @Override public void initMigration(InterfaceOptimizer[] islands) { // pff at a later stage i could initialize a topology here } @@ -79,6 +81,7 @@ public class MOXMeansSeparation implements InterfaceMigration, java.io.Serializa * you call getPopulation() on an island it is not a reference * to the population but a serialized copy of the population!! */ + @Override public void migrate(InterfaceOptimizer[] islands) { Population[] oldIPOP = new Population[islands.length]; Population[] newIPOP = new Population[islands.length]; diff --git a/src/eva2/server/go/operators/migration/SOBestMigration.java b/src/eva2/server/go/operators/migration/SOBestMigration.java index b19abde5..8098f5cc 100644 --- a/src/eva2/server/go/operators/migration/SOBestMigration.java +++ b/src/eva2/server/go/operators/migration/SOBestMigration.java @@ -19,6 +19,7 @@ public class SOBestMigration implements InterfaceMigration, java.io.Serializable private int m_N = 5; /** The ever present clone method */ + @Override public Object clone() { return new SOBestMigration(); } @@ -26,6 +27,7 @@ public class SOBestMigration implements InterfaceMigration, java.io.Serializable /** Typically i'll need some initialization method for * every bit of code i write.... */ + @Override public void initMigration(InterfaceOptimizer[] islands) { // pff at a later stage i could initialize a topology here } @@ -40,6 +42,7 @@ public class SOBestMigration implements InterfaceMigration, java.io.Serializable * you call getPopulation() on an island it is not a reference * to the population but a serialized copy of the population!! */ + @Override public void migrate(InterfaceOptimizer[] islands) { Population[] oldIPOP = new Population[islands.length]; Population[] newIPOP = new Population[islands.length]; diff --git a/src/eva2/server/go/operators/migration/SOMONoMigration.java b/src/eva2/server/go/operators/migration/SOMONoMigration.java index f6332452..30eaa046 100644 --- a/src/eva2/server/go/operators/migration/SOMONoMigration.java +++ b/src/eva2/server/go/operators/migration/SOMONoMigration.java @@ -16,6 +16,7 @@ public class SOMONoMigration implements InterfaceMigration, java.io.Serializable /** The ever present clone method */ + @Override public Object clone() { return new SOMONoMigration(); } @@ -23,6 +24,7 @@ public class SOMONoMigration implements InterfaceMigration, java.io.Serializable /** Typically i'll need some initialization method for * every bit of code i write.... */ + @Override public void initMigration(InterfaceOptimizer[] islands) { } @@ -37,6 +39,7 @@ public class SOMONoMigration implements InterfaceMigration, java.io.Serializable * you call getPopulation() on an island it is not a reference * to the population but a serialized copy of the population!! */ + @Override public void migrate(InterfaceOptimizer[] islands) { } diff --git a/src/eva2/server/go/operators/moso/MOSODynamicallyWeightedFitness.java b/src/eva2/server/go/operators/moso/MOSODynamicallyWeightedFitness.java index d3a563a2..973ecef9 100644 --- a/src/eva2/server/go/operators/moso/MOSODynamicallyWeightedFitness.java +++ b/src/eva2/server/go/operators/moso/MOSODynamicallyWeightedFitness.java @@ -23,6 +23,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j this.m_F = b.m_F; this.m_OutputDimension = b.m_OutputDimension; } + @Override public Object clone() { return (Object) new MOSODynamicallyWeightedFitness(this); } @@ -34,6 +35,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { this.m_CurrentGeneration = pop.getGeneration(); for (int i = 0; i < pop.size(); i++) { @@ -44,6 +46,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -67,6 +70,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { this.m_OutputDimension = dim; // i think as far as i got not solution for the (n>2) dimensional case @@ -75,6 +79,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -86,6 +91,7 @@ public class MOSODynamicallyWeightedFitness implements InterfaceMOSOConverter, j * name to the current object. * @return The name. */ + @Override public String getName() { return "Dynamic Weighted Sum"; } diff --git a/src/eva2/server/go/operators/moso/MOSOEpsilonConstraint.java b/src/eva2/server/go/operators/moso/MOSOEpsilonConstraint.java index f9627a06..59e57c95 100644 --- a/src/eva2/server/go/operators/moso/MOSOEpsilonConstraint.java +++ b/src/eva2/server/go/operators/moso/MOSOEpsilonConstraint.java @@ -27,6 +27,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se if (b.m_EpsilonConstraint != null) this.m_EpsilonConstraint = (PropertyEpsilonConstraint)b.m_EpsilonConstraint.clone(); } + @Override public Object clone() { return (Object) new MOSOEpsilonConstraint(this); } @@ -38,6 +39,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -47,6 +49,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -67,6 +70,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { double[] newTarget = new double[dim]; @@ -84,6 +88,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -96,6 +101,7 @@ public class MOSOEpsilonConstraint implements InterfaceMOSOConverter, java.io.Se * name to the current object. * @return The name. */ + @Override public String getName() { return "Epsilon Constraint"; } diff --git a/src/eva2/server/go/operators/moso/MOSOEpsilonThreshold.java b/src/eva2/server/go/operators/moso/MOSOEpsilonThreshold.java index 610f6212..8341450e 100644 --- a/src/eva2/server/go/operators/moso/MOSOEpsilonThreshold.java +++ b/src/eva2/server/go/operators/moso/MOSOEpsilonThreshold.java @@ -31,6 +31,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser if (b.m_EpsilonThreshold != null) this.m_EpsilonThreshold = (PropertyEpsilonThreshold)b.m_EpsilonThreshold.clone(); } + @Override public Object clone() { return (Object) new MOSOEpsilonThreshold(this); } @@ -42,6 +43,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -51,6 +53,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -86,6 +89,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { double[] newPunish = new double[dim]; double[] newTarget = new double[dim]; @@ -107,6 +111,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -119,6 +124,7 @@ public class MOSOEpsilonThreshold implements InterfaceMOSOConverter, java.io.Ser * name to the current object. * @return The name. */ + @Override public String getName() { return "Epsilon Threshold"; } diff --git a/src/eva2/server/go/operators/moso/MOSOGoalProgramming.java b/src/eva2/server/go/operators/moso/MOSOGoalProgramming.java index 93a9dcba..40460008 100644 --- a/src/eva2/server/go/operators/moso/MOSOGoalProgramming.java +++ b/src/eva2/server/go/operators/moso/MOSOGoalProgramming.java @@ -25,6 +25,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri this.m_Goals = (PropertyDoubleArray)b.m_Goals; } } + @Override public Object clone() { return (Object) new MOSOGoalProgramming(this); } @@ -36,6 +37,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -45,6 +47,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -62,6 +65,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { double[] newWeights = new double[dim]; @@ -74,6 +78,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -86,6 +91,7 @@ public class MOSOGoalProgramming implements InterfaceMOSOConverter, java.io.Seri * name to the current object. * @return The name. */ + @Override public String getName() { return "Goal Programming"; } diff --git a/src/eva2/server/go/operators/moso/MOSOLpMetric.java b/src/eva2/server/go/operators/moso/MOSOLpMetric.java index 086ce58d..f2da194c 100644 --- a/src/eva2/server/go/operators/moso/MOSOLpMetric.java +++ b/src/eva2/server/go/operators/moso/MOSOLpMetric.java @@ -27,6 +27,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl this.m_Reference = (PropertyDoubleArray)b.m_Reference.clone(); } } + @Override public Object clone() { return (Object) new MOSOLpMetric(this); } @@ -38,6 +39,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -47,6 +49,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -76,6 +79,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { double[] newWeights = new double[dim]; @@ -88,6 +92,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { String result = "Lp Metric\n"; result += " P = "+this.m_P+"\n"; @@ -107,6 +112,7 @@ public class MOSOLpMetric implements InterfaceMOSOConverter, java.io.Serializabl * name to the current object. * @return The name. */ + @Override public String getName() { return "Lp Metric"; } diff --git a/src/eva2/server/go/operators/moso/MOSOMOGARankBased.java b/src/eva2/server/go/operators/moso/MOSOMOGARankBased.java index b8776847..fc81b354 100644 --- a/src/eva2/server/go/operators/moso/MOSOMOGARankBased.java +++ b/src/eva2/server/go/operators/moso/MOSOMOGARankBased.java @@ -16,6 +16,7 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial } public MOSOMOGARankBased(MOSOMOGARankBased b) { } + @Override public Object clone() { return (Object) new MOSOMOGARankBased(this); } @@ -27,6 +28,7 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { int[] MOGARank = new int[pop.size()]; for (int i = 0; i < MOGARank.length; i++) MOGARank[i] = 1; @@ -50,6 +52,7 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -65,6 +68,7 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { } @@ -72,6 +76,7 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -84,6 +89,7 @@ public class MOSOMOGARankBased implements InterfaceMOSOConverter, java.io.Serial * name to the current object. * @return The name. */ + @Override public String getName() { return "MOGA Rank Based"; } diff --git a/src/eva2/server/go/operators/moso/MOSOMaxiMin.java b/src/eva2/server/go/operators/moso/MOSOMaxiMin.java index 27822193..6faece2c 100644 --- a/src/eva2/server/go/operators/moso/MOSOMaxiMin.java +++ b/src/eva2/server/go/operators/moso/MOSOMaxiMin.java @@ -21,6 +21,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable public MOSOMaxiMin(MOSOMaxiMin b) { this.m_OutputDimension = b.m_OutputDimension; } + @Override public Object clone() { return (Object) new MOSOMaxiMin(this); } @@ -32,6 +33,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { AbstractEAIndividual tmpIndy; double[][] fitnessArray, minArray; @@ -98,6 +100,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -114,6 +117,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { this.m_OutputDimension = dim; } @@ -121,6 +125,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -133,6 +138,7 @@ public class MOSOMaxiMin implements InterfaceMOSOConverter, java.io.Serializable * name to the current object. * @return The name. */ + @Override public String getName() { return "MaxiMin Criterium"; } diff --git a/src/eva2/server/go/operators/moso/MOSONoConvert.java b/src/eva2/server/go/operators/moso/MOSONoConvert.java index 72fd6f29..69413278 100644 --- a/src/eva2/server/go/operators/moso/MOSONoConvert.java +++ b/src/eva2/server/go/operators/moso/MOSONoConvert.java @@ -17,6 +17,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab } public MOSONoConvert(MOSONoConvert b) { } + @Override public Object clone() { return (Object) new MOSONoConvert(this); } @@ -28,6 +29,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -37,6 +39,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] tmpFit; @@ -51,6 +54,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab * value of one * @param dim Outputdimension */ + @Override public void setOutputDimension(int dim) { // nothing to do here } @@ -58,6 +62,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -70,6 +75,7 @@ public class MOSONoConvert implements InterfaceMOSOConverter, java.io.Serializab * name to the current object. * @return The name. */ + @Override public String getName() { return "No Convert"; } diff --git a/src/eva2/server/go/operators/moso/MOSORandomChoice.java b/src/eva2/server/go/operators/moso/MOSORandomChoice.java index 18ee5557..7faab59f 100644 --- a/src/eva2/server/go/operators/moso/MOSORandomChoice.java +++ b/src/eva2/server/go/operators/moso/MOSORandomChoice.java @@ -20,6 +20,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial public MOSORandomChoice(MOSORandomChoice b) { this.m_OutputDimension = b.m_OutputDimension; } + @Override public Object clone() { return (Object) new MOSORandomChoice(this); } @@ -31,6 +32,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -40,6 +42,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -55,6 +58,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { this.m_OutputDimension = dim; // i think as far as i got not solution for the (n>2) dimensional case @@ -64,6 +68,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -77,6 +82,7 @@ public class MOSORandomChoice implements InterfaceMOSOConverter, java.io.Serial * name to the current object. * @return The name. */ + @Override public String getName() { return "Random Choice"; } diff --git a/src/eva2/server/go/operators/moso/MOSORandomWeight.java b/src/eva2/server/go/operators/moso/MOSORandomWeight.java index 8b797103..1fd7ee24 100644 --- a/src/eva2/server/go/operators/moso/MOSORandomWeight.java +++ b/src/eva2/server/go/operators/moso/MOSORandomWeight.java @@ -18,6 +18,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali } public MOSORandomWeight(MOSORandomWeight b) { } + @Override public Object clone() { return (Object) new MOSORandomWeight(this); } @@ -29,6 +30,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -38,6 +40,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit, tmpWeight; @@ -65,6 +68,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { } @@ -72,6 +76,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -84,6 +89,7 @@ public class MOSORandomWeight implements InterfaceMOSOConverter, java.io.Seriali * name to the current object. * @return The name. */ + @Override public String getName() { return "Randomly Weighted Sum"; } diff --git a/src/eva2/server/go/operators/moso/MOSORankbased.java b/src/eva2/server/go/operators/moso/MOSORankbased.java index 9e470e5b..0c186f0b 100644 --- a/src/eva2/server/go/operators/moso/MOSORankbased.java +++ b/src/eva2/server/go/operators/moso/MOSORankbased.java @@ -17,6 +17,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab } public MOSORankbased(MOSORankbased b) { } + @Override public Object clone() { return (Object) new MOSORankbased(this); } @@ -28,6 +29,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { ArchivingNSGAII arch = new ArchivingNSGAII(); arch.getNonDominatedSortedFronts(pop); @@ -39,6 +41,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -54,6 +57,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { } @@ -61,6 +65,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -73,6 +78,7 @@ public class MOSORankbased implements InterfaceMOSOConverter, java.io.Serializab * name to the current object. * @return The name. */ + @Override public String getName() { return "Rank Based"; } diff --git a/src/eva2/server/go/operators/moso/MOSOUtilityFunction.java b/src/eva2/server/go/operators/moso/MOSOUtilityFunction.java index 056b7a7b..90646d72 100644 --- a/src/eva2/server/go/operators/moso/MOSOUtilityFunction.java +++ b/src/eva2/server/go/operators/moso/MOSOUtilityFunction.java @@ -21,6 +21,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri System.out.println("Warning no source!"); this.m_OutputDimension = b.m_OutputDimension; } + @Override public Object clone() { return (Object) new MOSOUtilityFunction(this); } @@ -32,6 +33,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -41,6 +43,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -66,6 +69,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri * the optimization problem. * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { this.m_OutputDimension = dim; } @@ -73,6 +77,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -84,6 +89,7 @@ public class MOSOUtilityFunction implements InterfaceMOSOConverter, java.io.Seri * name to the current object. * @return The name. */ + @Override public String getName() { return "Utility Function"; } diff --git a/src/eva2/server/go/operators/moso/MOSOWeightedFitness.java b/src/eva2/server/go/operators/moso/MOSOWeightedFitness.java index 46d63cf0..c4e499c7 100644 --- a/src/eva2/server/go/operators/moso/MOSOWeightedFitness.java +++ b/src/eva2/server/go/operators/moso/MOSOWeightedFitness.java @@ -33,6 +33,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri } } + @Override public Object clone() { return (Object) new MOSOWeightedFitness(this); } @@ -44,6 +45,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -53,6 +55,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -78,6 +81,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { double[] newWeights = new double[dim]; @@ -90,6 +94,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { return this.getName()+"\n"; } @@ -102,6 +107,7 @@ public class MOSOWeightedFitness implements InterfaceMOSOConverter, java.io.Seri * name to the current object. * @return The name. */ + @Override public String getName() { return "Weighted Sum"; } diff --git a/src/eva2/server/go/operators/moso/MOSOWeightedLPTchebycheff.java b/src/eva2/server/go/operators/moso/MOSOWeightedLPTchebycheff.java index 1ef7a367..36ab154e 100644 --- a/src/eva2/server/go/operators/moso/MOSOWeightedLPTchebycheff.java +++ b/src/eva2/server/go/operators/moso/MOSOWeightedLPTchebycheff.java @@ -30,6 +30,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i if (b.m_WLPT != null) this.m_WLPT = (PropertyWeightedLPTchebycheff)b.m_WLPT.clone(); } + @Override public Object clone() { return (Object) new MOSOWeightedLPTchebycheff(this); } @@ -41,6 +42,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i * if you still want to access the original fitness values. * @param pop The population to process. */ + @Override public void convertMultiObjective2SingleObjective(Population pop) { for (int i = 0; i < pop.size(); i++) { this.convertSingleIndividual((AbstractEAIndividual)pop.get(i)); @@ -50,6 +52,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i /** This method processes a single individual * @param indy The individual to process. */ + @Override public void convertSingleIndividual(AbstractEAIndividual indy) { double[] resultFit = new double[1]; double[] tmpFit; @@ -73,6 +76,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i * value of one * @param dim Outputdimension of the problem */ + @Override public void setOutputDimension(int dim) { double[] newTarget = new double[dim]; double[] newWeights = new double[dim]; @@ -92,6 +96,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i /** This method returns a description of the objective * @return A String */ + @Override public String getStringRepresentation() { String result = "Lp Metric\n"; result += " P = "+this.m_WLPT.m_P+"\n"; @@ -120,6 +125,7 @@ public class MOSOWeightedLPTchebycheff implements InterfaceMOSOConverter, java.i * name to the current object. * @return The name. */ + @Override public String getName() { return "Lp/Tchebycheff"; } diff --git a/src/eva2/server/go/operators/mutation/CMAParamSet.java b/src/eva2/server/go/operators/mutation/CMAParamSet.java index aae496f0..54a85987 100644 --- a/src/eva2/server/go/operators/mutation/CMAParamSet.java +++ b/src/eva2/server/go/operators/mutation/CMAParamSet.java @@ -52,10 +52,12 @@ class CMAParamSet implements InterfacePopulationChangedEventListener, Serializab public CMAParamSet() {} + @Override public Object clone() { return new CMAParamSet(this); } + @Override public String toString() { return "d_sig " + d_sig + ", c_sig " + c_sig + ", sigma " + sigma + ", firstSigma " + firstSigma+ ", firstAdaptionDone " + firstAdaptionDone + ",\n meanX " + Arrays.toString(meanX) + ", pathC " + Arrays.toString(pathC)+ ", pathS " + Arrays.toString(pathS)+ ", eigenvalues " + Arrays.toString(eigenvalues) @@ -206,6 +208,7 @@ class CMAParamSet implements InterfacePopulationChangedEventListener, Serializab * * @see InterfacePopulationChangedEventListener */ + @Override public void registerPopulationStateChanged(Object source, String name) { if (name.equals(Population.populationInitialized)) { Population pop = (Population)source; diff --git a/src/eva2/server/go/operators/mutation/InterfaceMutation.java b/src/eva2/server/go/operators/mutation/InterfaceMutation.java index 420238d2..8ed0f06b 100644 --- a/src/eva2/server/go/operators/mutation/InterfaceMutation.java +++ b/src/eva2/server/go/operators/mutation/InterfaceMutation.java @@ -48,5 +48,6 @@ public interface InterfaceMutation { * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator); } diff --git a/src/eva2/server/go/operators/mutation/MutateDefault.java b/src/eva2/server/go/operators/mutation/MutateDefault.java index 9e818861..218e092b 100644 --- a/src/eva2/server/go/operators/mutation/MutateDefault.java +++ b/src/eva2/server/go/operators/mutation/MutateDefault.java @@ -16,6 +16,7 @@ public class MutateDefault implements InterfaceMutation, java.io.Serializable { /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateDefault(); } @@ -24,6 +25,7 @@ public class MutateDefault implements InterfaceMutation, java.io.Serializable { * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateDefault) return true; else return false; @@ -33,6 +35,7 @@ public class MutateDefault implements InterfaceMutation, java.io.Serializable { * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ } @@ -41,6 +44,7 @@ public class MutateDefault implements InterfaceMutation, java.io.Serializable { * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof IndividualInterface) ((IndividualInterface)individual).defaultMutate(); } @@ -50,6 +54,7 @@ public class MutateDefault implements InterfaceMutation, java.io.Serializable { * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -58,6 +63,7 @@ public class MutateDefault implements InterfaceMutation, java.io.Serializable { * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "Default mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateEAMixer.java b/src/eva2/server/go/operators/mutation/MutateEAMixer.java index 7d27e669..792928bf 100644 --- a/src/eva2/server/go/operators/mutation/MutateEAMixer.java +++ b/src/eva2/server/go/operators/mutation/MutateEAMixer.java @@ -76,6 +76,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable { /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateEAMixer(this); } @@ -84,6 +85,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable { * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateEAMixer) { MutateEAMixer mut = (MutateEAMixer)mutator; @@ -96,6 +98,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable { * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ InterfaceMutation[] mutators = this.m_Mutators.getSelectedMutators(); for (int i = 0; i < mutators.length; i++) mutators[i].init(individual, opt); @@ -105,6 +108,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable { * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { this.m_Mutators.normalizeWeights(); double[] probs = this.m_Mutators.getWeights(); @@ -139,6 +143,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable { * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { for (int i = 0; i < this.m_Mutators.getSelectedMutators().length; i++) { this.m_Mutators.getSelectedMutators()[i].crossoverOnStrategyParameters(indy1, partners); @@ -149,6 +154,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable { * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "EA mutation mixer"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESCorrVector.java b/src/eva2/server/go/operators/mutation/MutateESCorrVector.java index 14cede99..c6d605cf 100644 --- a/src/eva2/server/go/operators/mutation/MutateESCorrVector.java +++ b/src/eva2/server/go/operators/mutation/MutateESCorrVector.java @@ -61,6 +61,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESCorrVector(this); } @@ -69,6 +70,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESCorrVector) { MutateESCorrVector mut = (MutateESCorrVector)mutator; @@ -83,6 +85,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { double[] initVelocity = calcInitialVel(m_initialVelocity, ((InterfaceESIndividual)individual).getDoubleRange()); individual.putData(vectorKey, initVelocity); @@ -111,6 +114,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab * doesn't implement InterfaceESIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { // if (TRACE) System.out.println("Before Mutate: " + AbstractEAIndividual.getDefaultDataString(individual)); if (individual instanceof InterfaceESIndividual) { @@ -160,6 +164,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { ArrayList tmpList = new ArrayList(); if (indy1.getMutationOperator() instanceof MutateESCorrVector) tmpList.add(new Double(((MutateESCorrVector)indy1.getMutationOperator()).m_scalingDev)); @@ -177,6 +182,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES global mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESCorrolated.java b/src/eva2/server/go/operators/mutation/MutateESCorrolated.java index 3ceb246c..5ef193c7 100644 --- a/src/eva2/server/go/operators/mutation/MutateESCorrolated.java +++ b/src/eva2/server/go/operators/mutation/MutateESCorrolated.java @@ -52,6 +52,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESCorrolated(this); } @@ -60,6 +61,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator==this) return true; if (mutator instanceof MutateESCorrolated) { @@ -85,6 +87,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { if (individual instanceof InterfaceESIndividual) { double[] x = ((InterfaceESIndividual)individual).getDGenotype(); @@ -164,6 +167,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab // } // } + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceESIndividual) { double[] x = ((InterfaceESIndividual)individual).getDGenotype(); @@ -216,6 +220,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -242,6 +247,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES local correlated mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaption.java b/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaption.java index 403d5c6b..1d82ef6d 100644 --- a/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaption.java +++ b/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaption.java @@ -76,6 +76,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESCovarianceMatrixAdaption(this); } @@ -84,6 +85,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator==this) return true; if (mutator instanceof MutateESCovarianceMatrixAdaption) { @@ -111,6 +113,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { if (!(individual instanceof InterfaceESIndividual)) return; double[] x = ((InterfaceESIndividual)individual).getDGenotype(); @@ -148,6 +151,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -169,6 +173,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -288,6 +293,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "CMA mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaptionPlus.java b/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaptionPlus.java index 8dabbe2a..9d593ff2 100644 --- a/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaptionPlus.java +++ b/src/eva2/server/go/operators/mutation/MutateESCovarianceMatrixAdaptionPlus.java @@ -36,6 +36,7 @@ public class MutateESCovarianceMatrixAdaptionPlus extends * * @return The clone */ + @Override public Object clone() { return new MutateESCovarianceMatrixAdaptionPlus(this); } @@ -48,6 +49,7 @@ public class MutateESCovarianceMatrixAdaptionPlus extends * @param opt * The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { @@ -122,6 +124,7 @@ public class MutateESCovarianceMatrixAdaptionPlus extends } } + @Override protected void adaptStrategy() { } @@ -141,12 +144,14 @@ public class MutateESCovarianceMatrixAdaptionPlus extends } // @Override + @Override public void adaptAfterSelection(Population oldPop, Population selectedPop) { // TODO Auto-generated method stub } // @Override + @Override public void adaptGenerational(Population selectedPop, Population parentPop, Population newPop, boolean updateSelected) { double rate = 0.; @@ -208,6 +213,7 @@ public class MutateESCovarianceMatrixAdaptionPlus extends / (1 - m_psuccesstarget)); } + @Override public String getName() { return "CMA mutation for plus Strategies"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESFixedStepSize.java b/src/eva2/server/go/operators/mutation/MutateESFixedStepSize.java index 79cd03af..e3ebf6d9 100644 --- a/src/eva2/server/go/operators/mutation/MutateESFixedStepSize.java +++ b/src/eva2/server/go/operators/mutation/MutateESFixedStepSize.java @@ -30,6 +30,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESFixedStepSize(this); } @@ -38,6 +39,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESFixedStepSize) { MutateESFixedStepSize mut = (MutateESFixedStepSize)mutator; @@ -50,6 +52,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -58,6 +61,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -79,6 +83,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -87,6 +92,7 @@ public class MutateESFixedStepSize implements InterfaceMutation, java.io.Seriali * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES fixed step size mutation "+getSigma(); } diff --git a/src/eva2/server/go/operators/mutation/MutateESGlobal.java b/src/eva2/server/go/operators/mutation/MutateESGlobal.java index 06126152..e41fdd23 100644 --- a/src/eva2/server/go/operators/mutation/MutateESGlobal.java +++ b/src/eva2/server/go/operators/mutation/MutateESGlobal.java @@ -58,6 +58,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESGlobal(this); } @@ -66,6 +67,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESGlobal) { MutateESGlobal mut = (MutateESGlobal)mutator; @@ -80,6 +82,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -88,6 +91,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * doesn't implement InterfaceESIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -111,6 +115,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { if (m_CrossoverType!=MutateESCrossoverTypeEnum.none) { ArrayList tmpList = new ArrayList(); @@ -141,6 +146,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES global mutation"; } @@ -221,6 +227,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataHeader() */ + @Override public String[] getAdditionalDataHeader() { return new String[] {"sigma"}; } @@ -229,6 +236,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataInfo() */ + @Override public String[] getAdditionalDataInfo() { return new String[] {"The ES global mutation step size."}; } @@ -237,6 +245,7 @@ public class MutateESGlobal implements InterfaceMutation, java.io.Serializable, * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataValue(eva2.server.go.PopulationInterface) */ + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { return new Object[]{m_MutationStepSize}; } diff --git a/src/eva2/server/go/operators/mutation/MutateESLocal.java b/src/eva2/server/go/operators/mutation/MutateESLocal.java index 97c7c8a1..5d8deb97 100644 --- a/src/eva2/server/go/operators/mutation/MutateESLocal.java +++ b/src/eva2/server/go/operators/mutation/MutateESLocal.java @@ -55,6 +55,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESLocal(this); } @@ -63,6 +64,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator==this) return true; if (mutator instanceof MutateESLocal) { @@ -83,6 +85,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { if (individual instanceof InterfaceESIndividual) { // init the Sigmas @@ -95,6 +98,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * doesn't implement InterfaceESIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); @@ -120,6 +124,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { ArrayList tmpListA = new ArrayList(); ArrayList tmpListB = new ArrayList(); @@ -171,6 +176,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES local mutation"; } @@ -265,6 +271,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataHeader() */ + @Override public String[] getAdditionalDataHeader() { return new String[] {"sigma"}; } @@ -273,6 +280,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataInfo() */ + @Override public String[] getAdditionalDataInfo() { return new String[] {"The ES local mutation step sizes."}; } @@ -281,6 +289,7 @@ public class MutateESLocal implements InterfaceMutation, InterfaceAdditionalPopu * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataValue(eva2.server.go.PopulationInterface) */ + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { return new Object[]{m_Sigmas}; } diff --git a/src/eva2/server/go/operators/mutation/MutateESMainVectorAdaption.java b/src/eva2/server/go/operators/mutation/MutateESMainVectorAdaption.java index 7171d0a9..99e8ab8a 100644 --- a/src/eva2/server/go/operators/mutation/MutateESMainVectorAdaption.java +++ b/src/eva2/server/go/operators/mutation/MutateESMainVectorAdaption.java @@ -54,6 +54,7 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESMainVectorAdaption(this); } @@ -62,6 +63,7 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (this==mutator) return true; if (mutator instanceof MutateESMainVectorAdaption) { @@ -82,6 +84,7 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { if (!(individual instanceof InterfaceESIndividual)) return; double[] x = ((InterfaceESIndividual)individual).getDGenotype(); @@ -110,6 +113,7 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se * doesn't implement InterfaceESIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -130,6 +134,7 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -193,6 +198,7 @@ public class MutateESMainVectorAdaption implements InterfaceMutation, java.io.Se * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "MVA mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESMutativeStepSizeControl.java b/src/eva2/server/go/operators/mutation/MutateESMutativeStepSizeControl.java index 621d1167..bd1be8f6 100644 --- a/src/eva2/server/go/operators/mutation/MutateESMutativeStepSizeControl.java +++ b/src/eva2/server/go/operators/mutation/MutateESMutativeStepSizeControl.java @@ -48,6 +48,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java. /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESMutativeStepSizeControl(this); } @@ -56,6 +57,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java. * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESMutativeStepSizeControl) { MutateESMutativeStepSizeControl mut = (MutateESMutativeStepSizeControl)mutator; @@ -71,6 +73,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java. * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -79,6 +82,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java. * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -106,6 +110,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java. * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -114,6 +119,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java. * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES mutative step size control"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESPathLengthAdaption.java b/src/eva2/server/go/operators/mutation/MutateESPathLengthAdaption.java index 4c7bcdd2..26b5572a 100644 --- a/src/eva2/server/go/operators/mutation/MutateESPathLengthAdaption.java +++ b/src/eva2/server/go/operators/mutation/MutateESPathLengthAdaption.java @@ -44,6 +44,7 @@ public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Se /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESPathLengthAdaption(this); } @@ -52,6 +53,7 @@ public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Se * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESPathLengthAdaption) { MutateESPathLengthAdaption mut = (MutateESPathLengthAdaption)mutator; @@ -72,6 +74,7 @@ public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Se * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { if (!(individual instanceof InterfaceESIndividual)) return; double[] x = ((InterfaceESIndividual)individual).getDGenotype(); @@ -100,6 +103,7 @@ public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Se * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -133,6 +137,7 @@ public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Se * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -161,6 +166,7 @@ public class MutateESPathLengthAdaption implements InterfaceMutation, java.io.Se * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "Mutation/Path-Length-Control"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESPolynomial.java b/src/eva2/server/go/operators/mutation/MutateESPolynomial.java index 24d8d876..445c1336 100644 --- a/src/eva2/server/go/operators/mutation/MutateESPolynomial.java +++ b/src/eva2/server/go/operators/mutation/MutateESPolynomial.java @@ -30,6 +30,7 @@ public class MutateESPolynomial implements InterfaceMutation, java.io.Serializab /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESPolynomial(this); } @@ -38,6 +39,7 @@ public class MutateESPolynomial implements InterfaceMutation, java.io.Serializab * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESPolynomial) { MutateESPolynomial mut = (MutateESPolynomial)mutator; @@ -50,6 +52,7 @@ public class MutateESPolynomial implements InterfaceMutation, java.io.Serializab * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -58,6 +61,7 @@ public class MutateESPolynomial implements InterfaceMutation, java.io.Serializab * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceESIndividual) { @@ -88,6 +92,7 @@ public class MutateESPolynomial implements InterfaceMutation, java.io.Serializab * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -96,6 +101,7 @@ public class MutateESPolynomial implements InterfaceMutation, java.io.Serializab * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES fixed step size mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java b/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java index c40e01d0..89cf7a39 100644 --- a/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java +++ b/src/eva2/server/go/operators/mutation/MutateESRankMuCMA.java @@ -66,6 +66,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In this.doRankMuUpdate = mutator.doRankMuUpdate; } + @Override public Object clone() { // if (TRACE) System.out.println("WCMA clone"); return new MutateESRankMuCMA(this); @@ -107,6 +108,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In * @param oldGen * @param selectedP */ + @Override public void adaptAfterSelection(Population oldGen, Population selectedP) { Population selectedSorted = selectedP.getSortedBestFirst(new AbstractEAIndividualComparator(-1)); @@ -256,6 +258,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In /** * Expects newPop to have correct number of generations set. */ + @Override public void adaptGenerational(Population oldPop, Population selectedPop, Population newPop, boolean updateSelected) { // nothing to do? Oh yes, we can easily transfer the cma-params from the old to the new population. @@ -497,6 +500,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In return selectedPop.getCenterWeighted(weights); } + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do @@ -507,6 +511,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In return "Rank-Mu-CMA-Mutator"; } + @Override public String getStringRepresentation() { return "Rank-Mu-CMA-Mutator"; } @@ -515,6 +520,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In return "The CMA mutator scheme with static cov. matrix, rank-mu update and weighted recombination."; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { // firstAdaptionDone = false; @@ -544,6 +550,7 @@ public class MutateESRankMuCMA implements InterfaceAdaptOperatorGenerational, In } + @Override public void mutate(AbstractEAIndividual individual) { // if (!firstAdaptionDone) { // if (TRACE) System.out.println("No mutation before first adaptions step"); diff --git a/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java b/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java index c24c148e..238bc4d3 100644 --- a/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java +++ b/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java @@ -34,6 +34,7 @@ public class MutateESSuccessRule extends MutateESFixedStepSize implements Interf /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateESSuccessRule(this); } @@ -42,6 +43,7 @@ public class MutateESSuccessRule extends MutateESFixedStepSize implements Interf * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateESSuccessRule) { MutateESSuccessRule mut = (MutateESSuccessRule)mutator; @@ -56,6 +58,7 @@ public class MutateESSuccessRule extends MutateESFixedStepSize implements Interf * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "ES 1/5 Success Rule mutation"; } @@ -78,6 +81,7 @@ public class MutateESSuccessRule extends MutateESFixedStepSize implements Interf * name to the current object. * @return The name. */ + @Override public String getName() { return "ES 1/5 Success Rule mutation"; } @@ -126,10 +130,12 @@ public class MutateESSuccessRule extends MutateESFixedStepSize implements Interf return "The initial step size."; } + @Override public void adaptAfterSelection(Population oldGen, Population selected) { // nothing to do here } + @Override public void adaptGenerational(Population selectedPop, Population parentPop, Population newPop, boolean updateSelected) { double rate = 0.; for (int i = 0; i < parentPop.size(); i++) { diff --git a/src/eva2/server/go/operators/mutation/MutateGAAdaptive.java b/src/eva2/server/go/operators/mutation/MutateGAAdaptive.java index 0ffd0351..277dce76 100644 --- a/src/eva2/server/go/operators/mutation/MutateGAAdaptive.java +++ b/src/eva2/server/go/operators/mutation/MutateGAAdaptive.java @@ -37,6 +37,7 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGAAdaptive(this); } @@ -45,6 +46,7 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGAAdaptive) { MutateGAAdaptive mut = (MutateGAAdaptive)mutator; @@ -59,6 +61,7 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -67,6 +70,7 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceGAIndividual) { @@ -88,6 +92,7 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -96,6 +101,7 @@ public class MutateGAAdaptive implements InterfaceMutation, java.io.Serializable * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GA adaptive mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGAGISwapBits.java b/src/eva2/server/go/operators/mutation/MutateGAGISwapBits.java index 9c3b8e61..bf513634 100644 --- a/src/eva2/server/go/operators/mutation/MutateGAGISwapBits.java +++ b/src/eva2/server/go/operators/mutation/MutateGAGISwapBits.java @@ -43,6 +43,7 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGAGISwapBits(this); } @@ -51,6 +52,7 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGAGISwapBits) { MutateGAGISwapBits mut = (MutateGAGISwapBits)mutator; @@ -64,6 +66,7 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -73,6 +76,7 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -81,6 +85,7 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab * doesn't implement InterfaceGAIndividual or InterfaceGIIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { // System.err.println("Before Mutate: " +(individual.getStringRepresentation())); if (individual instanceof InterfaceGAIndividual || (individual instanceof InterfaceGIIndividual)) { @@ -172,6 +177,7 @@ public class MutateGAGISwapBits implements InterfaceMutation, java.io.Serializab * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GA/GI swap values mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGAGISwapBitsSegmentwise.java b/src/eva2/server/go/operators/mutation/MutateGAGISwapBitsSegmentwise.java index f1a5df45..c1106380 100644 --- a/src/eva2/server/go/operators/mutation/MutateGAGISwapBitsSegmentwise.java +++ b/src/eva2/server/go/operators/mutation/MutateGAGISwapBitsSegmentwise.java @@ -33,6 +33,7 @@ public class MutateGAGISwapBitsSegmentwise extends MutateGAGISwapBits implements this.segmentLength = segmentLen; } + @Override public Object clone() { return new MutateGAGISwapBitsSegmentwise(this); } diff --git a/src/eva2/server/go/operators/mutation/MutateGAShiftSubstring.java b/src/eva2/server/go/operators/mutation/MutateGAShiftSubstring.java index 41bed7e1..e1be64b3 100644 --- a/src/eva2/server/go/operators/mutation/MutateGAShiftSubstring.java +++ b/src/eva2/server/go/operators/mutation/MutateGAShiftSubstring.java @@ -32,6 +32,7 @@ public class MutateGAShiftSubstring implements InterfaceMutation, java.io.Serial /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGAShiftSubstring(this); } @@ -40,6 +41,7 @@ public class MutateGAShiftSubstring implements InterfaceMutation, java.io.Serial * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGAShiftSubstring) { MutateGAShiftSubstring mut = (MutateGAShiftSubstring)mutator; @@ -53,6 +55,7 @@ public class MutateGAShiftSubstring implements InterfaceMutation, java.io.Serial * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -62,6 +65,7 @@ public class MutateGAShiftSubstring implements InterfaceMutation, java.io.Serial * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { // System.out.println("Before Mutate: " +(individual.getStringRepresentation())); if (individual instanceof InterfaceGAIndividual) { @@ -109,6 +113,7 @@ public class MutateGAShiftSubstring implements InterfaceMutation, java.io.Serial * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -117,6 +122,7 @@ public class MutateGAShiftSubstring implements InterfaceMutation, java.io.Serial * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GA inversion mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGASwapBitsSegmentwise.java b/src/eva2/server/go/operators/mutation/MutateGASwapBitsSegmentwise.java index 9930a34a..91a08634 100644 --- a/src/eva2/server/go/operators/mutation/MutateGASwapBitsSegmentwise.java +++ b/src/eva2/server/go/operators/mutation/MutateGASwapBitsSegmentwise.java @@ -59,6 +59,7 @@ public class MutateGASwapBitsSegmentwise implements InterfaceMutation, java.io.S /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGASwapBitsSegmentwise(this); } @@ -67,6 +68,7 @@ public class MutateGASwapBitsSegmentwise implements InterfaceMutation, java.io.S * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGASwapBitsSegmentwise) { MutateGASwapBitsSegmentwise mut = (MutateGASwapBitsSegmentwise)mutator; @@ -82,6 +84,7 @@ public class MutateGASwapBitsSegmentwise implements InterfaceMutation, java.io.S * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -91,6 +94,7 @@ public class MutateGASwapBitsSegmentwise implements InterfaceMutation, java.io.S * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -99,6 +103,7 @@ public class MutateGASwapBitsSegmentwise implements InterfaceMutation, java.io.S * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { // System.out.println("Before Mutate: " +(individual).getStringRepresentation()); if (individual instanceof InterfaceGAIndividual) { @@ -162,6 +167,7 @@ public class MutateGASwapBitsSegmentwise implements InterfaceMutation, java.io.S * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GA swap bits segment-wise mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGAUniform.java b/src/eva2/server/go/operators/mutation/MutateGAUniform.java index 9b932983..fa29b689 100644 --- a/src/eva2/server/go/operators/mutation/MutateGAUniform.java +++ b/src/eva2/server/go/operators/mutation/MutateGAUniform.java @@ -26,6 +26,7 @@ public class MutateGAUniform implements InterfaceMutation, Serializable { setBitwiseProb(o.getBitwiseProb()); } + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { if (indy1.getMutationOperator() instanceof MutateGAUniform) { @@ -37,6 +38,7 @@ public class MutateGAUniform implements InterfaceMutation, Serializable { } } + @Override public Object clone() { return new MutateGAUniform(this); } @@ -45,10 +47,12 @@ public class MutateGAUniform implements InterfaceMutation, Serializable { setUseInvertedLength(isUseInvertedLength()); } + @Override public String getStringRepresentation() { return "Uniform GA mutation (" + getBitwiseProb() + ")"; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { if (useInvertedLength && (individual instanceof InterfaceGAIndividual)) setBitwiseProb(1./((double)((InterfaceGAIndividual)individual).getGenotypeLength())); @@ -57,6 +61,7 @@ public class MutateGAUniform implements InterfaceMutation, Serializable { /** * Flip every bit with a certain probability. */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGAIndividual) { InterfaceGAIndividual indy = (InterfaceGAIndividual)individual; diff --git a/src/eva2/server/go/operators/mutation/MutateGIInsertDelete.java b/src/eva2/server/go/operators/mutation/MutateGIInsertDelete.java index 47b91a1e..a138d0a0 100644 --- a/src/eva2/server/go/operators/mutation/MutateGIInsertDelete.java +++ b/src/eva2/server/go/operators/mutation/MutateGIInsertDelete.java @@ -27,6 +27,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGIInsertDelete(); } @@ -35,6 +36,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGIInsertDelete) { MutateGIInsertDelete mut = (MutateGIInsertDelete)mutator; @@ -48,6 +50,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ } @@ -57,6 +60,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -65,6 +69,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGIIndividual) { int[] x = ((InterfaceGIIndividual)individual).getIGenotype(); @@ -122,6 +127,7 @@ public class MutateGIInsertDelete implements InterfaceMutation, java.io.Serializ * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GI insert/delete mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGIInvert.java b/src/eva2/server/go/operators/mutation/MutateGIInvert.java index c04dea38..3137d696 100644 --- a/src/eva2/server/go/operators/mutation/MutateGIInvert.java +++ b/src/eva2/server/go/operators/mutation/MutateGIInvert.java @@ -27,6 +27,7 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable { /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGIInvert(); } @@ -35,6 +36,7 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable { * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGIInvert) { MutateGIInvert mut = (MutateGIInvert)mutator; @@ -48,6 +50,7 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable { * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ } @@ -56,6 +59,7 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable { * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGIIndividual) { int[] x = ((InterfaceGIIndividual)individual).getIGenotype(); @@ -82,6 +86,7 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable { * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -96,6 +101,7 @@ public class MutateGIInvert implements InterfaceMutation, java.io.Serializable { * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GI invert mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGINominal.java b/src/eva2/server/go/operators/mutation/MutateGINominal.java index d5a1e827..a7b4cd86 100644 --- a/src/eva2/server/go/operators/mutation/MutateGINominal.java +++ b/src/eva2/server/go/operators/mutation/MutateGINominal.java @@ -27,6 +27,7 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGINominal(); } @@ -35,6 +36,7 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGINominal) { MutateGINominal mut = (MutateGINominal)mutator; @@ -48,6 +50,7 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ } @@ -56,6 +59,7 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGIIndividual) { int[] x = ((InterfaceGIIndividual)individual).getIGenotype(); @@ -78,6 +82,7 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -86,6 +91,7 @@ public class MutateGINominal implements InterfaceMutation, java.io.Serializable * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GI nominal mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGIOrdinal.java b/src/eva2/server/go/operators/mutation/MutateGIOrdinal.java index 5752fd09..68674c72 100644 --- a/src/eva2/server/go/operators/mutation/MutateGIOrdinal.java +++ b/src/eva2/server/go/operators/mutation/MutateGIOrdinal.java @@ -29,6 +29,7 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGIOrdinal(); } @@ -37,6 +38,7 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGIOrdinal) { MutateGIOrdinal mut = (MutateGIOrdinal)mutator; @@ -51,6 +53,7 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ } @@ -59,6 +62,7 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGIIndividual) { int[] x = ((InterfaceGIIndividual)individual).getIGenotype(); @@ -87,6 +91,7 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -95,6 +100,7 @@ public class MutateGIOrdinal implements InterfaceMutation, java.io.Serializable * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GI ordinal mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGISubset.java b/src/eva2/server/go/operators/mutation/MutateGISubset.java index f866da31..00ce9187 100644 --- a/src/eva2/server/go/operators/mutation/MutateGISubset.java +++ b/src/eva2/server/go/operators/mutation/MutateGISubset.java @@ -40,25 +40,30 @@ public class MutateGISubset implements InterfaceMutation, Serializable { setMaxNumMutations(maxMutes); } + @Override public Object clone() { return new MutateGISubset(this); } + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do } + @Override public String getStringRepresentation() { return "GI subset mutation in " + BeanInspector.toString(mutableSet); } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { // nothing to do } + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGIIndividual) { InterfaceGIIndividual giIndy = (InterfaceGIIndividual)individual; diff --git a/src/eva2/server/go/operators/mutation/MutateGITranslocate.java b/src/eva2/server/go/operators/mutation/MutateGITranslocate.java index 503c3e6f..66af6fb5 100644 --- a/src/eva2/server/go/operators/mutation/MutateGITranslocate.java +++ b/src/eva2/server/go/operators/mutation/MutateGITranslocate.java @@ -39,6 +39,7 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGITranslocate(); } @@ -47,6 +48,7 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGITranslocate) { MutateGITranslocate mut = (MutateGITranslocate)mutator; @@ -60,6 +62,7 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt){ } @@ -68,6 +71,7 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa * doesn't implement InterfaceGIIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { if (individual instanceof InterfaceGIIndividual) { int[] x = ((InterfaceGIIndividual)individual).getIGenotype(); @@ -113,6 +117,7 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -137,6 +142,7 @@ public class MutateGITranslocate implements InterfaceMutation, java.io.Serializa * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GI translocation mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGPAdaptive.java b/src/eva2/server/go/operators/mutation/MutateGPAdaptive.java index 43a60a80..eb18727b 100644 --- a/src/eva2/server/go/operators/mutation/MutateGPAdaptive.java +++ b/src/eva2/server/go/operators/mutation/MutateGPAdaptive.java @@ -34,6 +34,7 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGPAdaptive(this); } @@ -42,6 +43,7 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGPAdaptive) { MutateGPAdaptive mut = (MutateGPAdaptive)mutator; @@ -57,6 +59,7 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -65,6 +68,7 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { //System.out.println("Before Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor()); if (individual instanceof InterfaceGPIndividual) { @@ -81,6 +85,7 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -89,6 +94,7 @@ public class MutateGPAdaptive implements InterfaceMutation, java.io.Serializable * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GP adaptive mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateGPSingleNode.java b/src/eva2/server/go/operators/mutation/MutateGPSingleNode.java index 3be49cf8..2a251dfa 100644 --- a/src/eva2/server/go/operators/mutation/MutateGPSingleNode.java +++ b/src/eva2/server/go/operators/mutation/MutateGPSingleNode.java @@ -24,6 +24,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab /** This method will enable you to clone a given mutation operator * @return The clone */ + @Override public Object clone() { return new MutateGPSingleNode(); } @@ -32,6 +33,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateGPSingleNode) return true; else return false; @@ -41,6 +43,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab * @param individual The individual that will be mutated. * @param opt The optimization problem. */ + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { } @@ -49,6 +52,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab * doesn't implement InterfaceGAIndividual nothing happens. * @param individual The individual that is to be mutated */ + @Override public void mutate(AbstractEAIndividual individual) { // System.out.println("Before Mutate: " +((InterfaceGPIndividual)individual).getPGenotype()[0].getStringRepresentation()); // System.out.println("Length: " +((InterfaceGPIndividual)individual).getPGenotype()[0].getNumberOfNodes()); @@ -87,6 +91,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -95,6 +100,7 @@ public class MutateGPSingleNode implements InterfaceMutation, java.io.Serializab * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "GP node mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateOBGAFlip.java b/src/eva2/server/go/operators/mutation/MutateOBGAFlip.java index 82007b3c..6c8c452b 100644 --- a/src/eva2/server/go/operators/mutation/MutateOBGAFlip.java +++ b/src/eva2/server/go/operators/mutation/MutateOBGAFlip.java @@ -31,6 +31,7 @@ public class MutateOBGAFlip implements InterfaceMutation, java.io.Serializable { public MutateOBGAFlip() { } + @Override public Object clone() { return this; } @@ -39,15 +40,18 @@ public class MutateOBGAFlip implements InterfaceMutation, java.io.Serializable { * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateOBGAFlip) return true; else return false; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { //nothing to init } + @Override public void mutate(AbstractEAIndividual individual) { int[][] perm = ( (InterfaceOBGAIndividual) individual). @@ -69,6 +73,7 @@ public class MutateOBGAFlip implements InterfaceMutation, java.io.Serializable { * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -77,6 +82,7 @@ public class MutateOBGAFlip implements InterfaceMutation, java.io.Serializable { * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "OBGA flip mutation"; } diff --git a/src/eva2/server/go/operators/mutation/MutateOBGAInversion.java b/src/eva2/server/go/operators/mutation/MutateOBGAInversion.java index f690a964..c963b710 100644 --- a/src/eva2/server/go/operators/mutation/MutateOBGAInversion.java +++ b/src/eva2/server/go/operators/mutation/MutateOBGAInversion.java @@ -31,6 +31,7 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat public MutateOBGAInversion() { } + @Override public Object clone() { return this; } @@ -39,15 +40,18 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat * are actually the same. * @param mutator The other mutation operator */ + @Override public boolean equals(Object mutator) { if (mutator instanceof MutateOBGAInversion) return true; else return false; } + @Override public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { //nothing to init } + @Override public void mutate(AbstractEAIndividual individual) { int[][] permnew = (int[][]) ((InterfaceOBGAIndividual) individual). getOBGenotype().clone(); int[][] perm = ((InterfaceDataTypePermutation) individual).getPermutationData(); @@ -66,6 +70,7 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat * @param indy1 The original mother * @param partners The original partners */ + @Override public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners) { // nothing to do here } @@ -74,6 +79,7 @@ public class MutateOBGAInversion implements java.io.Serializable, InterfaceMutat * operator * @return A descriptive string. */ + @Override public String getStringRepresentation() { return "OBGA inversion mutation"; } diff --git a/src/eva2/server/go/operators/mutation/PropertyMutationMixer.java b/src/eva2/server/go/operators/mutation/PropertyMutationMixer.java index f9a25927..f8da0195 100644 --- a/src/eva2/server/go/operators/mutation/PropertyMutationMixer.java +++ b/src/eva2/server/go/operators/mutation/PropertyMutationMixer.java @@ -42,6 +42,7 @@ public class PropertyMutationMixer implements java.io.Serializable { } } + @Override public Object clone() { return (Object) new PropertyMutationMixer(this); } diff --git a/src/eva2/server/go/operators/mutation/PropertyMutationMixerEditor.java b/src/eva2/server/go/operators/mutation/PropertyMutationMixerEditor.java index 6145bcec..4c1074db 100644 --- a/src/eva2/server/go/operators/mutation/PropertyMutationMixerEditor.java +++ b/src/eva2/server/go/operators/mutation/PropertyMutationMixerEditor.java @@ -196,6 +196,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** This action listener,... */ ActionListener updateTargets = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { updateTargetList(); } @@ -204,6 +205,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** This action listener,... */ ActionListener addTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_MutatorsWithWeights.addMutator((InterfaceMutation)m_MutatorsWithWeights.getAvailableMutators()[0].clone()); int l = m_MutatorsWithWeights.getSelectedMutators().length; @@ -236,6 +238,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** This action listener,... */ ActionListener deleteTarget = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { int l = m_MutatorsWithWeights.getSelectedMutators().length, j = 0; GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1]; @@ -254,6 +257,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** This action listener,... */ ActionListener normalizeWeights = new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { m_MutatorsWithWeights.normalizeWeights(); updateTargetList(); @@ -263,11 +267,14 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** This action listener reads all values */ KeyListener readDoubleArrayAction = new KeyListener() { + @Override public void keyPressed(KeyEvent event) { } + @Override public void keyTyped(KeyEvent event) { } + @Override public void keyReleased(KeyEvent event) { double[] newW = m_MutatorsWithWeights.getWeights(); @@ -300,6 +307,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** This method will set the value of object that is to be edited. * @param o an object that must be an array. */ + @Override public void setValue(Object o) { if (o instanceof PropertyMutationMixer) { this.m_MutatorsWithWeights= (PropertyMutationMixer) o; @@ -310,10 +318,12 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** Returns the current object. * @return the current object */ + @Override public Object getValue() { return this.m_MutatorsWithWeights; } + @Override public String getJavaInitializationString() { return "TEST"; } @@ -321,6 +331,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** * */ + @Override public String getAsText() { return null; } @@ -328,6 +339,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** * */ + @Override public void setAsText(String text) throws IllegalArgumentException { throw new IllegalArgumentException(text); } @@ -335,6 +347,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** * */ + @Override public String[] getTags() { return null; } @@ -356,6 +369,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** Returns true since the Object can be shown * @return true */ + @Override public boolean isPaintable() { return true; } @@ -365,6 +379,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ + @Override public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getAscent()) / 2; @@ -375,6 +390,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** Returns true because we do support a custom editor. * @return true */ + @Override public boolean supportsCustomEditor() { return true; } @@ -382,6 +398,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /** Returns the array editing component. * @return a value of type 'java.awt.Component' */ + @Override public Component getCustomEditor() { if (this.m_Component == null) { this.initCustomEditor(); @@ -400,10 +417,12 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito /********************************* java.beans.PropertyChangeListener *************************/ + @Override public void addPropertyChangeListener(PropertyChangeListener l) { m_Support.addPropertyChangeListener(l); } + @Override public void removePropertyChangeListener(PropertyChangeListener l) { m_Support.removePropertyChangeListener(l); } @@ -411,6 +430,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito * editing an object. * @param evt */ + @Override public void propertyChange(PropertyChangeEvent evt) { Object newVal = evt.getNewValue(); Object oldVal = evt.getOldValue(); diff --git a/src/eva2/server/go/operators/nichepso/absorption/ConsiderPBestAbsorptionStrategy.java b/src/eva2/server/go/operators/nichepso/absorption/ConsiderPBestAbsorptionStrategy.java index 529cbc0b..1dd15297 100644 --- a/src/eva2/server/go/operators/nichepso/absorption/ConsiderPBestAbsorptionStrategy.java +++ b/src/eva2/server/go/operators/nichepso/absorption/ConsiderPBestAbsorptionStrategy.java @@ -18,6 +18,7 @@ public class ConsiderPBestAbsorptionStrategy extends StandardAbsorptionStrategy{ * 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 public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { if (!super.shouldAbsorbParticleIntoSubswarm(indy, subswarm, mainswarm)){ return false; diff --git a/src/eva2/server/go/operators/nichepso/absorption/EuclideanDiversityAbsorptionStrategy.java b/src/eva2/server/go/operators/nichepso/absorption/EuclideanDiversityAbsorptionStrategy.java index ee20d4b2..0aa797b8 100644 --- a/src/eva2/server/go/operators/nichepso/absorption/EuclideanDiversityAbsorptionStrategy.java +++ b/src/eva2/server/go/operators/nichepso/absorption/EuclideanDiversityAbsorptionStrategy.java @@ -43,6 +43,7 @@ public class EuclideanDiversityAbsorptionStrategy extends StandardAbsorptionStra * the diversity (mean distance from the gbest) of the subswarm < epsilon * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.StandardAbsorptionStrategy#shouldAbsorbParticleIntoSubswarm(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { if (!super.shouldAbsorbParticleIntoSubswarm(indy, subswarm, mainswarm)){ return false; // diff --git a/src/eva2/server/go/operators/nichepso/absorption/StandardAbsorptionStrategy.java b/src/eva2/server/go/operators/nichepso/absorption/StandardAbsorptionStrategy.java index d7481c63..02c5ccc3 100644 --- a/src/eva2/server/go/operators/nichepso/absorption/StandardAbsorptionStrategy.java +++ b/src/eva2/server/go/operators/nichepso/absorption/StandardAbsorptionStrategy.java @@ -17,6 +17,7 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy, /********************************************************************************************************************** * ctors, init, clone */ + @Override public Object clone(){ return (Object) new StandardAbsorptionStrategy(); } @@ -35,6 +36,7 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy, * the particle lies in the radius of the subswarm * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceAbsorptionStrategy#shouldAbsorbParticleIntoSubswarm(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public boolean shouldAbsorbParticleIntoSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { if (!subswarm.isActive()){ return false; // no interaction between active mainswarmparticle and inactive subswarm @@ -64,6 +66,7 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy, * adds indy to an active subswarm, then removes indy from the mainswarm. * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceAbsorptionStrategy#absorbParticle(javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public void absorbParticle(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { if (!subswarm.isActive()){ System.out.println("absorbParticle: trying to absorb a particle into an inactive subswarm."); diff --git a/src/eva2/server/go/operators/nichepso/deactivation/DummyDeactivationStrategy.java b/src/eva2/server/go/operators/nichepso/deactivation/DummyDeactivationStrategy.java index d355af8c..e437c167 100644 --- a/src/eva2/server/go/operators/nichepso/deactivation/DummyDeactivationStrategy.java +++ b/src/eva2/server/go/operators/nichepso/deactivation/DummyDeactivationStrategy.java @@ -8,15 +8,18 @@ import eva2.server.go.strategies.ParticleSubSwarmOptimization; */ public class DummyDeactivationStrategy implements InterfaceDeactivationStrategy, java.io.Serializable { + @Override public Object clone(){ return (Object) new DummyDeactivationStrategy(); } + @Override public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { return null; } + @Override public boolean shouldDeactivateSubswarm( ParticleSubSwarmOptimization subswarm) { return false; diff --git a/src/eva2/server/go/operators/nichepso/deactivation/ImprovementDeactivationStrategy.java b/src/eva2/server/go/operators/nichepso/deactivation/ImprovementDeactivationStrategy.java index e08dffbc..a8ef73bc 100644 --- a/src/eva2/server/go/operators/nichepso/deactivation/ImprovementDeactivationStrategy.java +++ b/src/eva2/server/go/operators/nichepso/deactivation/ImprovementDeactivationStrategy.java @@ -40,6 +40,7 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr this.epsilon = eps; } + @Override public Object clone(){ return (Object) new ImprovementDeactivationStrategy(this); } @@ -91,6 +92,7 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr * (i.e. the stddev over the past 3 iterations is < epsilson) * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#shouldDeactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) { if (!subswarm.isActive()){ return false; @@ -108,6 +110,7 @@ public class ImprovementDeactivationStrategy implements InterfaceDeactivationStr * to be reinitialized into the mainswarm. * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#deactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { if (!subswarm.isActive()){ System.out.println("deactivateSubSwarm: try to deactivate inactive subswarm"); diff --git a/src/eva2/server/go/operators/nichepso/deactivation/StandardDeactivationStrategy.java b/src/eva2/server/go/operators/nichepso/deactivation/StandardDeactivationStrategy.java index a649fddd..db9e770b 100644 --- a/src/eva2/server/go/operators/nichepso/deactivation/StandardDeactivationStrategy.java +++ b/src/eva2/server/go/operators/nichepso/deactivation/StandardDeactivationStrategy.java @@ -41,6 +41,7 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate this.epsilon = eps; } + @Override public Object clone(){ return (Object) new StandardDeactivationStrategy(this); } @@ -88,6 +89,7 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate * (i.e. the stddev over the past 3 iterations is < epsilson) * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#shouldDeactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm) { if (!subswarm.isActive()){ return false; @@ -105,6 +107,7 @@ public class StandardDeactivationStrategy implements InterfaceDeactivationStrate * to be reinitialized into the mainswarm. * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceDeactivationStrategy#deactivateSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm) { if (!subswarm.isActive()){ System.out.println("deactivateSubSwarm: try to deactivate inactive subswarm"); diff --git a/src/eva2/server/go/operators/nichepso/merging/ScatterMergingStrategy.java b/src/eva2/server/go/operators/nichepso/merging/ScatterMergingStrategy.java index d6b72c8d..6f60b71c 100644 --- a/src/eva2/server/go/operators/nichepso/merging/ScatterMergingStrategy.java +++ b/src/eva2/server/go/operators/nichepso/merging/ScatterMergingStrategy.java @@ -26,6 +26,7 @@ public class ScatterMergingStrategy extends StandardMergingStrategy{ super(theMu); } + @Override public String globalInfo(){ return "Strategy to merge subswarms"; } @@ -40,6 +41,7 @@ public class ScatterMergingStrategy extends StandardMergingStrategy{ * @param i * @param j */ + @Override public void mergeSubswarms( int i, int j, diff --git a/src/eva2/server/go/operators/nichepso/merging/StandardMergingStrategy.java b/src/eva2/server/go/operators/nichepso/merging/StandardMergingStrategy.java index 12247929..2bd6cb53 100644 --- a/src/eva2/server/go/operators/nichepso/merging/StandardMergingStrategy.java +++ b/src/eva2/server/go/operators/nichepso/merging/StandardMergingStrategy.java @@ -40,6 +40,7 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i this.mu = other.mu; } + @Override public Object clone(){ return (Object) new StandardMergingStrategy(this); } @@ -51,6 +52,7 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i * the subswarms are merged, if they overlap (or are very close) and if they are of equal state * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceMergingStrategie#shouldMergeSubswarms(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public boolean shouldMergeSubswarms(ParticleSubSwarmOptimization subswarm1, ParticleSubSwarmOptimization subswarm2) { // check for equal state if (subswarm1.isActive() && !subswarm2.isActive()) return false; @@ -113,6 +115,7 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i * @param i * @param j */ + @Override public void mergeSubswarms( int i, int j, diff --git a/src/eva2/server/go/operators/nichepso/subswarmcreation/DummySubswarmCreationStrategy.java b/src/eva2/server/go/operators/nichepso/subswarmcreation/DummySubswarmCreationStrategy.java index 55e6f71d..952df39e 100644 --- a/src/eva2/server/go/operators/nichepso/subswarmcreation/DummySubswarmCreationStrategy.java +++ b/src/eva2/server/go/operators/nichepso/subswarmcreation/DummySubswarmCreationStrategy.java @@ -5,16 +5,19 @@ import eva2.server.go.strategies.ParticleSubSwarmOptimization; public class DummySubswarmCreationStrategy implements InterfaceSubswarmCreationStrategy { + @Override public Object clone(){ return (Object) new DummySubswarmCreationStrategy(); } + @Override public void createSubswarm(ParticleSubSwarmOptimization preparedSubswarm, AbstractEAIndividual indy, ParticleSubSwarmOptimization mainSwarm) { // TODO Auto-generated method stub } + @Override public boolean shouldCreateSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization mainswarm) { // TODO Auto-generated method stub diff --git a/src/eva2/server/go/operators/nichepso/subswarmcreation/GenerateNeighborSubswarmCreationStrategy.java b/src/eva2/server/go/operators/nichepso/subswarmcreation/GenerateNeighborSubswarmCreationStrategy.java index f9247521..d08b6160 100644 --- a/src/eva2/server/go/operators/nichepso/subswarmcreation/GenerateNeighborSubswarmCreationStrategy.java +++ b/src/eva2/server/go/operators/nichepso/subswarmcreation/GenerateNeighborSubswarmCreationStrategy.java @@ -34,6 +34,7 @@ public class GenerateNeighborSubswarmCreationStrategy extends * 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 public void createSubswarm(ParticleSubSwarmOptimization preparedSubswarm, AbstractEAIndividual indy, ParticleSubSwarmOptimization mainSwarm) { // get the neighbor in the mainswarm AbstractEAIndividual neighbor = mainSwarm.getMemberNeighbor(indy); diff --git a/src/eva2/server/go/operators/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java b/src/eva2/server/go/operators/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java index 048b18c7..b8f384d8 100644 --- a/src/eva2/server/go/operators/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java +++ b/src/eva2/server/go/operators/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java @@ -27,6 +27,7 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati delta = 0.0001; } + @Override public Object clone(){ return (Object) new StandardSubswarmCreationStrategy(delta); } @@ -43,6 +44,7 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati * @param indy main swarm particle * @return */ + @Override public boolean shouldCreateSubswarm(AbstractEAIndividual indy, ParticleSubSwarmOptimization mainswarm) { if (createSubswarmConstraintViolation(indy, mainswarm)){ return false; @@ -87,6 +89,7 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati * then deletes the two particles from the mainswarm. * (non-Javadoc) @see javaeva.server.oa.go.Operators.NichePSO.InterfaceSubswarmCreationStrategy#createSubswarm(javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization, javaeva.server.oa.go.EAIndividuals.AbstractEAIndividual, javaeva.server.oa.go.Strategies.ParticleSubSwarmOptimization) */ + @Override public void createSubswarm(ParticleSubSwarmOptimization preparedSubswarm, AbstractEAIndividual indy, ParticleSubSwarmOptimization mainSwarm) { // get the neighbor to create the subswarm diff --git a/src/eva2/server/go/operators/paramcontrol/AbstractLinearParamAdaption.java b/src/eva2/server/go/operators/paramcontrol/AbstractLinearParamAdaption.java index 652abf65..b044296c 100644 --- a/src/eva2/server/go/operators/paramcontrol/AbstractLinearParamAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/AbstractLinearParamAdaption.java @@ -28,18 +28,22 @@ public abstract class AbstractLinearParamAdaption implements ParamAdaption, Seri @Override public abstract Object clone(); + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { return Mathematics.linearInterpolation(iteration, 0, maxIteration, startV, endV); } + @Override public abstract String getControlledParam(); public String controlledParamTipText() { return "The name of the parameter to be controlled by this adaption scheme."; } + @Override public void init(Object obj, Population pop, Object[] initialValues) { BeanInspector.setMem(obj, getControlledParam(), startV); } + @Override public void finish(Object obj, Population pop) {} public double getStartV() { diff --git a/src/eva2/server/go/operators/paramcontrol/AbstractParameterControl.java b/src/eva2/server/go/operators/paramcontrol/AbstractParameterControl.java index a8f79418..1b6a911f 100644 --- a/src/eva2/server/go/operators/paramcontrol/AbstractParameterControl.java +++ b/src/eva2/server/go/operators/paramcontrol/AbstractParameterControl.java @@ -25,8 +25,10 @@ public abstract class AbstractParameterControl implements InterfaceParameterCont initialValues = o.initialValues.clone(); } + @Override public abstract Object clone(); + @Override public void init(Object obj, Population initialPop) { String[] params = getControlledParameters(); if (params != null) { @@ -35,6 +37,7 @@ public abstract class AbstractParameterControl implements InterfaceParameterCont } } + @Override public void finish(Object obj, Population finalPop) { String[] params = getControlledParameters(); if (params != null) { @@ -42,6 +45,7 @@ public abstract class AbstractParameterControl implements InterfaceParameterCont } } + @Override public void updateParameters(Object obj, Population pop, int iteration, int maxIteration) { String[] params = getControlledParameters(); Object[] vals = getValues(obj, pop, iteration, maxIteration); @@ -55,6 +59,7 @@ public abstract class AbstractParameterControl implements InterfaceParameterCont } } + @Override public void updateParameters(Object obj) { updateParameters(obj, null, -1, -1); } diff --git a/src/eva2/server/go/operators/paramcontrol/CbpsoFitnessThresholdBasedAdaption.java b/src/eva2/server/go/operators/paramcontrol/CbpsoFitnessThresholdBasedAdaption.java index 1269f6fd..f4717496 100644 --- a/src/eva2/server/go/operators/paramcontrol/CbpsoFitnessThresholdBasedAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/CbpsoFitnessThresholdBasedAdaption.java @@ -57,6 +57,7 @@ public class CbpsoFitnessThresholdBasedAdaption implements ParamAdaption, Generi * (non-Javadoc) * @see java.lang.Object#clone() */ + @Override public Object clone() { return new CbpsoFitnessThresholdBasedAdaption(this); } @@ -65,6 +66,7 @@ public class CbpsoFitnessThresholdBasedAdaption implements ParamAdaption, Generi * (non-Javadoc) * @see eva2.server.go.operators.paramcontrol.ParamAdaption#calcValue(java.lang.Object, eva2.server.go.populations.Population, int, int) */ + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { if (obj instanceof CBNPSO) { @@ -123,6 +125,7 @@ public class CbpsoFitnessThresholdBasedAdaption implements ParamAdaption, Generi * (non-Javadoc) * @see eva2.server.go.operators.paramcontrol.ParamAdaption#finish(java.lang.Object, eva2.server.go.populations.Population) */ + @Override public void finish(Object obj, Population pop) { } @@ -131,6 +134,7 @@ public class CbpsoFitnessThresholdBasedAdaption implements ParamAdaption, Generi * (non-Javadoc) * @see eva2.server.go.operators.paramcontrol.ParamAdaption#getControlledParam() */ + @Override public String getControlledParam() { return paramName; } @@ -139,6 +143,7 @@ public class CbpsoFitnessThresholdBasedAdaption implements ParamAdaption, Generi * (non-Javadoc) * @see eva2.server.go.operators.paramcontrol.ParamAdaption#init(java.lang.Object, eva2.server.go.populations.Population, java.lang.Object[]) */ + @Override public void init(Object obj, Population pop, Object[] initialValues) { currentVal=initialVal; lastAdaption=0; @@ -149,6 +154,7 @@ public class CbpsoFitnessThresholdBasedAdaption implements ParamAdaption, Generi * (non-Javadoc) * @see eva2.server.go.operators.paramcontrol.GenericParamAdaption#setControlledParam(java.lang.String) */ + @Override public void setControlledParam(String prm) { paramName = prm; } diff --git a/src/eva2/server/go/operators/paramcontrol/ConstantParameters.java b/src/eva2/server/go/operators/paramcontrol/ConstantParameters.java index f0de7703..91a20e2e 100644 --- a/src/eva2/server/go/operators/paramcontrol/ConstantParameters.java +++ b/src/eva2/server/go/operators/paramcontrol/ConstantParameters.java @@ -22,6 +22,7 @@ public class ConstantParameters extends AbstractParameterControl implements Seri return new ConstantParameters(this); } + @Override public String[] getControlledParameters() { return null; } @@ -31,6 +32,7 @@ public class ConstantParameters extends AbstractParameterControl implements Seri return null; } + @Override public void updateParameters(Object obj) { } diff --git a/src/eva2/server/go/operators/paramcontrol/ConstraintBasedAdaption.java b/src/eva2/server/go/operators/paramcontrol/ConstraintBasedAdaption.java index d71ac957..f6e81057 100644 --- a/src/eva2/server/go/operators/paramcontrol/ConstraintBasedAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/ConstraintBasedAdaption.java @@ -47,10 +47,12 @@ public class ConstraintBasedAdaption implements ParamAdaption, Serializable { // deltaInertness = o.deltaInertness; } + @Override public Object clone() { return new ConstraintBasedAdaption(this); } + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { boolean changed = false; if (!(obj instanceof AbstractConstraint)) System.err.println(this.getClass().getSimpleName() + " cant control " + obj.getClass().getSimpleName() + " ! "); @@ -96,6 +98,7 @@ public class ConstraintBasedAdaption implements ParamAdaption, Serializable { return changed; } + @Override public String getControlledParam() { return target; } @@ -134,11 +137,13 @@ public class ConstraintBasedAdaption implements ParamAdaption, Serializable { return "Adapt a constraint's penalty factor (esp. fitness based) if the population contained only valid or only invalid individuals for some generations."; } + @Override public void finish(Object obj, Population pop) { lastBestSatisfactionState.clear(); ((AbstractConstraint) obj).setPenaltyFactor(initialPenalty); } + @Override public void init(Object obj, Population pop, Object[] initialValues) { initialPenalty = ((AbstractConstraint) obj).getPenaltyFactor(); if (minPenalty > maxPenalty) { diff --git a/src/eva2/server/go/operators/paramcontrol/ExponentialDecayAdaption.java b/src/eva2/server/go/operators/paramcontrol/ExponentialDecayAdaption.java index 983277dc..08e0ed01 100644 --- a/src/eva2/server/go/operators/paramcontrol/ExponentialDecayAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/ExponentialDecayAdaption.java @@ -36,14 +36,17 @@ public class ExponentialDecayAdaption implements ParamAdaption, GenericParamAdap setSaturation(o.getSaturation()); } + @Override public Object clone() { return new ExponentialDecayAdaption(this); } + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { return getSaturation()+(startValue-getSaturation())*Math.pow(0.5, (iteration/(double)maxIteration)*100/halvingTimePerCent); // return startValue*Math.pow(0.5, (iteration/(double)maxIteration)*100/halvingTimePerCent); } + @Override public String getControlledParam() { return target; } @@ -68,6 +71,7 @@ public class ExponentialDecayAdaption implements ParamAdaption, GenericParamAdap return "The number of iterations (usually generations) within which the respecitve value will be halved."; } + @Override public void setControlledParam(String target) { this.target = target; } @@ -80,8 +84,10 @@ public class ExponentialDecayAdaption implements ParamAdaption, GenericParamAdap return "Exponential decay with a percentual halving time."; } + @Override public void finish(Object obj, Population pop) {} + @Override public void init(Object obj, Population pop, Object[] initialValues) {} public static void main(String[] args) { diff --git a/src/eva2/server/go/operators/paramcontrol/LinearParamAdaption.java b/src/eva2/server/go/operators/paramcontrol/LinearParamAdaption.java index fb81974c..51c5aab8 100644 --- a/src/eva2/server/go/operators/paramcontrol/LinearParamAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/LinearParamAdaption.java @@ -29,13 +29,16 @@ implements InterfaceHasUpperDoubleBound, GenericParamAdaption, Serializable { this.target = target; } + @Override public Object clone() { return new LinearParamAdaption(this); } + @Override public String getControlledParam() { return target; } + @Override public void setControlledParam(String target) { this.target = target; } @@ -53,6 +56,7 @@ implements InterfaceHasUpperDoubleBound, GenericParamAdaption, Serializable { * * @return */ + @Override public double getUpperBnd() { return Math.max(getEndV(), getStartV()); } @@ -63,6 +67,7 @@ implements InterfaceHasUpperDoubleBound, GenericParamAdaption, Serializable { * * @param u */ + @Override public void SetUpperBnd(double u) { if (getEndV()==getStartV()) { setEndV(u); diff --git a/src/eva2/server/go/operators/paramcontrol/NoParamAdaption.java b/src/eva2/server/go/operators/paramcontrol/NoParamAdaption.java index feaa3e83..6818e457 100644 --- a/src/eva2/server/go/operators/paramcontrol/NoParamAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/NoParamAdaption.java @@ -12,14 +12,17 @@ import eva2.server.go.populations.Population; */ public class NoParamAdaption implements ParamAdaption, Serializable { + @Override public Object clone() { return new NoParamAdaption(); } + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { return null; } + @Override public String getControlledParam() { return null; } @@ -28,7 +31,9 @@ public class NoParamAdaption implements ParamAdaption, Serializable { return "A dummy implementation which will not change parameters."; } + @Override public void finish(Object obj, Population pop) {} + @Override public void init(Object obj, Population pop, Object[] initialValues) {} } diff --git a/src/eva2/server/go/operators/paramcontrol/PSOActivityFeedbackControl.java b/src/eva2/server/go/operators/paramcontrol/PSOActivityFeedbackControl.java index 68ee4288..7281a391 100644 --- a/src/eva2/server/go/operators/paramcontrol/PSOActivityFeedbackControl.java +++ b/src/eva2/server/go/operators/paramcontrol/PSOActivityFeedbackControl.java @@ -44,10 +44,12 @@ public class PSOActivityFeedbackControl implements ParamAdaption, Serializable { deltaInertness = o.deltaInertness; } + @Override public Object clone() { return new PSOActivityFeedbackControl(this); } + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { if (obj instanceof ParticleSwarmOptimization) { ParticleSwarmOptimization pso = (ParticleSwarmOptimization)obj; @@ -62,6 +64,7 @@ public class PSOActivityFeedbackControl implements ParamAdaption, Serializable { } } + @Override public String getControlledParam() { return target; } @@ -140,8 +143,10 @@ public class PSOActivityFeedbackControl implements ParamAdaption, Serializable { return "Controls the inertness factor based on the average velocity."; } + @Override public void finish(Object obj, Population pop) {} + @Override public void init(Object obj, Population pop, Object[] initialValues) {} public boolean isExponentialSchedule() { diff --git a/src/eva2/server/go/operators/paramcontrol/PSOInertnessAdaption.java b/src/eva2/server/go/operators/paramcontrol/PSOInertnessAdaption.java index 9d88d395..dc6125da 100644 --- a/src/eva2/server/go/operators/paramcontrol/PSOInertnessAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/PSOInertnessAdaption.java @@ -24,10 +24,12 @@ public class PSOInertnessAdaption extends LinearParamAdaption implements Seriali GenericObjectEditor.setHideProperty(this.getClass(), "controlledParam", true); } + @Override public String startVTipText() { return "Start value for the inertness"; } + @Override public String endVTipText() { return "End value for the inertness"; } diff --git a/src/eva2/server/go/operators/paramcontrol/ParameterControlManager.java b/src/eva2/server/go/operators/paramcontrol/ParameterControlManager.java index d99f113d..375e16c3 100644 --- a/src/eva2/server/go/operators/paramcontrol/ParameterControlManager.java +++ b/src/eva2/server/go/operators/paramcontrol/ParameterControlManager.java @@ -50,10 +50,12 @@ public class ParameterControlManager implements InterfaceParameterControl, Seria } } + @Override public Object clone() { return new ParameterControlManager(this); } + @Override public void init(Object obj, Population initialPop) { String[] params = getControlledParameters(); if (params != null) { @@ -77,6 +79,7 @@ public class ParameterControlManager implements InterfaceParameterControl, Seria } } + @Override public void finish(Object obj, Population finalPop) { String[] params = getControlledParameters(); for (ParamAdaption prm : singleAdapters) { @@ -88,6 +91,7 @@ public class ParameterControlManager implements InterfaceParameterControl, Seria } } + @Override public void updateParameters(Object obj, Population pop, int iteration, int maxIteration) { String[] params = getControlledParameters(); Object[] vals = getValues(obj, pop, iteration, maxIteration); @@ -111,6 +115,7 @@ public class ParameterControlManager implements InterfaceParameterControl, Seria } } + @Override public void updateParameters(Object obj) { updateParameters(obj, null, -1, -1); } diff --git a/src/eva2/server/go/operators/paramcontrol/SinusoidalParamAdaption.java b/src/eva2/server/go/operators/paramcontrol/SinusoidalParamAdaption.java index a89521c3..801fd68c 100644 --- a/src/eva2/server/go/operators/paramcontrol/SinusoidalParamAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/SinusoidalParamAdaption.java @@ -55,6 +55,7 @@ public class SinusoidalParamAdaption implements InterfaceHasUpperDoubleBound, Pa updateMed(); } + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { double res=0; double t = (2*Math.PI/iterationPeriod)*(iteration-initialShift); @@ -88,19 +89,24 @@ public class SinusoidalParamAdaption implements InterfaceHasUpperDoubleBound, Pa return Math.pow(t+1, dampeningExp)-1; } + @Override public Object clone() { return new SinusoidalParamAdaption(this); } + @Override public void finish(Object obj, Population pop) { } + @Override public String getControlledParam() { return paramName ; } + @Override public void init(Object obj, Population pop, Object[] initialValues) { } + @Override public void setControlledParam(String prm) { paramName = prm; } @@ -123,6 +129,7 @@ public class SinusoidalParamAdaption implements InterfaceHasUpperDoubleBound, Pa // } // } + @Override public double getUpperBnd() { return upperBnd; } @@ -130,6 +137,7 @@ public class SinusoidalParamAdaption implements InterfaceHasUpperDoubleBound, Pa this.upperBnd = upperBnd; updateMed(); } + @Override public void SetUpperBnd(double u) { this.setUpperBnd(u); } diff --git a/src/eva2/server/go/operators/paramcontrol/SuccessBasedAdaption.java b/src/eva2/server/go/operators/paramcontrol/SuccessBasedAdaption.java index 98840333..1aecd914 100644 --- a/src/eva2/server/go/operators/paramcontrol/SuccessBasedAdaption.java +++ b/src/eva2/server/go/operators/paramcontrol/SuccessBasedAdaption.java @@ -30,10 +30,12 @@ GenericParamAdaption, Serializable { // TODO Auto-generated constructor stub } + @Override public Object clone() { return new SuccessBasedAdaption(this); } + @Override public Object calcValue(Object obj, Population pop, int iteration, int maxIteration) { if (obj instanceof InterfaceOptimizer) { @@ -69,24 +71,30 @@ GenericParamAdaption, Serializable { return ((double)numSucc)/solutions.size(); } + @Override public void finish(Object obj, Population pop) {} + @Override public String getControlledParam() { return paramStr; } + @Override public void init(Object obj, Population pop, Object[] initialValues) { curValue = 0.5*(upperBnd+lowerBnd); } + @Override public void setControlledParam(String prm) { paramStr = prm; } + @Override public void SetUpperBnd(double u) { upperBnd = u; } + @Override public double getUpperBnd() { return upperBnd; } diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java index 31380125..2356723b 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java @@ -46,6 +46,7 @@ public class MetricD1ApproxParetoFront implements eva2.server.go.operators.paret /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricD1ApproxParetoFront(this); } @@ -85,6 +86,7 @@ public class MetricD1ApproxParetoFront implements eva2.server.go.operators.paret /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { double result = 0, min, dist; Population tmpPPO = new Population(); diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java index 9bf44332..872ae2a3 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java @@ -49,6 +49,7 @@ public class MetricD1TrueParetoFront implements eva2.server.go.operators.paretof /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricD1TrueParetoFront(this); } @@ -88,6 +89,7 @@ public class MetricD1TrueParetoFront implements eva2.server.go.operators.paretof /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { double result = 0, min; Population tmpPPO = new Population(); diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java index 0fab3a56..bf4e9dd9 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java @@ -55,6 +55,7 @@ public class MetricErrorRatio implements eva2.server.go.operators.paretofrontmet /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricErrorRatio(this); } @@ -87,6 +88,7 @@ public class MetricErrorRatio implements eva2.server.go.operators.paretofrontmet /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { double result = 0; Population tmpPop = new Population(); diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java index a800a87a..604b6c35 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java @@ -45,6 +45,7 @@ public class MetricMaximumParetoFrontError implements eva2.server.go.operators.p /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricMaximumParetoFrontError(this); } @@ -84,6 +85,7 @@ public class MetricMaximumParetoFrontError implements eva2.server.go.operators.p /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { double result = 0, min, dist; Population tmpPPO = new Population(); diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricOverallNonDominatedVectors.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricOverallNonDominatedVectors.java index d41704df..e360643c 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricOverallNonDominatedVectors.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricOverallNonDominatedVectors.java @@ -27,6 +27,7 @@ public class MetricOverallNonDominatedVectors implements InterfaceParetoFrontMet /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricOverallNonDominatedVectors(this); } @@ -41,6 +42,7 @@ public class MetricOverallNonDominatedVectors implements InterfaceParetoFrontMet /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { Population tmpPop = new Population(); Population tmpPPO = new Population(); diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricS.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricS.java index e9dcdb1b..cf62f5fb 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricS.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricS.java @@ -36,6 +36,7 @@ public class MetricS implements InterfaceParetoFrontMetric, java.io.Serializable /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricS(this); } @@ -54,6 +55,7 @@ public class MetricS implements InterfaceParetoFrontMetric, java.io.Serializable /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { this.m_ObjectiveSpaceRange = problem.getObjectiveSpaceRange(); if (TRACE) System.out.println("Border: " + BeanInspector.toString(m_ObjectiveSpaceRange)); diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java index ebd9ae38..20ef3196 100644 --- a/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java +++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java @@ -55,6 +55,7 @@ public class MetricSWithReference implements InterfaceParetoFrontMetric, java.io /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new MetricSWithReference(this); } @@ -99,6 +100,7 @@ public class MetricSWithReference implements InterfaceParetoFrontMetric, java.io /** This method gives a metric how to evaluate * an achieved Pareto-Front */ + @Override public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem) { this.m_ObjectiveSpaceRange = problem.getObjectiveSpaceRange(); double smetric = this.calculateSMetric(pop, this.m_ObjectiveSpaceRange, this.m_ObjectiveSpaceRange.length); diff --git a/src/eva2/server/go/operators/postprocess/PostProcessParams.java b/src/eva2/server/go/operators/postprocess/PostProcessParams.java index 8a3abafe..495652c6 100644 --- a/src/eva2/server/go/operators/postprocess/PostProcessParams.java +++ b/src/eva2/server/go/operators/postprocess/PostProcessParams.java @@ -68,12 +68,14 @@ public class PostProcessParams implements InterfacePostProcessParams, Serializab /** * @return the postProcess */ + @Override public boolean isDoPostProcessing() { return postProcess; } /** * @param postProcess the postProcess to set */ + @Override public void setDoPostProcessing(boolean postProcess) { this.postProcess = postProcess; GenericObjectEditor.setShowProperty(this.getClass(), "postProcessSteps", postProcess); @@ -85,41 +87,51 @@ public class PostProcessParams implements InterfacePostProcessParams, Serializab GenericObjectEditor.setShowProperty(this.getClass(), "accAssumeConv", postProcess); GenericObjectEditor.setShowProperty(this.getClass(), "accMaxEval", postProcess); } + @Override public String doPostProcessingTipText() { return "Toggle post processing of the solutions."; } /** * @return the postProcessClusterSigma */ + @Override public double getPostProcessClusterSigma() { return postProcessClusterSigma; } /** * @param postProcessClusterSigma the postProcessClusterSigma to set */ + @Override public void setPostProcessClusterSigma(double postProcessClusterSigma) { this.postProcessClusterSigma = postProcessClusterSigma; } + @Override public String postProcessClusterSigmaTipText() { return "Set the sigma parameter for clustering during post processing; set to 0 for no clustering."; } + @Override public String postProcessStepsTipText() { return "The number of HC post processing steps in fitness evaluations."; } + @Override public int getPostProcessSteps() { return postProcessSteps; } + @Override public void setPostProcessSteps(int ppSteps) { postProcessSteps = ppSteps; } + @Override public int getPrintNBest() { return printNBest; } + @Override public void setPrintNBest(int nBest) { printNBest = nBest; } + @Override public String printNBestTipText() { return "Print as many solutions at max; set to -1 to print all"; } @@ -134,19 +146,24 @@ public class PostProcessParams implements InterfacePostProcessParams, Serializab "returned solutions with different thresholds."; } + @Override public PostProcessMethod getPPMethod() { return method; } + @Override public String PPMethodTipText() { return "The method to use for post-processing."; } + @Override public void setPPMethod(PostProcessMethod meth) { method=meth; } + @Override public boolean isWithPlot() { return withPlot; } + @Override public void setWithPlot(boolean withPlot) { this.withPlot = withPlot; } diff --git a/src/eva2/server/go/operators/postprocess/SolutionHistogram.java b/src/eva2/server/go/operators/postprocess/SolutionHistogram.java index de49c619..dcd8b959 100644 --- a/src/eva2/server/go/operators/postprocess/SolutionHistogram.java +++ b/src/eva2/server/go/operators/postprocess/SolutionHistogram.java @@ -91,6 +91,7 @@ public class SolutionHistogram { return Mathematics.sum(histogram); } + @Override public String toString() { return "Hist("+arity+"):"+lBound+"/"+uBound+","+BeanInspector.toString(histogram) + ",Sc:"+getScore()+(arity>1 ? (",Avg.Sc:"+(getScore()/arity)) : ("")); } diff --git a/src/eva2/server/go/operators/selection/SelectAll.java b/src/eva2/server/go/operators/selection/SelectAll.java index a969a690..4814108f 100644 --- a/src/eva2/server/go/operators/selection/SelectAll.java +++ b/src/eva2/server/go/operators/selection/SelectAll.java @@ -23,6 +23,7 @@ public class SelectAll implements InterfaceSelection, java.io.Serializable { this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectAll(this); } @@ -33,6 +34,7 @@ public class SelectAll implements InterfaceSelection, java.io.Serializable { * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -44,6 +46,7 @@ public class SelectAll implements InterfaceSelection, java.io.Serializable { * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -76,6 +79,7 @@ public class SelectAll implements InterfaceSelection, java.io.Serializable { * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -102,6 +106,7 @@ public class SelectAll implements InterfaceSelection, java.io.Serializable { * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectBestIndividuals.java b/src/eva2/server/go/operators/selection/SelectBestIndividuals.java index 29ce64f4..8158bbe3 100644 --- a/src/eva2/server/go/operators/selection/SelectBestIndividuals.java +++ b/src/eva2/server/go/operators/selection/SelectBestIndividuals.java @@ -27,6 +27,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectBestIndividuals(this); } @@ -37,6 +38,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -48,6 +50,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); int currentCriteria = 0, critSize; @@ -151,6 +154,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -176,6 +180,7 @@ public class SelectBestIndividuals implements InterfaceSelection, java.io.Serial * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectBestSingle.java b/src/eva2/server/go/operators/selection/SelectBestSingle.java index 13cd7183..84f8666c 100644 --- a/src/eva2/server/go/operators/selection/SelectBestSingle.java +++ b/src/eva2/server/go/operators/selection/SelectBestSingle.java @@ -30,6 +30,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectBestSingle(this); } @@ -40,6 +41,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -50,6 +52,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); AbstractEAIndividual tmpIndy = null; @@ -104,6 +107,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population availablePartners, int size) { if (excludeSelfAsPartner) { Population newPartners = availablePartners.filter(new Population().addToPop(dad)); @@ -137,6 +141,7 @@ public class SelectBestSingle implements InterfaceSelection, java.io.Serializabl * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectEPTournaments.java b/src/eva2/server/go/operators/selection/SelectEPTournaments.java index 5691e371..c38c767e 100644 --- a/src/eva2/server/go/operators/selection/SelectEPTournaments.java +++ b/src/eva2/server/go/operators/selection/SelectEPTournaments.java @@ -32,6 +32,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectEPTournaments(this); } @@ -42,6 +43,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { int[] best = new int[population.getBestEAIndividual().getFitness().length]; int rand; @@ -85,6 +87,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); int currentCriteria = 0, critSize; @@ -148,6 +151,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -200,6 +204,7 @@ public class SelectEPTournaments implements InterfaceSelection, java.io.Serializ * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectHomologousMate.java b/src/eva2/server/go/operators/selection/SelectHomologousMate.java index 34fcd646..e18265be 100644 --- a/src/eva2/server/go/operators/selection/SelectHomologousMate.java +++ b/src/eva2/server/go/operators/selection/SelectHomologousMate.java @@ -26,6 +26,7 @@ public class SelectHomologousMate extends SelectTournament implements java.io.Se this.m_Metric = (InterfaceDistanceMetric)a.m_Metric.clone(); } + @Override public Object clone() { return (Object) new SelectHomologousMate(this); } @@ -36,6 +37,7 @@ public class SelectHomologousMate extends SelectTournament implements java.io.Se * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -46,6 +48,7 @@ public class SelectHomologousMate extends SelectTournament implements java.io.Se * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population availablePartners, int size) { Population possibleMates = new Population(); @@ -68,6 +71,7 @@ public class SelectHomologousMate extends SelectTournament implements java.io.Se * name to the current object. * @return The name. */ + @Override public String getName() { return "Homologous Mating Selection"; } diff --git a/src/eva2/server/go/operators/selection/SelectMOMAIIDominanceCounter.java b/src/eva2/server/go/operators/selection/SelectMOMAIIDominanceCounter.java index 7e54ac73..ccc8ee17 100644 --- a/src/eva2/server/go/operators/selection/SelectMOMAIIDominanceCounter.java +++ b/src/eva2/server/go/operators/selection/SelectMOMAIIDominanceCounter.java @@ -26,6 +26,7 @@ public class SelectMOMAIIDominanceCounter implements InterfaceSelection, java.io this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMOMAIIDominanceCounter(this); } @@ -36,6 +37,7 @@ public class SelectMOMAIIDominanceCounter implements InterfaceSelection, java.io * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // here i need to calculate the number of donimating solutions for all // individuals that have a MatlabMultipleSolution element @@ -93,6 +95,7 @@ public class SelectMOMAIIDominanceCounter implements InterfaceSelection, java.io * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { return this.m_Selection.selectFrom(population, size); } @@ -103,6 +106,7 @@ public class SelectMOMAIIDominanceCounter implements InterfaceSelection, java.io * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -141,6 +145,7 @@ public class SelectMOMAIIDominanceCounter implements InterfaceSelection, java.io * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectMOMaxiMin.java b/src/eva2/server/go/operators/selection/SelectMOMaxiMin.java index e069f2b6..2fe86d14 100644 --- a/src/eva2/server/go/operators/selection/SelectMOMaxiMin.java +++ b/src/eva2/server/go/operators/selection/SelectMOMaxiMin.java @@ -27,6 +27,7 @@ public class SelectMOMaxiMin implements InterfaceSelection, java.io.Serializable this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMOMaxiMin(this); } @@ -37,6 +38,7 @@ public class SelectMOMaxiMin implements InterfaceSelection, java.io.Serializable * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -48,6 +50,7 @@ public class SelectMOMaxiMin implements InterfaceSelection, java.io.Serializable * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(), tmpPop = (Population)population.clone(); double[] tmpD; @@ -72,6 +75,7 @@ public class SelectMOMaxiMin implements InterfaceSelection, java.io.Serializable * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -110,6 +114,7 @@ public class SelectMOMaxiMin implements InterfaceSelection, java.io.Serializable * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectMONSGAIICrowedTournament.java b/src/eva2/server/go/operators/selection/SelectMONSGAIICrowedTournament.java index 894b48f3..8014e93c 100644 --- a/src/eva2/server/go/operators/selection/SelectMONSGAIICrowedTournament.java +++ b/src/eva2/server/go/operators/selection/SelectMONSGAIICrowedTournament.java @@ -30,6 +30,7 @@ public class SelectMONSGAIICrowedTournament implements InterfaceSelection, java. this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMONSGAIICrowedTournament(this); } @@ -40,6 +41,7 @@ public class SelectMONSGAIICrowedTournament implements InterfaceSelection, java. * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { this.m_Fronts = this.m_NSGAII.getNonDominatedSortedFronts(population); this.m_NSGAII.calculateCrowdingDistance(this.m_Fronts); @@ -52,6 +54,7 @@ public class SelectMONSGAIICrowedTournament implements InterfaceSelection, java. * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -132,6 +135,7 @@ public class SelectMONSGAIICrowedTournament implements InterfaceSelection, java. * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -171,6 +175,7 @@ public class SelectMONSGAIICrowedTournament implements InterfaceSelection, java. * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectMONonDominated.java b/src/eva2/server/go/operators/selection/SelectMONonDominated.java index 8737ddbe..06fb4c16 100644 --- a/src/eva2/server/go/operators/selection/SelectMONonDominated.java +++ b/src/eva2/server/go/operators/selection/SelectMONonDominated.java @@ -24,6 +24,7 @@ public class SelectMONonDominated implements InterfaceSelection, java.io.Seriali this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMONonDominated(this); } @@ -34,6 +35,7 @@ public class SelectMONonDominated implements InterfaceSelection, java.io.Seriali * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -45,6 +47,7 @@ public class SelectMONonDominated implements InterfaceSelection, java.io.Seriali * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); int index = RNG.randomInt(0, population.size()-1); @@ -94,6 +97,7 @@ public class SelectMONonDominated implements InterfaceSelection, java.io.Seriali * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -137,6 +141,7 @@ public class SelectMONonDominated implements InterfaceSelection, java.io.Seriali * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectMOPESA.java b/src/eva2/server/go/operators/selection/SelectMOPESA.java index 76d969af..14bd5c5e 100644 --- a/src/eva2/server/go/operators/selection/SelectMOPESA.java +++ b/src/eva2/server/go/operators/selection/SelectMOPESA.java @@ -29,6 +29,7 @@ public class SelectMOPESA implements InterfaceSelection, java.io.Serializable { this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMOPESA(this); } @@ -39,6 +40,7 @@ public class SelectMOPESA implements InterfaceSelection, java.io.Serializable { * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { this.m_Squeeze = this.m_PESAII.calculateSqueezeFactor(population); } @@ -50,6 +52,7 @@ public class SelectMOPESA implements InterfaceSelection, java.io.Serializable { * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -86,6 +89,7 @@ public class SelectMOPESA implements InterfaceSelection, java.io.Serializable { * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -122,6 +126,7 @@ public class SelectMOPESA implements InterfaceSelection, java.io.Serializable { * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectMOPESAII.java b/src/eva2/server/go/operators/selection/SelectMOPESAII.java index c297b3e2..4d29d92d 100644 --- a/src/eva2/server/go/operators/selection/SelectMOPESAII.java +++ b/src/eva2/server/go/operators/selection/SelectMOPESAII.java @@ -35,6 +35,7 @@ public class SelectMOPESAII implements InterfaceSelection, java.io.Serializable this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMOPESAII(this); } @@ -45,6 +46,7 @@ public class SelectMOPESAII implements InterfaceSelection, java.io.Serializable * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { this.m_Squeeze = this.m_PESAII.calculateSqueezeFactor(population); Hashtable tmpGridBoxes = new Hashtable(); @@ -84,6 +86,7 @@ public class SelectMOPESAII implements InterfaceSelection, java.io.Serializable * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -123,6 +126,7 @@ public class SelectMOPESAII implements InterfaceSelection, java.io.Serializable * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -147,6 +151,7 @@ public class SelectMOPESAII implements InterfaceSelection, java.io.Serializable * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectMOSPEAII.java b/src/eva2/server/go/operators/selection/SelectMOSPEAII.java index a6049752..3f8f0f25 100644 --- a/src/eva2/server/go/operators/selection/SelectMOSPEAII.java +++ b/src/eva2/server/go/operators/selection/SelectMOSPEAII.java @@ -35,6 +35,7 @@ public class SelectMOSPEAII implements InterfaceSelection, java.io.Serializable this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectMOSPEAII(this); } @@ -45,6 +46,7 @@ public class SelectMOSPEAII implements InterfaceSelection, java.io.Serializable * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { m_SPEAFitness = this.m_SPEAII.calculateSPEA(population); } @@ -56,6 +58,7 @@ public class SelectMOSPEAII implements InterfaceSelection, java.io.Serializable * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { // first replace the fitness with the SPEA strength double[][] orgFit = new double[population.size()][]; @@ -114,6 +117,7 @@ public class SelectMOSPEAII implements InterfaceSelection, java.io.Serializable * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -153,6 +157,7 @@ public class SelectMOSPEAII implements InterfaceSelection, java.io.Serializable * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectParticleWheel.java b/src/eva2/server/go/operators/selection/SelectParticleWheel.java index db88b912..c0cdd413 100644 --- a/src/eva2/server/go/operators/selection/SelectParticleWheel.java +++ b/src/eva2/server/go/operators/selection/SelectParticleWheel.java @@ -44,10 +44,12 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectParticleWheel(this); } + @Override public void prepareSelection(Population population) { m_SelProbCalculator.computeSelectionProbability(population, "Fitness", m_ObeyDebsConstViolationPrinciple); } @@ -61,6 +63,7 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -134,6 +137,7 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -161,6 +165,7 @@ public class SelectParticleWheel implements InterfaceSelection, java.io.Serializ * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectRandom.java b/src/eva2/server/go/operators/selection/SelectRandom.java index 266d5bf1..a3fff6e4 100644 --- a/src/eva2/server/go/operators/selection/SelectRandom.java +++ b/src/eva2/server/go/operators/selection/SelectRandom.java @@ -32,6 +32,7 @@ public class SelectRandom implements InterfaceSelection, java.io.Serializable { if (m_ObeyDebsConstViolationPrinciple) System.err.println("Error, replacement selection not supported for constrained selection (SelectRandom)"); } + @Override public Object clone() { return (Object) new SelectRandom(this); } @@ -42,6 +43,7 @@ public class SelectRandom implements InterfaceSelection, java.io.Serializable { * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -53,6 +55,7 @@ public class SelectRandom implements InterfaceSelection, java.io.Serializable { * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -91,6 +94,7 @@ public class SelectRandom implements InterfaceSelection, java.io.Serializable { * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -117,6 +121,7 @@ public class SelectRandom implements InterfaceSelection, java.io.Serializable { * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectTournament.java b/src/eva2/server/go/operators/selection/SelectTournament.java index f79d5eaf..4e57ae26 100644 --- a/src/eva2/server/go/operators/selection/SelectTournament.java +++ b/src/eva2/server/go/operators/selection/SelectTournament.java @@ -32,6 +32,7 @@ public class SelectTournament implements InterfaceSelection, java.io.Serializabl this.m_ObeyDebsConstViolationPrinciple = a.m_ObeyDebsConstViolationPrinciple; } + @Override public Object clone() { return (Object) new SelectTournament(this); } @@ -42,6 +43,7 @@ public class SelectTournament implements InterfaceSelection, java.io.Serializabl * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { // nothing to prepare here } @@ -53,6 +55,7 @@ public class SelectTournament implements InterfaceSelection, java.io.Serializabl * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -102,6 +105,7 @@ public class SelectTournament implements InterfaceSelection, java.io.Serializabl * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -141,6 +145,7 @@ public class SelectTournament implements InterfaceSelection, java.io.Serializabl * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/SelectXProbRouletteWheel.java b/src/eva2/server/go/operators/selection/SelectXProbRouletteWheel.java index ccd5c65d..cb22a357 100644 --- a/src/eva2/server/go/operators/selection/SelectXProbRouletteWheel.java +++ b/src/eva2/server/go/operators/selection/SelectXProbRouletteWheel.java @@ -40,6 +40,7 @@ class treeElement implements java.io.Serializable { } } + @Override public String toString() { if (this.m_Index >= 0) return "Ind:"+this.m_Index; else { @@ -71,6 +72,7 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser this.m_SelProbCalculator = (InterfaceSelectionProbability)a.m_SelProbCalculator.clone(); } + @Override public Object clone() { return (Object) new SelectXProbRouletteWheel(this); } @@ -81,6 +83,7 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser * before hand... * @param population The population that is to be processed. */ + @Override public void prepareSelection(Population population) { this.m_SelProbCalculator.computeSelectionProbability(population, "Fitness", this.m_ObeyDebsConstViolationPrinciple); this.m_TreeRoot = this.buildSelectionTree(population); @@ -94,6 +97,7 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser * @param size The number of Individuals to select * @return The selected population. */ + @Override public Population selectFrom(Population population, int size) { Population result = new Population(); result.setTargetSize(size); @@ -179,6 +183,7 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser * @param size The number of partners needed. * @return The selected partners. */ + @Override public Population findPartnerFor(AbstractEAIndividual dad, Population avaiablePartners, int size) { return this.selectFrom(avaiablePartners, size); } @@ -219,6 +224,7 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser * of Deb * @param b The new state */ + @Override public void setObeyDebsConstViolationPrinciple(boolean b) { this.m_ObeyDebsConstViolationPrinciple = b; } diff --git a/src/eva2/server/go/operators/selection/probability/AbstractSelProb.java b/src/eva2/server/go/operators/selection/probability/AbstractSelProb.java index 712c7540..f3db70a2 100644 --- a/src/eva2/server/go/operators/selection/probability/AbstractSelProb.java +++ b/src/eva2/server/go/operators/selection/probability/AbstractSelProb.java @@ -21,6 +21,7 @@ public abstract class AbstractSelProb implements InterfaceSelectionProbability, * the object * @return the deep clone */ + @Override public abstract Object clone(); /** This method computes the selection probability for each individual @@ -29,6 +30,7 @@ public abstract class AbstractSelProb implements InterfaceSelectionProbability, * @param population The population to compute. * @param input The name of the input. */ + @Override public void computeSelectionProbability(Population population, String[] input, boolean obeyConst) { this.computeSelectionProbability(population, this.preprocess(population, input), obeyConst); } @@ -39,6 +41,7 @@ public abstract class AbstractSelProb implements InterfaceSelectionProbability, * @param population The population to compute. * @param input The name of the input. */ + @Override public void computeSelectionProbability(Population population, String input, boolean obeyConst) { String[] tmp = new String[1]; tmp[0] = input; @@ -51,6 +54,7 @@ public abstract class AbstractSelProb implements InterfaceSelectionProbability, * @param population The population to compute. * @param data The input data as double[][]. */ + @Override public abstract void computeSelectionProbability(Population population, double[][] data, boolean obeyConst); /** This method converts all inputs to a list of double values diff --git a/src/eva2/server/go/operators/selection/probability/SelProbBoltzman.java b/src/eva2/server/go/operators/selection/probability/SelProbBoltzman.java index f1cfcf1e..5849fcc2 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbBoltzman.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbBoltzman.java @@ -27,6 +27,7 @@ public class SelProbBoltzman extends AbstractSelProb implements java.io.Serializ this.m_Q = a.m_Q; } + @Override public Object clone() { return (Object) new SelProbBoltzman(this); } @@ -37,6 +38,7 @@ public class SelProbBoltzman extends AbstractSelProb implements java.io.Serializ * @param population The population to compute. * @param data The input data as double[][]. */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double sum = 0, mean = 0, dev = 0; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/probability/SelProbFitnessSharing.java b/src/eva2/server/go/operators/selection/probability/SelProbFitnessSharing.java index a5f84e8c..710b33b6 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbFitnessSharing.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbFitnessSharing.java @@ -31,6 +31,7 @@ public class SelProbFitnessSharing extends AbstractSelProb implements java.io.Se this.m_SharingDistance = a.m_SharingDistance; } + @Override public Object clone() { return (Object) new SelProbFitnessSharing(this); } @@ -42,6 +43,7 @@ public class SelProbFitnessSharing extends AbstractSelProb implements java.io.Se * @param population The population to compute. * @param data The input data as double[][]. */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { this.m_BasicNormationMethod.computeSelectionProbability(population, data, obeyConst); // now perform fitness sharing diff --git a/src/eva2/server/go/operators/selection/probability/SelProbInvertByMax.java b/src/eva2/server/go/operators/selection/probability/SelProbInvertByMax.java index 78115034..8337f565 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbInvertByMax.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbInvertByMax.java @@ -28,6 +28,7 @@ public class SelProbInvertByMax extends AbstractSelProb { this.maxFit = a.maxFit; } + @Override public Object clone() { return (Object) new SelProbInvertByMax(this); } @@ -38,6 +39,7 @@ public class SelProbInvertByMax extends AbstractSelProb { * @param population The population to compute. * @param data The input data as double[][]. */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double sum = 0; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/probability/SelProbLinearRanking.java b/src/eva2/server/go/operators/selection/probability/SelProbLinearRanking.java index bac6b630..fa495493 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbLinearRanking.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbLinearRanking.java @@ -23,6 +23,7 @@ public class SelProbLinearRanking extends AbstractSelProb implements java.io.Ser this.nappaMinus = a.nappaMinus; } + @Override public Object clone() { return (Object) new SelProbLinearRanking(this); } @@ -33,6 +34,7 @@ public class SelProbLinearRanking extends AbstractSelProb implements java.io.Ser * @param population The population to compute. * @param data The input as double[][] */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double temp; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/probability/SelProbNonLinearRanking.java b/src/eva2/server/go/operators/selection/probability/SelProbNonLinearRanking.java index 45351d85..2395fa6e 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbNonLinearRanking.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbNonLinearRanking.java @@ -26,6 +26,7 @@ public class SelProbNonLinearRanking extends AbstractSelProb implements java.io. this.m_C = a.m_C; } + @Override public Object clone() { return (Object) new SelProbNonLinearRanking(this); } @@ -36,6 +37,7 @@ public class SelProbNonLinearRanking extends AbstractSelProb implements java.io. * @param population The population to compute. * @param data The input as double[][] */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double temp, sum; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/probability/SelProbRanking.java b/src/eva2/server/go/operators/selection/probability/SelProbRanking.java index 3a07d1be..40a36b22 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbRanking.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbRanking.java @@ -19,6 +19,7 @@ public class SelProbRanking extends AbstractSelProb implements java.io.Serializa public SelProbRanking(SelProbRanking a) { } + @Override public Object clone() { return (Object) new SelProbRanking(this); } @@ -29,6 +30,7 @@ public class SelProbRanking extends AbstractSelProb implements java.io.Serializa * @param population The population to compute. * @param data The input as double[][] */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double sum = 0; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/probability/SelProbStandard.java b/src/eva2/server/go/operators/selection/probability/SelProbStandard.java index 8fbad51c..626f9c0c 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbStandard.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbStandard.java @@ -21,6 +21,7 @@ public class SelProbStandard extends AbstractSelProb implements java.io.Serializ public SelProbStandard(SelProbStandard a) { } + @Override public Object clone() { return (Object) new SelProbStandard(this); } @@ -32,6 +33,7 @@ public class SelProbStandard extends AbstractSelProb implements java.io.Serializ * @param population The population to compute. * @param data The input data as double[][]. */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double sum = 0; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/probability/SelProbStandardScaling.java b/src/eva2/server/go/operators/selection/probability/SelProbStandardScaling.java index 85861b01..46e5b4ba 100644 --- a/src/eva2/server/go/operators/selection/probability/SelProbStandardScaling.java +++ b/src/eva2/server/go/operators/selection/probability/SelProbStandardScaling.java @@ -25,6 +25,7 @@ public class SelProbStandardScaling extends AbstractSelProb implements java.io.S this.m_Q = a.m_Q; } + @Override public Object clone() { return (Object) new SelProbStandardScaling(this); } @@ -35,6 +36,7 @@ public class SelProbStandardScaling extends AbstractSelProb implements java.io.S * @param population The population to compute. * @param data The input data as double[][]. */ + @Override public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst) { double sum = 0, min = Double.POSITIVE_INFINITY, max = Double.NEGATIVE_INFINITY, delta; double[] result = new double[data.length]; diff --git a/src/eva2/server/go/operators/selection/replacement/ReplaceDeterministicCrowding.java b/src/eva2/server/go/operators/selection/replacement/ReplaceDeterministicCrowding.java index 2bc6879d..4717bfa3 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplaceDeterministicCrowding.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplaceDeterministicCrowding.java @@ -17,6 +17,7 @@ public class ReplaceDeterministicCrowding implements InterfaceReplacement, java. /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -29,6 +30,7 @@ public class ReplaceDeterministicCrowding implements InterfaceReplacement, java. * @param pop The population * @param sub The subset */ + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { int index = 0; diff --git a/src/eva2/server/go/operators/selection/replacement/ReplacePreselection.java b/src/eva2/server/go/operators/selection/replacement/ReplacePreselection.java index 64d0cdc5..e1c7f42a 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplacePreselection.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplacePreselection.java @@ -15,6 +15,7 @@ public class ReplacePreselection implements InterfaceReplacement, java.io.Serial /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -26,6 +27,7 @@ public class ReplacePreselection implements InterfaceReplacement, java.io.Serial * @param pop The population * @param sub The subset */ + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { AbstractEAIndividual worst = sub.getWorstEAIndividual(); if ((indy.isDominatingDebConstraints(worst)) && (pop.remove(worst))) { diff --git a/src/eva2/server/go/operators/selection/replacement/ReplaceRandom.java b/src/eva2/server/go/operators/selection/replacement/ReplaceRandom.java index 730cb17f..0a2aeb9a 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplaceRandom.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplaceRandom.java @@ -15,6 +15,7 @@ public class ReplaceRandom implements InterfaceReplacement, java.io.Serializable /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -26,6 +27,7 @@ public class ReplaceRandom implements InterfaceReplacement, java.io.Serializable * @param pop The population * @param sub The subset */ + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { int rand = RNG.randomInt(0, pop.size()-1); pop.remove(rand); diff --git a/src/eva2/server/go/operators/selection/replacement/ReplaceWorst.java b/src/eva2/server/go/operators/selection/replacement/ReplaceWorst.java index 8188f553..c94b84b8 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplaceWorst.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplaceWorst.java @@ -15,6 +15,7 @@ public class ReplaceWorst implements InterfaceReplacement, java.io.Serializable /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -26,6 +27,7 @@ public class ReplaceWorst implements InterfaceReplacement, java.io.Serializable * @param pop The population * @param sub The subset */ + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { AbstractEAIndividual worst = pop.getWorstEAIndividual(); if (pop.remove(worst)) { diff --git a/src/eva2/server/go/operators/selection/replacement/ReplaceWorstParent.java b/src/eva2/server/go/operators/selection/replacement/ReplaceWorstParent.java index bf112a29..916190cb 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplaceWorstParent.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplaceWorstParent.java @@ -17,6 +17,7 @@ public class ReplaceWorstParent implements InterfaceReplacement, java.io.Seriali /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -28,6 +29,7 @@ public class ReplaceWorstParent implements InterfaceReplacement, java.io.Seriali * @param pop The population * @param sub The subset */ + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { AbstractEAIndividual worst = sub.getWorstEAIndividual(); if (indy.isDominatingDebConstraints(worst)) { diff --git a/src/eva2/server/go/operators/selection/replacement/ReplacementCrowding.java b/src/eva2/server/go/operators/selection/replacement/ReplacementCrowding.java index a610a6c1..23f2e342 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplacementCrowding.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplacementCrowding.java @@ -34,6 +34,7 @@ public class ReplacementCrowding implements InterfaceReplacement, java.io.Serial /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -46,6 +47,7 @@ public class ReplacementCrowding implements InterfaceReplacement, java.io.Serial * @param pop The population * @param sub The subset */ + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { int index = 0; diff --git a/src/eva2/server/go/operators/selection/replacement/ReplacementNondominatedSortingDistanceCrowding.java b/src/eva2/server/go/operators/selection/replacement/ReplacementNondominatedSortingDistanceCrowding.java index c553c72b..1e1b03c4 100644 --- a/src/eva2/server/go/operators/selection/replacement/ReplacementNondominatedSortingDistanceCrowding.java +++ b/src/eva2/server/go/operators/selection/replacement/ReplacementNondominatedSortingDistanceCrowding.java @@ -20,6 +20,7 @@ import eva2.server.go.populations.Population; public class ReplacementNondominatedSortingDistanceCrowding implements InterfaceReplacement, java.io.Serializable { public class HypervolumeComperator implements Comparator{ + @Override public int compare(AbstractEAIndividual arg0, AbstractEAIndividual arg1) { // TODO Auto-generated method stub Double a0=(Double) arg0.getData("HyperCube"); @@ -48,6 +49,7 @@ public class ReplacementNondominatedSortingDistanceCrowding implements Interface /** The ever present clone method */ + @Override public Object clone() { return new ReplaceRandom(); } @@ -61,6 +63,7 @@ public class ReplacementNondominatedSortingDistanceCrowding implements Interface * @param sub The subset */ @SuppressWarnings("unchecked") + @Override public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub) { diff --git a/src/eva2/server/go/operators/terminators/CombinedTerminator.java b/src/eva2/server/go/operators/terminators/CombinedTerminator.java index 061f2937..bb5151fd 100644 --- a/src/eva2/server/go/operators/terminators/CombinedTerminator.java +++ b/src/eva2/server/go/operators/terminators/CombinedTerminator.java @@ -41,16 +41,19 @@ public class CombinedTerminator implements InterfaceTerminator, Serializable { return "Boolean combination of two terminators."; } + @Override public void init(InterfaceOptimizationProblem prob) { if (t1 != null) t1.init(prob); if (t2 != null) t2.init(prob); msg = "Not terminated."; } + @Override public boolean isTerminated(InterfaceSolutionSet solSet) { return isTerm(solSet); } + @Override public boolean isTerminated(PopulationInterface pop) { return isTerm(pop); } @@ -106,6 +109,7 @@ public class CombinedTerminator implements InterfaceTerminator, Serializable { return ret; } + @Override public String lastTerminationMessage() { return msg; } diff --git a/src/eva2/server/go/operators/terminators/EvaluationTerminator.java b/src/eva2/server/go/operators/terminators/EvaluationTerminator.java index ec387027..425544b9 100644 --- a/src/eva2/server/go/operators/terminators/EvaluationTerminator.java +++ b/src/eva2/server/go/operators/terminators/EvaluationTerminator.java @@ -36,6 +36,7 @@ Serializable { public EvaluationTerminator() { } + @Override public void init(InterfaceOptimizationProblem prob){ msg = "Not terminated."; } @@ -52,10 +53,12 @@ Serializable { m_FitnessCalls = x; } + @Override public boolean isTerminated(InterfaceSolutionSet solSet) { return isTerminated(solSet.getCurrentPopulation()); } + @Override public boolean isTerminated(PopulationInterface pop) { //System.out.println("m_FitnessCalls="+m_FitnessCalls); if (m_FitnessCalls>pop.getFunctionCalls()) return false; @@ -65,10 +68,12 @@ Serializable { } } + @Override public String lastTerminationMessage() { return msg; } + @Override public String toString() { String ret = "EvaluationTerminator,calls="+m_FitnessCalls; return ret; diff --git a/src/eva2/server/go/operators/terminators/FitnessValueTerminator.java b/src/eva2/server/go/operators/terminators/FitnessValueTerminator.java index 455ecf8a..f492dc49 100644 --- a/src/eva2/server/go/operators/terminators/FitnessValueTerminator.java +++ b/src/eva2/server/go/operators/terminators/FitnessValueTerminator.java @@ -37,6 +37,7 @@ Serializable { m_FitnessValue = new double []{0.1}; } + @Override public void init(InterfaceOptimizationProblem prob){ msg = "Not terminated."; } @@ -53,10 +54,12 @@ Serializable { m_FitnessValue = (double[])v.clone(); } + @Override public boolean isTerminated(InterfaceSolutionSet solSet) { return isTerminated(solSet.getCurrentPopulation()); } + @Override public boolean isTerminated(PopulationInterface Pop) { double[] fit = Pop.getBestFitness(); for (int i = 0; i < fit.length; i++) { @@ -66,6 +69,7 @@ Serializable { return true; } + @Override public String lastTerminationMessage() { return msg; } @@ -73,6 +77,7 @@ Serializable { /** * */ + @Override public String toString() { String ret = "FitnessValueTerminator,m_FitnessValue="+m_FitnessValue; return ret; diff --git a/src/eva2/server/go/operators/terminators/HistoryConvergenceTerminator.java b/src/eva2/server/go/operators/terminators/HistoryConvergenceTerminator.java index 3f4af124..3243e2c9 100644 --- a/src/eva2/server/go/operators/terminators/HistoryConvergenceTerminator.java +++ b/src/eva2/server/go/operators/terminators/HistoryConvergenceTerminator.java @@ -41,10 +41,12 @@ public class HistoryConvergenceTerminator implements InterfaceTerminator, Serial return "Converge based on a halting window on a population history."; } + @Override public void init(InterfaceOptimizationProblem prob) { msg = "Not terminated."; } + @Override public boolean isTerminated(PopulationInterface pop) { int histLen = (((Population)pop).getHistory()).size(); boolean res = false; @@ -102,10 +104,12 @@ public class HistoryConvergenceTerminator implements InterfaceTerminator, Serial } } + @Override public boolean isTerminated(InterfaceSolutionSet sols) { return isTerminated(sols.getCurrentPopulation()); } + @Override public String lastTerminationMessage() { return msg; } diff --git a/src/eva2/server/go/operators/terminators/KnownOptimaFoundTerminator.java b/src/eva2/server/go/operators/terminators/KnownOptimaFoundTerminator.java index 47c4bd29..d6e698c8 100644 --- a/src/eva2/server/go/operators/terminators/KnownOptimaFoundTerminator.java +++ b/src/eva2/server/go/operators/terminators/KnownOptimaFoundTerminator.java @@ -27,6 +27,7 @@ public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializ public KnownOptimaFoundTerminator() { } + @Override public void init(InterfaceOptimizationProblem prob) { if (prob != null) { if (prob instanceof InterfaceMultimodalProblemKnown) { @@ -36,10 +37,12 @@ public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializ msg = "Not terminated."; } + @Override public boolean isTerminated(InterfaceSolutionSet solSet) { return isTerm(solSet.getSolutions()); } + @Override public boolean isTerminated(PopulationInterface pop) { EVAERROR.errorMsgOnce("Warning, the KnownOptimaFoundTerminator is supposed to work on a final population."); return isTerm((Population)pop); @@ -53,6 +56,7 @@ public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializ } else return false; } + @Override public String lastTerminationMessage() { return msg; } @@ -75,6 +79,7 @@ public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializ return "The number of optima that need to be found to terminate the optimization."; } + @Override public String toString() { return "KnownOptimaFoundTerminator requiring " + reqOptima + " optima."; } diff --git a/src/eva2/server/go/operators/terminators/PhenotypeConvergenceTerminator.java b/src/eva2/server/go/operators/terminators/PhenotypeConvergenceTerminator.java index dda9d335..69a4d0ce 100644 --- a/src/eva2/server/go/operators/terminators/PhenotypeConvergenceTerminator.java +++ b/src/eva2/server/go/operators/terminators/PhenotypeConvergenceTerminator.java @@ -28,6 +28,7 @@ public class PhenotypeConvergenceTerminator extends PopulationMeasureTerminator // oldPhenNorm = o.oldPhenNorm; } + @Override public void init(InterfaceOptimizationProblem prob) { super.init(prob); // oldPhenNorm = 0; diff --git a/src/eva2/server/go/operators/terminators/PopulationMeasureTerminator.java b/src/eva2/server/go/operators/terminators/PopulationMeasureTerminator.java index 852d0724..51ed237d 100644 --- a/src/eva2/server/go/operators/terminators/PopulationMeasureTerminator.java +++ b/src/eva2/server/go/operators/terminators/PopulationMeasureTerminator.java @@ -103,6 +103,7 @@ Serializable { return "Stop if a convergence criterion has been met."; } + @Override public void init(InterfaceOptimizationProblem prob) { firstTime = true; msg = "Not terminated."; @@ -112,10 +113,12 @@ Serializable { oldPopGens=-1; } + @Override public boolean isTerminated(InterfaceSolutionSet solSet) { return isTerminated(solSet.getCurrentPopulation()); } + @Override public boolean isTerminated(PopulationInterface pop) { if (!firstTime && isStillConverged(pop)) { if (TRACE) System.out.println("Converged at " + pop.getGeneration() + "/" + pop.getFunctionCalls() + ", measure " + calcPopulationMeasure(pop)); @@ -141,6 +144,7 @@ Serializable { */ protected abstract double calcInitialMeasure(PopulationInterface pop); + @Override public String lastTerminationMessage() { return msg; } diff --git a/src/eva2/server/go/populations/Population.java b/src/eva2/server/go/populations/Population.java index fbdfa585..47260b41 100644 --- a/src/eva2/server/go/populations/Population.java +++ b/src/eva2/server/go/populations/Population.java @@ -330,6 +330,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea } } + @Override public Object clone() { return (Object) new Population(this); } diff --git a/src/eva2/server/go/populations/SolutionSet.java b/src/eva2/server/go/populations/SolutionSet.java index 3e2dd6de..0e627a8e 100644 --- a/src/eva2/server/go/populations/SolutionSet.java +++ b/src/eva2/server/go/populations/SolutionSet.java @@ -20,14 +20,17 @@ public class SolutionSet implements InterfaceSolutionSet { sols = p; } + @Override public SolutionSet clone() { return new SolutionSet((Population)pop.clone(), (Population)sols.clone()); } + @Override public Population getSolutions() { return sols; } + @Override public Population getCurrentPopulation() { return pop; } diff --git a/src/eva2/server/go/problems/AbstractDynTransProblem.java b/src/eva2/server/go/problems/AbstractDynTransProblem.java index e395b0b1..bdb7f762 100644 --- a/src/eva2/server/go/problems/AbstractDynTransProblem.java +++ b/src/eva2/server/go/problems/AbstractDynTransProblem.java @@ -43,6 +43,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz * @param individual the individual to be evaluated * @param t timestamp of the evaluation */ + @Override public void evaluateAt(AbstractEAIndividual individual, double time) { /* the fitness ist set by the evaluate function */ AbstractEAIndividual tussy = (AbstractEAIndividual)individual.clone(); @@ -55,6 +56,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz * Override population evaluation to do some data output. * */ + @Override public void evaluatePopulationEnd(Population population) { double delta = transLength(getCurrentProblemTime()); if (isExtraPlot() == true) { @@ -104,6 +106,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz /* * Initializes the underlying problem in the problem class */ + @Override public void initProblem() { super.initProblem(); bestIndividual = null; @@ -117,6 +120,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz * * @param severity the severity of the change (time measure) */ + @Override public void resetProblem(double severity) { if ((prob != null) && (bestIndividual != null)) this.evaluateAt(bestIndividual, getCurrentProblemTime()); @@ -125,6 +129,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz /* inits the population in the problem itself * */ + @Override public void initPopulationAt(Population population, double time) { if (TRACE) System.out.println("DynTransProblem at " + this + " initPop, problem is " + getProblem()); getProblem().initPopulation(population); @@ -139,6 +144,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz /****************************************************************************** * These are for the GUI */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { return "DynTransProblem"; } diff --git a/src/eva2/server/go/problems/AbstractDynamicOptimizationProblem.java b/src/eva2/server/go/problems/AbstractDynamicOptimizationProblem.java index 46277544..ccc5a7c1 100644 --- a/src/eva2/server/go/problems/AbstractDynamicOptimizationProblem.java +++ b/src/eva2/server/go/problems/AbstractDynamicOptimizationProblem.java @@ -104,6 +104,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz * * @param population The populations that is to be inited */ + @Override public void initPopulation(Population population) { //initProblem(); // this shouldnt be necessary this.initPopulationAt(population, getCurrentProblemTime()); @@ -232,6 +233,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz /** This method evaluates a single individual and sets the fitness value at default time stamp 0. * @param individual The individual that is to be evalutated */ + @Override public void evaluate(AbstractEAIndividual individual) { if (problemToChangeAt(getCurrentProblemTime())) { changeProblemAt(getCurrentProblemTime()); @@ -283,6 +285,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz * * @param population the population whi */ + @Override public void evaluatePopulationEnd(Population population) { //System.out.println(">> mean distance at " + population.getFunctionCalls() + " / " + getProblemTime() + " is " + population.getMeanDistance()); //System.out.println("> current best is " + population.getBestFitness()[0]); @@ -334,6 +337,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz * name to the current object. * @return The name. */ + @Override public String getName() { return "AbstractDynamicOptimizationProblem"; } diff --git a/src/eva2/server/go/problems/AbstractMultiModalProblemKnown.java b/src/eva2/server/go/problems/AbstractMultiModalProblemKnown.java index 1b477720..6c9553a5 100644 --- a/src/eva2/server/go/problems/AbstractMultiModalProblemKnown.java +++ b/src/eva2/server/go/problems/AbstractMultiModalProblemKnown.java @@ -72,6 +72,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { /** This method inits a given population * @param population The populations that is to be inited */ + @Override public void initPopulation(Population population) { AbstractEAIndividual tmpIndy; @@ -95,6 +96,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { } } + @Override public void initProblem() { super.initProblem(); this.m_GlobalOpt = Double.NEGATIVE_INFINITY; @@ -107,6 +109,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -209,11 +212,13 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { * method for every optimum, as it keeps track the global optimum. * This method will be called on initialization. */ + @Override public abstract void initListOfOptima(); /** This method returns a list of all optima as population * @return population */ + @Override public Population getRealOptima() { return this.m_ListOfOptima; } @@ -222,6 +227,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { * Return true if the full list of optima is available, else false. * @return */ + @Override public boolean fullListAvailable() { return ((getRealOptima()!=null) && (getRealOptima().size()>0)); } @@ -230,6 +236,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { * @param pop A population of possible solutions. * @return int */ + @Override public int getNumberOfFoundOptima(Population pop) { return getNoFoundOptimaOf(this, pop); } @@ -250,6 +257,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { * @param pop A population of possible solutions. * @return double */ + @Override public double getMaximumPeakRatio(Population pop) { if (!this.fullListAvailable()) return -1; else return getMaximumPeakRatio(this.getRealOptima(), pop, m_Epsilon); @@ -430,6 +438,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown { /** * @param epsilon the m_Epsilon to set */ + @Override public void setDefaultAccuracy(double epsilon) { super.SetDefaultAccuracy(epsilon); } diff --git a/src/eva2/server/go/problems/AbstractMultiObjectiveOptimizationProblem.java b/src/eva2/server/go/problems/AbstractMultiObjectiveOptimizationProblem.java index 9d14e972..ce31e60c 100644 --- a/src/eva2/server/go/problems/AbstractMultiObjectiveOptimizationProblem.java +++ b/src/eva2/server/go/problems/AbstractMultiObjectiveOptimizationProblem.java @@ -60,6 +60,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract this.m_Semaphore=sema; } + @Override public void run() { double[] fitness; prob.evaluate(ind); @@ -138,6 +139,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract /** This method returns a deep clone of the problem. * @return the clone */ + @Override public abstract Object clone(); /** This method inits the Problem to log multiruns for the s-Metric it @@ -145,6 +147,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract * also it is necessary to init the local Pareto-Front and the * problem frame (i'll provide a default implementation here. */ + @Override public void initProblem() { makeBorder(); this.m_ParetoFront = new Population(); @@ -196,11 +199,13 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract this.m_ParetoFront = new Population(); } + @Override public void evaluatePopulationStart(Population population) { super.evaluatePopulationStart(population); if (this.m_Show && (this.m_Plot==null)) this.initProblemFrame(); } + @Override public void evaluatePopulationEnd(Population population) { super.evaluatePopulationEnd(population); double[] fitness; @@ -469,6 +474,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract * plot. A fitness that is to be minimized with a global min of zero * would be best, since log y can be used. But the value can depend on the problem. */ + @Override public Double getDoublePlotValue(Population pop) { if (AbstractMultiObjectiveOptimizationProblem.isPopulationMultiObjective(pop)) { return new Double(this.calculateMetric(pop)); @@ -522,6 +528,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract * (non-Javadoc) * @see eva2.server.go.problems.InterfaceOptimizationProblem#getStringRepresentationForProblem(eva2.server.go.strategies.InterfaceOptimizer) */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { // TODO Auto-generated method stub return null; diff --git a/src/eva2/server/go/problems/AbstractOptimizationProblem.java b/src/eva2/server/go/problems/AbstractOptimizationProblem.java index 79ade13e..efa80be2 100644 --- a/src/eva2/server/go/problems/AbstractOptimizationProblem.java +++ b/src/eva2/server/go/problems/AbstractOptimizationProblem.java @@ -61,6 +61,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial this.m_Semaphore=sema; } + @Override public void run() { // System.out.println("Running ET " + this); // long time=System.nanoTime(); @@ -93,6 +94,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial /** This method returns a deep clone of the problem. * @return the clone */ + @Override public abstract Object clone(); public int getParallelThreads() { @@ -111,6 +113,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * This method initializes the problem instance. * If you override it, make sure to call the super method! */ + @Override public abstract void initProblem(); /******************** The most important methods ****************************************/ @@ -118,12 +121,14 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial /** This method inits a given population * @param population The populations that is to be inited */ + @Override public abstract void initPopulation(Population population); /** This method evaluates a given population and set the fitness values * accordingly * @param population The population that is to be evaluated. */ + @Override public void evaluate(Population population) { AbstractEAIndividual tmpIndy; evaluatePopulationStart(population); @@ -204,6 +209,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial /** This method evaluate a single individual and sets the fitness values * @param individual The individual that is to be evaluated */ + @Override public abstract void evaluate(AbstractEAIndividual individual); /** @@ -234,6 +240,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * @param individual The individual that is to be shown. * @return The description. */ + @Override public String getSolutionRepresentationFor(AbstractEAIndividual individual) { return AbstractEAIndividual.getDefaultStringRepresentation(individual); } @@ -244,6 +251,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * @param pop The population that is to be refined. * @return Double value */ + @Override public Double getDoublePlotValue(Population pop) { return new Double(pop.getBestEAIndividual().getFitness(0)); } @@ -252,6 +260,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * @param pop The population that is to be refined. * @return String */ + @Override public String[] getAdditionalDataHeader() { String[] header = null; if (this instanceof InterfaceInterestingHistogram) header = new String[]{STAT_SOLUTION_HEADER,"histogram","score"}; @@ -292,6 +301,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * @param pop The population that is to be refined. * @return String */ + @Override public String[] getAdditionalDataInfo() { String[] info=null; if (this instanceof InterfaceInterestingHistogram) @@ -310,6 +320,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * @param pop The population that is to be refined. * @return String */ + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { String solStr = AbstractEAIndividual.getDefaultDataString(pop.getBestIndividual()); Object[] vals = null; @@ -353,6 +364,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * @param indy the individual to display * @return JComponent */ + @Override public JComponent drawIndividual(int generation, int funCalls, AbstractEAIndividual indy) { JPanel result = new JPanel(); result.setLayout(new BorderLayout()); @@ -373,6 +385,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * multi-objective * @return True if multi-objective, else false. */ + @Override public boolean isMultiObjective() { if (this instanceof AbstractMultiObjectiveOptimizationProblem) { if (((AbstractMultiObjectiveOptimizationProblem)this).getMOSOConverter() instanceof MOSONoConvert) { @@ -604,6 +617,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial * name to the current object. * @return The name. */ + @Override public String getName() { return "AbstractOptimizationProblem"; } diff --git a/src/eva2/server/go/problems/AbstractParallelOptimizationProblem.java b/src/eva2/server/go/problems/AbstractParallelOptimizationProblem.java index 1cc6f8f7..d29d58b7 100644 --- a/src/eva2/server/go/problems/AbstractParallelOptimizationProblem.java +++ b/src/eva2/server/go/problems/AbstractParallelOptimizationProblem.java @@ -19,6 +19,7 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi private boolean m_Parallelize = false; private AbstractOptimizationProblem[] m_Slaves; + @Override public void initProblem() { if (this.m_Parallelize) { // this is running on remote maschines @@ -63,6 +64,7 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "Parallel Optimization Problem"; } diff --git a/src/eva2/server/go/problems/AbstractProblemBinary.java b/src/eva2/server/go/problems/AbstractProblemBinary.java index c1391154..89205f70 100644 --- a/src/eva2/server/go/problems/AbstractProblemBinary.java +++ b/src/eva2/server/go/problems/AbstractProblemBinary.java @@ -88,6 +88,7 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem * name to the current object. * @return The name. */ + @Override public String getName() { return "AbstractProblemBinary"; } @@ -103,6 +104,7 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("A binary valued problem:\n"); diff --git a/src/eva2/server/go/problems/AbstractProblemDouble.java b/src/eva2/server/go/problems/AbstractProblemDouble.java index 360101c3..a0522c33 100644 --- a/src/eva2/server/go/problems/AbstractProblemDouble.java +++ b/src/eva2/server/go/problems/AbstractProblemDouble.java @@ -138,6 +138,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * * @see eval(double[] x) */ + @Override public void evaluate(AbstractEAIndividual individual) { double[] x; double[] fitness; @@ -216,6 +217,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * the vector to evaluate * @return the target function value */ + @Override public abstract double[] eval(double[] x); /** @@ -223,6 +225,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * * @return the problem dimension */ + @Override public abstract int getProblemDimension(); @Override @@ -238,6 +241,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * * @return a range array */ + @Override public double[][] makeRange() { double[][] range = new double[this.getProblemDimension()][2]; for (int i = 0; i < range.length; i++) { @@ -257,6 +261,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * @param dim * @return the lower bound of the double range in the given dimension */ + @Override public double getRangeLowerBound(int dim) { return -getDefaultRange(); } @@ -271,6 +276,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * @param dim * @return the upper bound of the double range in the given dimension */ + @Override public double getRangeUpperBound(int dim) { return getDefaultRange(); } @@ -349,6 +355,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * * @return the EA individual template currently used */ + @Override public InterfaceDataTypeDouble getEAIndividual() { return (InterfaceDataTypeDouble) this.m_Template; } @@ -408,14 +415,17 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem /********************************************************************************************************************** * These are for Interface2DBorderProblem */ + @Override public double[][] get2DBorder() { return makeRange(); } + @Override public double[] project2DPoint(double[] point) { return Mathematics.expandVector(point, getProblemDimension(), 0.); } + @Override public double functionValue(double[] point) { double[] x = project2DPoint(point); double v = eval(x)[0]; @@ -504,6 +514,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * * @return the name of the object */ + @Override public String getName() { return "AbstractProblemDouble"; } @@ -524,6 +535,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem * The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("A double valued problem: "); diff --git a/src/eva2/server/go/problems/AbstractProblemDoubleOffset.java b/src/eva2/server/go/problems/AbstractProblemDoubleOffset.java index 2cdef645..e45cad44 100644 --- a/src/eva2/server/go/problems/AbstractProblemDoubleOffset.java +++ b/src/eva2/server/go/problems/AbstractProblemDoubleOffset.java @@ -46,6 +46,7 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble * name to the current object. * @return The name. */ + @Override public String getName() { return "Double-valued-Problem+Offsets"; } @@ -82,6 +83,7 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble public void setProblemDimension(int t) { this.m_ProblemDimension = t; } + @Override public int getProblemDimension() { return this.m_ProblemDimension; } diff --git a/src/eva2/server/go/problems/AbstractProblemInteger.java b/src/eva2/server/go/problems/AbstractProblemInteger.java index 3a8137ca..b8773e9b 100644 --- a/src/eva2/server/go/problems/AbstractProblemInteger.java +++ b/src/eva2/server/go/problems/AbstractProblemInteger.java @@ -75,6 +75,7 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem * These are for GUI */ + @Override public String getName() { return "AbstractProblemInteger"; } @@ -90,6 +91,7 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("An integer valued problem:\n"); diff --git a/src/eva2/server/go/problems/AbstractSynchronousOptimizationProblem.java b/src/eva2/server/go/problems/AbstractSynchronousOptimizationProblem.java index 9c2459a2..5bd1d42d 100644 --- a/src/eva2/server/go/problems/AbstractSynchronousOptimizationProblem.java +++ b/src/eva2/server/go/problems/AbstractSynchronousOptimizationProblem.java @@ -44,6 +44,7 @@ public abstract class AbstractSynchronousOptimizationProblem extends } + @Override public void initProblem() { super.initProblem(); evalsSinceChange = 0.; @@ -97,6 +98,7 @@ public abstract class AbstractSynchronousOptimizationProblem extends return constantProblemEvals; } + @Override public void setFrequency(double frequency) { super.setFrequency(frequency); //if (frequency > 1.) System.out.println("warning, frequency should be <= 1 (setFrequency)"); @@ -120,6 +122,7 @@ public abstract class AbstractSynchronousOptimizationProblem extends } + @Override public void evaluatePopulationStart(Population population) { if (isFrequencyRelative()) { // sets the number of evaluations without change when depending on the population size diff --git a/src/eva2/server/go/problems/B1Problem.java b/src/eva2/server/go/problems/B1Problem.java index 9a0342ff..eb2fa806 100644 --- a/src/eva2/server/go/problems/B1Problem.java +++ b/src/eva2/server/go/problems/B1Problem.java @@ -35,6 +35,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new B1Problem(this); } @@ -45,6 +46,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ * @param l The length of the BitSet. * @return Double[] */ + @Override public double[] eval(BitSet b) { double[] result = new double[1]; int fitness = 0; @@ -59,6 +61,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ * @param individual The individual that is to be shown. * @return The description. */ + @Override public String getSolutionRepresentationFor(AbstractEAIndividual individual) { this.evaluate(individual); String result = "Minimize Number of Bits problem:\n"; @@ -71,6 +74,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { String result = ""; @@ -90,6 +94,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ * name to the current object. * @return The name. */ + @Override public String getName() { return "Maximize number of bits"; } @@ -109,6 +114,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ public void setProblemDimension(int dim) { this.m_ProblemDimension = dim; } + @Override public int getProblemDimension() { return this.m_ProblemDimension; } diff --git a/src/eva2/server/go/problems/BKnapsackProblem.java b/src/eva2/server/go/problems/BKnapsackProblem.java index 14cb765f..b0da4914 100644 --- a/src/eva2/server/go/problems/BKnapsackProblem.java +++ b/src/eva2/server/go/problems/BKnapsackProblem.java @@ -140,6 +140,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S this.m_Lamarckism = b.m_Lamarckism; } + @Override public int getProblemDimension() { return items.length; } @@ -147,12 +148,14 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new BKnapsackProblem(this); } /** This method inits the Problem to log multiruns */ + @Override public void initProblem() { // nothing to init here } @@ -173,6 +176,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S /** This method evaluates a single individual and sets the fitness values * @param individual The individual that is to be evalutated */ + @Override public void evaluate(AbstractEAIndividual individual) { BitSet tmpBitSet; double[] result; @@ -247,6 +251,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S * @param l The length of the BitSet. * @return Double[] */ + @Override public double[] eval(BitSet b) { double[] result = new double[3]; @@ -272,6 +277,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S * @param individual The individual that is to be shown. * @return The description. */ + @Override public String getSolutionRepresentationFor(AbstractEAIndividual individual) { BitSet tmpBitSet; double[] report; @@ -293,6 +299,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer result = new StringBuffer(100); @@ -326,6 +333,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S * name to the current object. * @return The name. */ + @Override public String getName() { return "Single Knapsack Problem"; } diff --git a/src/eva2/server/go/problems/ConstrHimmelblauProblem.java b/src/eva2/server/go/problems/ConstrHimmelblauProblem.java index 159e2e8d..c1bc13df 100644 --- a/src/eva2/server/go/problems/ConstrHimmelblauProblem.java +++ b/src/eva2/server/go/problems/ConstrHimmelblauProblem.java @@ -62,6 +62,7 @@ public class ConstrHimmelblauProblem extends AbstractProblemDouble implements Se return 5; } + @Override public String getName() { return "Constrained Himmelblau Problem"; } diff --git a/src/eva2/server/go/problems/DynJumpProblem.java b/src/eva2/server/go/problems/DynJumpProblem.java index 3e575c13..c033a09e 100644 --- a/src/eva2/server/go/problems/DynJumpProblem.java +++ b/src/eva2/server/go/problems/DynJumpProblem.java @@ -44,11 +44,13 @@ public class DynJumpProblem extends AbstractDynTransProblem { other.clone(); } + @Override protected double getTranslation(int dim, double time) { return translation[dim]; } + @Override protected void changeProblemAt(double problemTime) { super.changeProblemAt(problemTime); makeTranslation(); @@ -57,6 +59,7 @@ public class DynJumpProblem extends AbstractDynTransProblem { ++changeCounter; } + @Override protected void countEvaluation() { super.countEvaluation(); evaluations += 1.; @@ -114,6 +117,7 @@ public class DynJumpProblem extends AbstractDynTransProblem { } } + @Override public void initProblem() { super.initProblem(); translation = new double[getProblemDimension()]; @@ -150,10 +154,12 @@ public class DynJumpProblem extends AbstractDynTransProblem { + @Override public Object clone() { return new DynJumpProblem(this); } + @Override public AbstractEAIndividual getCurrentOptimum() { return null; } @@ -163,9 +169,11 @@ public class DynJumpProblem extends AbstractDynTransProblem { * */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { return "DynJumpProblem"; } + @Override public String getName() { return "DynJumpProblem"; } diff --git a/src/eva2/server/go/problems/ExternalRuntimeProblem.java b/src/eva2/server/go/problems/ExternalRuntimeProblem.java index 74a1f3b7..a01ea464 100644 --- a/src/eva2/server/go/problems/ExternalRuntimeProblem.java +++ b/src/eva2/server/go/problems/ExternalRuntimeProblem.java @@ -50,6 +50,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan setDaemon(true); } + @Override public void run() { try { int c; @@ -100,12 +101,14 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new ExternalRuntimeProblem(this); } /** This method inits the Problem to log multiruns */ + @Override public void initProblem() { this.m_OverallBest = null; File f = new File(m_Command); @@ -124,6 +127,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan /** This method inits a given population * @param population The populations that is to be inited */ + @Override public void initPopulation(Population population) { this.m_OverallBest = null; @@ -133,6 +137,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this); } + @Override public double[][] makeRange() { if (m_Range==null) { System.err.println("Warning, range not set in ExternalRuntimeProblem.makeRange!"); @@ -161,10 +166,12 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan return "The domain bounds for the problem"; } + @Override public double getRangeLowerBound(int dim) { return m_Range.getValue(dim,0); } + @Override public double getRangeUpperBound(int dim) { return m_Range.getValue(dim,1); } @@ -173,6 +180,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan /** This method evaluate a single individual and sets the fitness values * @param individual The individual that is to be evaluatated */ + @Override public void evaluate(AbstractEAIndividual individual) { double[] x; // double[] fitness; @@ -250,6 +258,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan return results; } + @Override public double[] eval(double[] x) { if (x==null) throw new RuntimeException("Error, x=null value received in ExternalRuntimeProblem.eval"); ArrayList fitList = new ArrayList(); @@ -294,6 +303,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("External Runtime Problem:\n"); @@ -311,6 +321,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan * name to the current object. * @return The name. */ + @Override public String getName() { return "External Runtime Problem"; } @@ -337,6 +348,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan this.m_Range.adaptRowCount(t); this.m_initRange.adaptRowCount(t); } + @Override public int getProblemDimension() { return this.m_ProblemDimension; } @@ -399,15 +411,19 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan public void setEAIndividual(InterfaceDataTypeDouble indy) { this.m_Template = (AbstractEAIndividual)indy; } + @Override public InterfaceDataTypeDouble getEAIndividual() { return (InterfaceDataTypeDouble)this.m_Template; } + @Override public double functionValue(double[] point) { return eval(project2DPoint(point))[0]; } + @Override public double[] project2DPoint(double[] point) { return Mathematics.expandVector(point, getProblemDimension(), 0.); } + @Override public double[][] get2DBorder() { return getRange().getDoubleArrayShallow(); } @@ -457,6 +473,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan } // @Override + @Override public Object getInitRange() { if (m_initRange==null) { if (m_Range==null) System.err.println("Warning, neither range nor initRange has been set in ExternalRuntimeProblem!"); diff --git a/src/eva2/server/go/problems/F10Problem.java b/src/eva2/server/go/problems/F10Problem.java index 742891a4..c00ea687 100644 --- a/src/eva2/server/go/problems/F10Problem.java +++ b/src/eva2/server/go/problems/F10Problem.java @@ -28,6 +28,7 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F10Problem(this); } @@ -36,6 +37,7 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -80,6 +82,7 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface * name to the current object. * @return The name. */ + @Override public String getName() { return "F10 Problem"; } diff --git a/src/eva2/server/go/problems/F11Problem.java b/src/eva2/server/go/problems/F11Problem.java index 0b5c6817..fe8ec759 100644 --- a/src/eva2/server/go/problems/F11Problem.java +++ b/src/eva2/server/go/problems/F11Problem.java @@ -27,6 +27,7 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F11Problem(this); } @@ -35,6 +36,7 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -70,6 +72,7 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface * name to the current object. * @return The name. */ + @Override public String getName() { return "F11-Problem"; } diff --git a/src/eva2/server/go/problems/F12Problem.java b/src/eva2/server/go/problems/F12Problem.java index 39fc5807..fa125b8f 100644 --- a/src/eva2/server/go/problems/F12Problem.java +++ b/src/eva2/server/go/problems/F12Problem.java @@ -22,6 +22,7 @@ public class F12Problem extends AbstractProblemDoubleOffset implements Serializa /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F12Problem(this); } @@ -30,6 +31,7 @@ public class F12Problem extends AbstractProblemDoubleOffset implements Serializa * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -64,6 +66,7 @@ public class F12Problem extends AbstractProblemDoubleOffset implements Serializa * name to the current object. * @return The name. */ + @Override public String getName() { return "F12 Problem"; } diff --git a/src/eva2/server/go/problems/F13Problem.java b/src/eva2/server/go/problems/F13Problem.java index 42f2b548..e7ab92c1 100644 --- a/src/eva2/server/go/problems/F13Problem.java +++ b/src/eva2/server/go/problems/F13Problem.java @@ -25,6 +25,7 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F13Problem(this); } @@ -49,6 +50,7 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -78,6 +80,7 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface return result; } + @Override public SolutionHistogram getHistogram() { // EVAERROR.errorMsgOnce("Warning: Restore line in getHistogram for evaluation on F13Problem ???"); if (getProblemDimension() < 15) return new SolutionHistogram(0, 800, 16); @@ -92,6 +95,7 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface * name to the current object. * @return The name. */ + @Override public String getName() { return "F13-Problem"; } @@ -103,6 +107,7 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface return "Schwefels sine-root Function (multimodal, 1981). Remember to use range check! Note that rotating the function may make it easier because new, and better, minima may enter the search space."; } + @Override public void setDefaultAccuracy(double v) { super.SetDefaultAccuracy(v); } diff --git a/src/eva2/server/go/problems/F14Problem.java b/src/eva2/server/go/problems/F14Problem.java index bd9bc330..a5672bf0 100644 --- a/src/eva2/server/go/problems/F14Problem.java +++ b/src/eva2/server/go/problems/F14Problem.java @@ -26,10 +26,12 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F14Problem(this); } + @Override public double[] eval(double[] x) { double[] result = new double[1]; double x0 = x[0]-rotationDX-m_XOffset; @@ -80,6 +82,7 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface * name to the current object. * @return The name. */ + @Override public String getName() { return "F14-Problem"; } diff --git a/src/eva2/server/go/problems/F15Problem.java b/src/eva2/server/go/problems/F15Problem.java index 999e6259..2eb3acf8 100644 --- a/src/eva2/server/go/problems/F15Problem.java +++ b/src/eva2/server/go/problems/F15Problem.java @@ -60,12 +60,14 @@ public class F15Problem extends AbstractProblemDouble implements Serializable, I return new F15Problem(this); } + @Override public SolutionHistogram getHistogram() { if (getProblemDimension()<15) return new SolutionHistogram(0, 2, 16); else if (getProblemDimension()<25) return new SolutionHistogram(0, 4, 16); else return new SolutionHistogram(0, 8, 16); } + @Override public String getName() { return "F15-Problem"; } diff --git a/src/eva2/server/go/problems/F16Problem.java b/src/eva2/server/go/problems/F16Problem.java index f0ae0f4c..c0d00b88 100644 --- a/src/eva2/server/go/problems/F16Problem.java +++ b/src/eva2/server/go/problems/F16Problem.java @@ -52,13 +52,16 @@ public class F16Problem extends AbstractProblemDouble implements InterfaceMultim return new F16Problem(this); } + @Override public double getRangeLowerBound(int n) { return 0.25; } + @Override public double getRangeUpperBound(int n) { return 10.; } + @Override public String getName() { return "Vincent"; } @@ -67,6 +70,7 @@ public class F16Problem extends AbstractProblemDouble implements InterfaceMultim return "The Vincent function: Multiple optima with increasing densitiy near the lower bounds, therefore decreasing attractor size. All have an equal best fitness of zero."; } + @Override public SolutionHistogram getHistogram() { return new SolutionHistogram(-0.001, 0.599, 15); // return new SolutionHistogram(-0.001, 0.099, 5); diff --git a/src/eva2/server/go/problems/F17Problem.java b/src/eva2/server/go/problems/F17Problem.java index c1a4cf37..d9999e1b 100644 --- a/src/eva2/server/go/problems/F17Problem.java +++ b/src/eva2/server/go/problems/F17Problem.java @@ -26,6 +26,7 @@ public class F17Problem extends AbstractProblemDouble implements dim=other.dim; } + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] res = new double[1]; @@ -38,6 +39,7 @@ public class F17Problem extends AbstractProblemDouble implements return res; } + @Override public int getProblemDimension() { return dim; } @@ -46,10 +48,12 @@ public class F17Problem extends AbstractProblemDouble implements dim = newDim; } + @Override public Object clone() { return new F17Problem(this); } + @Override public String getName() { return "F17-Problem"; } @@ -58,6 +62,7 @@ public class F17Problem extends AbstractProblemDouble implements return "Bohachevsky function, numerous optima on an oval hyperparabola with similar attractor sizes but decreasing fitness towards the bounds."; } + @Override public SolutionHistogram getHistogram() { if (getProblemDimension()<15) return new SolutionHistogram(-0.5, 7.5, 16); else return new SolutionHistogram(-0.5, 15.5, 16); diff --git a/src/eva2/server/go/problems/F18Problem.java b/src/eva2/server/go/problems/F18Problem.java index 9fa436b6..32ca5920 100644 --- a/src/eva2/server/go/problems/F18Problem.java +++ b/src/eva2/server/go/problems/F18Problem.java @@ -13,6 +13,7 @@ InterfaceMultimodalProblem { dim=other.dim; } + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] res = new double[1]; @@ -24,14 +25,17 @@ InterfaceMultimodalProblem { return res; } + @Override public double getRangeLowerBound(int n) { return 0.; } + @Override public double getRangeUpperBound(int n) { return 1.; } + @Override public int getProblemDimension() { return dim; } @@ -40,10 +44,12 @@ InterfaceMultimodalProblem { dim = newDim; } + @Override public Object clone() { return new F18Problem(this); } + @Override public String getName() { return "F18-Problem"; } diff --git a/src/eva2/server/go/problems/F19Problem.java b/src/eva2/server/go/problems/F19Problem.java index b1189e58..8c6ae444 100644 --- a/src/eva2/server/go/problems/F19Problem.java +++ b/src/eva2/server/go/problems/F19Problem.java @@ -35,6 +35,7 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDe setProblemDimension(d); } + @Override public void initProblem() { super.initProblem(); // if (alphas==null) { @@ -80,6 +81,7 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDe return M[i*dim+j]; } + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] res = new double[1]; @@ -93,6 +95,7 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDe return res; } + @Override public int getProblemDimension() { return dim; } @@ -106,10 +109,12 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDe } } + @Override public Object clone() { return new F19Problem(this); } + @Override public String getName() { return "F19-Problem"; } @@ -118,11 +123,13 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDe return "Fletcher-Powell function with up to 2^n optima from Shir&Baeck, PPSN 2006, after Bäck 1996. Alphas and Matrices A and B are randomly created with a fixed seed."; } + @Override public SolutionHistogram getHistogram() { if (getProblemDimension()<15) return new SolutionHistogram(0, 8, 16); else return new SolutionHistogram(0, 40000, 16); } + @Override public double[] getFirstOrderGradients(double[] x) { x = rotateMaybe(x); double[] res = new double[x.length]; diff --git a/src/eva2/server/go/problems/F1Problem.java b/src/eva2/server/go/problems/F1Problem.java index c5048665..a14e1c79 100644 --- a/src/eva2/server/go/problems/F1Problem.java +++ b/src/eva2/server/go/problems/F1Problem.java @@ -35,6 +35,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2 /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F1Problem(this); } @@ -43,6 +44,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2 * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -58,6 +60,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2 * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("F1 Sphere model:\n"); @@ -78,6 +81,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2 * name to the current object. * @return The name. */ + @Override public String getName() { return "F1-Problem"; } @@ -89,6 +93,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2 return "F1: multidimensional parabola problem"; } + @Override public double[] getFirstOrderGradients(double[] x) { x = rotateMaybe(x); // first order partial derivation in direction x_i is 2*x_i @@ -102,6 +107,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2 /** * If initialRangeRatio<1, produce a reduced initial range in the negative corner of the range. */ + @Override public Object getInitRange() { if (initialRangeRatio<1.) { double[][] gR=makeRange(); diff --git a/src/eva2/server/go/problems/F20Problem.java b/src/eva2/server/go/problems/F20Problem.java index 0d7d627a..57fc7a36 100644 --- a/src/eva2/server/go/problems/F20Problem.java +++ b/src/eva2/server/go/problems/F20Problem.java @@ -78,6 +78,7 @@ public class F20Problem extends AbstractProblemDouble implements Serializable, I return new F20Problem(this); } + @Override public String getName() { return "Rana"+(isDoRotation() ? "-rot" : ""); } @@ -97,6 +98,7 @@ public class F20Problem extends AbstractProblemDouble implements Serializable, I return shiftFit; } + @Override public SolutionHistogram getHistogram() { if (getProblemDimension()==10) { if (getYOffset()==0) return new SolutionHistogram(-5200, -3600, 16); diff --git a/src/eva2/server/go/problems/F21Problem.java b/src/eva2/server/go/problems/F21Problem.java index 65038fdd..81085ea4 100644 --- a/src/eva2/server/go/problems/F21Problem.java +++ b/src/eva2/server/go/problems/F21Problem.java @@ -24,6 +24,7 @@ public class F21Problem extends AbstractProblemDouble implements InterfaceMultim this(); } + @Override public String getName() { return "Langerman-Function"; } @@ -95,6 +96,7 @@ public class F21Problem extends AbstractProblemDouble implements InterfaceMultim * (non-Javadoc) * @see eva2.server.go.problems.AbstractOptimizationProblem#clone() */ + @Override public Object clone() { return new F21Problem(this); } @@ -103,6 +105,7 @@ public class F21Problem extends AbstractProblemDouble implements InterfaceMultim * (non-Javadoc) * @see eva2.server.go.problems.InterfaceInterestingHistogram#getHistogram() */ + @Override public SolutionHistogram getHistogram() { return new SolutionHistogram(0, 0.5, 10); } diff --git a/src/eva2/server/go/problems/F2Problem.java b/src/eva2/server/go/problems/F2Problem.java index 2d8b49fb..e53aeb0c 100644 --- a/src/eva2/server/go/problems/F2Problem.java +++ b/src/eva2/server/go/problems/F2Problem.java @@ -29,6 +29,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F2Problem(this); } @@ -37,6 +38,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -51,6 +53,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL return result; } + @Override public double[] getFirstOrderGradients(double[] x) { x = rotateMaybe(x); int dim = x.length; @@ -90,6 +93,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL * name to the current object. * @return The name. */ + @Override public String getName() { return "F2-Problem"; } @@ -101,6 +105,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL return "Generalized Rosenbrock's function."; } + @Override public void doLocalSearch(Population pop) { if (localSearchOptimizer == null) { initLS(); @@ -115,6 +120,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL localSearchOptimizer.init(); } + @Override public double getLocalSearchStepFunctionCallEquivalent() { double cost = 1; if (this.localSearchOptimizer instanceof GradientDescentAlgorithm) { diff --git a/src/eva2/server/go/problems/F3Problem.java b/src/eva2/server/go/problems/F3Problem.java index 50128676..e70a1897 100644 --- a/src/eva2/server/go/problems/F3Problem.java +++ b/src/eva2/server/go/problems/F3Problem.java @@ -21,6 +21,7 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F3Problem(this); } @@ -29,6 +30,7 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -62,6 +64,7 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se * name to the current object. * @return The name. */ + @Override public String getName() { return "F3 Problem"; } diff --git a/src/eva2/server/go/problems/F4Problem.java b/src/eva2/server/go/problems/F4Problem.java index e2063209..69c31c3e 100644 --- a/src/eva2/server/go/problems/F4Problem.java +++ b/src/eva2/server/go/problems/F4Problem.java @@ -22,6 +22,7 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F4Problem(this); } @@ -30,6 +31,7 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -63,6 +65,7 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab * name to the current object. * @return The name. */ + @Override public String getName() { return "F4 Problem"; } diff --git a/src/eva2/server/go/problems/F5Problem.java b/src/eva2/server/go/problems/F5Problem.java index 7bf81e50..a7ef7927 100644 --- a/src/eva2/server/go/problems/F5Problem.java +++ b/src/eva2/server/go/problems/F5Problem.java @@ -22,6 +22,7 @@ public class F5Problem extends AbstractProblemDoubleOffset implements Serializab /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F5Problem(this); } @@ -30,6 +31,7 @@ public class F5Problem extends AbstractProblemDoubleOffset implements Serializab * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -68,6 +70,7 @@ public class F5Problem extends AbstractProblemDoubleOffset implements Serializab * name to the current object. * @return The name. */ + @Override public String getName() { return "F5 Problem"; } diff --git a/src/eva2/server/go/problems/F6Problem.java b/src/eva2/server/go/problems/F6Problem.java index 24303cbf..0b1729d1 100644 --- a/src/eva2/server/go/problems/F6Problem.java +++ b/src/eva2/server/go/problems/F6Problem.java @@ -32,6 +32,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F6Problem(this); } @@ -40,6 +41,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -51,6 +53,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte return result; } + @Override public double[] getFirstOrderGradients(double[] x) { x = rotateMaybe(x); double[] result = new double[x.length]; @@ -84,6 +87,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte * name to the current object. * @return The name. */ + @Override public String getName() { return "F6-Problem"; } @@ -122,16 +126,19 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte return "Choose Omega."; } + @Override public void setDefaultAccuracy(double acc) { super.SetDefaultAccuracy(acc); } + @Override public SolutionHistogram getHistogram() { if (getProblemDimension() < 15) return new SolutionHistogram(-0.5, 15.5, 16); else if (getProblemDimension() < 25) return new SolutionHistogram(-0.5, 39.5, 16); else return new SolutionHistogram(0, 80, 16); } + @Override public void doLocalSearch(Population pop) { if (localSearchOptimizer == null) { initLS(); @@ -146,6 +153,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte localSearchOptimizer.init(); } + @Override public double getLocalSearchStepFunctionCallEquivalent() { double cost = 1; if (this.localSearchOptimizer instanceof GradientDescentAlgorithm) { diff --git a/src/eva2/server/go/problems/F7Problem.java b/src/eva2/server/go/problems/F7Problem.java index d457d484..67add590 100644 --- a/src/eva2/server/go/problems/F7Problem.java +++ b/src/eva2/server/go/problems/F7Problem.java @@ -38,6 +38,7 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F7Problem(this); } @@ -46,6 +47,7 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab * accordingly * @param population The population that is to be evaluated. */ + @Override public void evaluate(Population population) { AbstractEAIndividual tmpIndy; @@ -68,6 +70,7 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -106,6 +109,7 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab * name to the current object. * @return The name. */ + @Override public String getName() { return "F7 Problem"; } diff --git a/src/eva2/server/go/problems/F8Problem.java b/src/eva2/server/go/problems/F8Problem.java index fb53ad59..2b621f51 100644 --- a/src/eva2/server/go/problems/F8Problem.java +++ b/src/eva2/server/go/problems/F8Problem.java @@ -49,6 +49,7 @@ public class F8Problem extends AbstractProblemDoubleOffset /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F8Problem(this); } @@ -57,6 +58,7 @@ public class F8Problem extends AbstractProblemDoubleOffset * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -104,6 +106,7 @@ public class F8Problem extends AbstractProblemDoubleOffset * name to the current object. * @return The name. */ + @Override public String getName() { return "F8-Problem"; } @@ -114,6 +117,7 @@ public class F8Problem extends AbstractProblemDoubleOffset public static String globalInfo() { return "Ackley's function."; } + @Override public SolutionHistogram getHistogram() { if (getProblemDimension() < 15) return new SolutionHistogram(-0.1, 7.9, 16); else if (getProblemDimension() < 25) return new SolutionHistogram(-0.5, 15.5, 16); @@ -141,18 +145,22 @@ public class F8Problem extends AbstractProblemDoubleOffset // return derivs; // } + @Override public boolean fullListAvailable() { return true; } + @Override public double getMaximumPeakRatio(Population pop) { return AbstractMultiModalProblemKnown.getMaximumPeakRatioMinimization(m_ListOfOptima, pop, getDefaultAccuracy(), 0, 5); } + @Override public int getNumberOfFoundOptima(Population pop) { return AbstractMultiModalProblemKnown.getNoFoundOptimaOf(this, pop); } + @Override public Population getRealOptima() { return m_ListOfOptima; } @@ -180,6 +188,7 @@ public class F8Problem extends AbstractProblemDoubleOffset * This is unfortunately not mentioned in the papers by Shir * and Bäck who still seemed to be able to find 2*n+1... */ + @Override public void initListOfOptima() { if (listOfOptimaNeedsUpdate()) { state_initializing_optima=true; diff --git a/src/eva2/server/go/problems/F9Problem.java b/src/eva2/server/go/problems/F9Problem.java index 72bc38fc..bfada2f4 100644 --- a/src/eva2/server/go/problems/F9Problem.java +++ b/src/eva2/server/go/problems/F9Problem.java @@ -14,6 +14,7 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new F9Problem(this); } @@ -22,6 +23,7 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(double[] x) { x = rotateMaybe(x); double[] result = new double[1]; @@ -54,6 +56,7 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se * name to the current object. * @return The name. */ + @Override public String getName() { return "F9 Problem"; } diff --git a/src/eva2/server/go/problems/FLensProblem.java b/src/eva2/server/go/problems/FLensProblem.java index cb55a8a2..47d9fbd6 100644 --- a/src/eva2/server/go/problems/FLensProblem.java +++ b/src/eva2/server/go/problems/FLensProblem.java @@ -48,10 +48,12 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer { resetView(); } + @Override public void initView(AbstractOptimizationProblem prob) { this.m_LensProblem = (FLensProblem)prob; } + @Override public void resetView() { // this.m_BestFitness = Double.POSITIVE_INFINITY; // this.m_BestVariables = new double[10]; @@ -60,6 +62,7 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer { indiesToPaint = new Population(); } + @Override public void paint(Graphics g) { Shape tmpShape; BufferedImage bufferedImage; @@ -166,6 +169,7 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer { /** This method updates the painted stuff * @param pop The population to use */ + @Override public void updateView(Population pop, boolean showAllIfPossible) { if (showAllIfPossible) { // indiesToPaint=pop; @@ -243,6 +247,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser this.m_Epsilon = b.m_Epsilon; this.m_UseMaterialConst = b.m_UseMaterialConst; } + @Override public Object clone() { return (Object) new FLensProblem(this); } @@ -280,6 +285,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser /** This method inits the Problem to log multiruns */ + @Override public void initProblem() { this.m_OverallBest = null; if (this.m_Show) this.initProblemFrame(); @@ -288,6 +294,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser /** This method inits a given population * @param population The populations that is to be inited */ + @Override public void initPopulation(Population population) { this.m_OverallBest = null; ((InterfaceDataTypeDouble)this.m_Template).setDoubleDataLength(this.m_ProblemDimension); @@ -303,6 +310,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser if (this.m_Show) this.initProblemFrame(); } + @Override public void evaluatePopulationEnd(Population pop) { if (this.m_Show) this.updateProblemFrame(pop); } @@ -310,6 +318,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser /** This method evaluate a single individual and sets the fitness values * @param individual The individual that is to be evalutated */ + @Override public void evaluate(AbstractEAIndividual individual) { double[] x; double[] fitness; @@ -378,6 +387,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser * @param individual The individual that is to be shown. * @return The description. */ + @Override public String getSolutionRepresentationFor(AbstractEAIndividual individual) { this.evaluate(individual); String result = "FX problem:\n"; @@ -401,6 +411,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { String result = ""; @@ -417,6 +428,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser /** This method allows you to request a graphical representation for a given * individual. */ + @Override public JComponent drawIndividual(AbstractEAIndividual indy) { JTextArea tindy = new JTextArea(indy.getStringRepresentation()); JScrollPane pindy = new JScrollPane(tindy); @@ -447,6 +459,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser * name to the current object. * @return The name. */ + @Override public String getName() { return "Lens Problem"; } @@ -562,6 +575,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser * (non-Javadoc) * @see eva2.server.go.problems.InterfaceHasSolutionViewer#getSolutionViewer() */ + @Override public InterfaceSolutionViewer getSolutionViewer() { return m_Panel; } diff --git a/src/eva2/server/go/problems/FM0Problem.java b/src/eva2/server/go/problems/FM0Problem.java index 5a4616c6..46b241e5 100644 --- a/src/eva2/server/go/problems/FM0Problem.java +++ b/src/eva2/server/go/problems/FM0Problem.java @@ -25,11 +25,13 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf // this.m_Extrema[1] = 6; } + @Override public double getRangeUpperBound(int dim) { if (dim == 0) return 2.0; else return 2.8; } + @Override public double getRangeLowerBound(int dim) { return -1*getRangeUpperBound(dim); } @@ -41,6 +43,7 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new FM0Problem(this); } @@ -49,6 +52,7 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] evalUnnormalized(double[] x) { double[] result = new double[1]; result[0] = Math.sin(2*x[0] - 0.5*Math.PI) + 1 + 2*Math.cos(x[1]) + 0.5*x[0]; @@ -59,6 +63,7 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf * if possible and to return quality measures like NumberOfOptimaFound and * the MaximumPeakRatio. This method should be called by the user. */ + @Override public void initListOfOptima() { //this.add2DOptimum((Math.PI - (Math.PI - Math.acos(-1/4.0)) + Math.PI/2.0)/2.0, 0); //this.add2DOptimum((-Math.PI - (Math.PI - Math.acos(-1/4.0)) + Math.PI/2.0)/2.0, 0); @@ -76,6 +81,7 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf * name to the current object. * @return The name. */ + @Override public String getName() { return "M0 Problem"; } diff --git a/src/eva2/server/go/problems/GPFunctionProblem.java b/src/eva2/server/go/problems/GPFunctionProblem.java index a19c46e8..5f95101a 100644 --- a/src/eva2/server/go/problems/GPFunctionProblem.java +++ b/src/eva2/server/go/problems/GPFunctionProblem.java @@ -134,18 +134,22 @@ public class GPFunctionProblem extends AbstractProblemDouble implements Interfac return dim; } + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { return "GP find a function problem"; } + @Override public Object getSensorValue(String sensor) { return PSymbolicRegression.getSensorValue(sensor, pos, null); } + @Override public void setActuatorValue(String actuator, Object parameter) { // nothing to do here } + @Override public GPArea getArea() { return gpArea; } diff --git a/src/eva2/server/go/problems/I1Problem.java b/src/eva2/server/go/problems/I1Problem.java index 4aedb546..0cde4fb8 100644 --- a/src/eva2/server/go/problems/I1Problem.java +++ b/src/eva2/server/go/problems/I1Problem.java @@ -21,6 +21,7 @@ public class I1Problem extends AbstractProblemInteger implements java.io.Seriali /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new I1Problem(this); } @@ -29,6 +30,7 @@ public class I1Problem extends AbstractProblemInteger implements java.io.Seriali * @param x The n-dimensional input vector * @return The m-dimensional output vector. */ + @Override public double[] eval(int[] x) { double[] result = new double[1]; result[0] = 0; @@ -43,6 +45,7 @@ public class I1Problem extends AbstractProblemInteger implements java.io.Seriali * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { String result = ""; @@ -58,6 +61,7 @@ public class I1Problem extends AbstractProblemInteger implements java.io.Seriali * These are for GUI */ + @Override public String getName() { return "I1 Problem"; } diff --git a/src/eva2/server/go/problems/MatlabProblem.java b/src/eva2/server/go/problems/MatlabProblem.java index 37a30bac..a841739b 100644 --- a/src/eva2/server/go/problems/MatlabProblem.java +++ b/src/eva2/server/go/problems/MatlabProblem.java @@ -70,6 +70,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf // currArray = null; } + @Override public Object clone() { return new MatlabProblem(this); } @@ -170,6 +171,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf handler.setMatlabProblem(this); } + @Override public void initProblem() { init(this.problemDimension, dataType, range, initialRange, defTestOut); } @@ -586,6 +588,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf return "Interface problem class for optimization in Matlab, only usable from within Matlab"; } + @Override public void print(String str) { // System.err.println("MP print: " + str); // if (resOutStream==null) { @@ -603,6 +606,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf log(str); } + @Override public void println(String str) { print(str); print("\n"); @@ -629,6 +633,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this); } + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("A general Matlab problem"); @@ -637,11 +642,13 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf return sb.toString(); } + @Override public Object getInitRange() { log("retrieving initial range..., first entry: " + ((initialRange==null) ? "null" : BeanInspector.toString(initialRange[0]))); return initialRange; } + @Override public String getName() { return "MatlabProblem"; } diff --git a/src/eva2/server/go/problems/PSymbolicRegression.java b/src/eva2/server/go/problems/PSymbolicRegression.java index b93c2489..d780ada2 100644 --- a/src/eva2/server/go/problems/PSymbolicRegression.java +++ b/src/eva2/server/go/problems/PSymbolicRegression.java @@ -98,12 +98,14 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new PSymbolicRegression(this); } /** This method inits the Problem to log multiruns */ + @Override public void initProblem() { if (m_TargetFunction == null) m_TargetFunction = new RFKoza_GPI_7_3(); this.m_OverallBest = null; @@ -146,6 +148,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements /** This method inits a given population * @param population The populations that is to be inited */ + @Override public void initPopulation(Population population) { initPopulation(population, this, m_UseInnerConst, m_NumberOfConstants); } @@ -177,6 +180,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements * accordingly * @param population The population that is to be evaluated. */ + @Override public void evaluate(Population population) { AbstractEAIndividual tmpIndy; @@ -216,6 +220,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements * * @param individual The individual that is to be evaluated */ + @Override public void evaluate(AbstractEAIndividual individual) { InterfaceProgram program; double fitness = 0, tmpValue; @@ -272,6 +277,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { String result = "Symbolic Regression Problem"; return result; @@ -285,6 +291,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements * @param sensor The identifier for the sensor. * @return Sensor value */ + @Override public Object getSensorValue(String sensor) { return PSymbolicRegression.getSensorValue(sensor, m_X, m_C); // for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]); @@ -329,6 +336,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements * @param actuator The identifier for the actuator. * @param parameter The actuator parameter. */ + @Override public void setActuatorValue(String actuator, Object parameter) { // no actuators in this problem } @@ -340,6 +348,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements * name to the current object. * @return The name. */ + @Override public String getName() { return "Symbolic Regression problem"; } @@ -432,6 +441,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements ((InterfaceDataTypeProgram)this.m_Template).setProgramDataLength(1); ((InterfaceDataTypeProgram)this.m_Template).SetFunctionArea(tmpArea); } + @Override public GPArea getArea() { if (m_GPArea==null) initProblem(); return this.m_GPArea; diff --git a/src/eva2/server/go/problems/SimpleProblemWrapper.java b/src/eva2/server/go/problems/SimpleProblemWrapper.java index 44a1ca92..9322fe5d 100644 --- a/src/eva2/server/go/problems/SimpleProblemWrapper.java +++ b/src/eva2/server/go/problems/SimpleProblemWrapper.java @@ -75,12 +75,14 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem { } } + @Override public void evaluatePopulationStart(Population population) { if (m_plot != null && (!m_plot.isValid())) { openPlot(); } } + @Override public void evaluatePopulationEnd(Population population) { super.evaluatePopulationEnd(population); repaintCnt += population.size(); @@ -237,6 +239,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem { m_Template = indy; } + @Override public String individualTemplateTipText() { return "Set the individual properties for the optimization"; } @@ -247,6 +250,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem { * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { StringBuffer sb = new StringBuffer(200); sb.append("A wrapped simple problem based on "); @@ -260,6 +264,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem { * name to the current object. * @return The name. */ + @Override public String getName() { return "SimpleProblemWrapper"; } diff --git a/src/eva2/server/go/problems/TF1Problem.java b/src/eva2/server/go/problems/TF1Problem.java index 1618a3bc..a38b43b8 100644 --- a/src/eva2/server/go/problems/TF1Problem.java +++ b/src/eva2/server/go/problems/TF1Problem.java @@ -75,6 +75,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem /** This method returns a deep clone of the problem. * @return the clone */ + @Override public Object clone() { return (Object) new TF1Problem(this); } @@ -82,6 +83,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem /** This method inits a given population * @param population The populations that is to be inited */ + @Override public void initPopulation(Population population) { this.m_ParetoFront = new Population(); @@ -109,6 +111,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem /** This method evaluate a single individual and sets the fitness values * @param individual The individual that is to be evalutated */ + @Override public void evaluate(AbstractEAIndividual individual) { double[] x; double[] fitness; @@ -172,6 +175,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem return result; } + @Override public void drawAdditionalData(Plot plot, Population pop, int index) { AbstractMultiObjectiveOptimizationProblem.drawWithConstraints(plot, pop, m_Border, index); } @@ -180,6 +184,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem * @param opt The Optimizer that is used or had been used. * @return The description. */ + @Override public String getStringRepresentationForProblem(InterfaceOptimizer opt) { String result = ""; @@ -231,6 +236,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem * name to the current object. * @return The name. */ + @Override public String getName() { return "T1 Problem"; } @@ -328,13 +334,16 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem * Singleobjective converter if you choose to. * @param b The new MO2SO converter. */ + @Override public void setMOSOConverter(InterfaceMOSOConverter b) { this.m_MOSOConverter = b; this.m_MOSOConverter.setOutputDimension(this.m_OutputDimension); } + @Override public InterfaceMOSOConverter getMOSOConverter() { return this.m_MOSOConverter; } + @Override public String mOSOConverterTipText() { return "Choose a Multiobjective to Singleobjective converter."; } diff --git a/src/eva2/server/go/problems/WaitForEvARunnable.java b/src/eva2/server/go/problems/WaitForEvARunnable.java index 2302edb0..085b9281 100644 --- a/src/eva2/server/go/problems/WaitForEvARunnable.java +++ b/src/eva2/server/go/problems/WaitForEvARunnable.java @@ -17,6 +17,7 @@ class WaitForEvARunnable implements Runnable { mp.log("Created WaitForEvARunnable " + this + "\n"); } + @Override public void run() { if (runnable != null) { mp.log("\nStarting optimize runnable!\n"); diff --git a/src/eva2/server/go/problems/regression/RFKoza_GPI_10_1.java b/src/eva2/server/go/problems/regression/RFKoza_GPI_10_1.java index c2927c81..357dd5d4 100644 --- a/src/eva2/server/go/problems/regression/RFKoza_GPI_10_1.java +++ b/src/eva2/server/go/problems/regression/RFKoza_GPI_10_1.java @@ -17,6 +17,7 @@ public class RFKoza_GPI_10_1 implements InterfaceRegressionFunction, java.io.Ser } + @Override public Object clone() { return (Object) new RFKoza_GPI_10_1(this); } @@ -25,6 +26,7 @@ public class RFKoza_GPI_10_1 implements InterfaceRegressionFunction, java.io.Ser * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) result += Math.cos(2*x[i]); diff --git a/src/eva2/server/go/problems/regression/RFKoza_GPI_10_2.java b/src/eva2/server/go/problems/regression/RFKoza_GPI_10_2.java index 02edb7e4..05270c68 100644 --- a/src/eva2/server/go/problems/regression/RFKoza_GPI_10_2.java +++ b/src/eva2/server/go/problems/regression/RFKoza_GPI_10_2.java @@ -17,6 +17,7 @@ public class RFKoza_GPI_10_2 implements InterfaceRegressionFunction, java.io.Ser } + @Override public Object clone() { return (Object) new RFKoza_GPI_10_2(this); } @@ -25,6 +26,7 @@ public class RFKoza_GPI_10_2 implements InterfaceRegressionFunction, java.io.Ser * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) result += 3.1416*x[i] + 2.718 * Math.pow(x[i], 2); diff --git a/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3.java b/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3.java index 343fdfa2..0dab1635 100644 --- a/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3.java +++ b/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3.java @@ -17,6 +17,7 @@ public class RFKoza_GPI_7_3 implements InterfaceRegressionFunction, java.io.Seri } + @Override public Object clone() { return (Object) new RFKoza_GPI_7_3(this); } @@ -25,6 +26,7 @@ public class RFKoza_GPI_7_3 implements InterfaceRegressionFunction, java.io.Seri * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) { diff --git a/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3_extended.java b/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3_extended.java index fc5bce9e..06495f43 100644 --- a/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3_extended.java +++ b/src/eva2/server/go/problems/regression/RFKoza_GPI_7_3_extended.java @@ -17,6 +17,7 @@ public class RFKoza_GPI_7_3_extended implements InterfaceRegressionFunction, jav } + @Override public Object clone() { return (Object) new RFKoza_GPI_7_3_extended(this); } @@ -25,6 +26,7 @@ public class RFKoza_GPI_7_3_extended implements InterfaceRegressionFunction, jav * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) result += 0.12345*Math.pow(x[i], 4) + (Math.PI/4)*Math.pow(x[i], 3) + (Math.E/2)*Math.pow(x[i], 2) + 1.23456*Math.pow(x[i], 1); diff --git a/src/eva2/server/go/problems/regression/RFRaidl_F1.java b/src/eva2/server/go/problems/regression/RFRaidl_F1.java index 8be1a78f..3d269d3e 100644 --- a/src/eva2/server/go/problems/regression/RFRaidl_F1.java +++ b/src/eva2/server/go/problems/regression/RFRaidl_F1.java @@ -17,6 +17,7 @@ public class RFRaidl_F1 implements InterfaceRegressionFunction, java.io.Serializ } + @Override public Object clone() { return (Object) new RFRaidl_F1(this); } @@ -25,6 +26,7 @@ public class RFRaidl_F1 implements InterfaceRegressionFunction, java.io.Serializ * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) result += Math.sin(x[i]); diff --git a/src/eva2/server/go/problems/regression/RFRaidl_F2.java b/src/eva2/server/go/problems/regression/RFRaidl_F2.java index 2789cae0..d76b9be9 100644 --- a/src/eva2/server/go/problems/regression/RFRaidl_F2.java +++ b/src/eva2/server/go/problems/regression/RFRaidl_F2.java @@ -17,6 +17,7 @@ public class RFRaidl_F2 implements InterfaceRegressionFunction, java.io.Serializ } + @Override public Object clone() { return (Object) new RFRaidl_F2(this); } @@ -25,6 +26,7 @@ public class RFRaidl_F2 implements InterfaceRegressionFunction, java.io.Serializ * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) result += Math.exp(x[i]/3)*Math.cos(3*x[i])/2; diff --git a/src/eva2/server/go/problems/regression/RFRaidl_F3.java b/src/eva2/server/go/problems/regression/RFRaidl_F3.java index ae6c4c8a..069ed35c 100644 --- a/src/eva2/server/go/problems/regression/RFRaidl_F3.java +++ b/src/eva2/server/go/problems/regression/RFRaidl_F3.java @@ -17,6 +17,7 @@ public class RFRaidl_F3 implements InterfaceRegressionFunction, java.io.Serializ } + @Override public Object clone() { return (Object) new RFRaidl_F3(this); } @@ -25,6 +26,7 @@ public class RFRaidl_F3 implements InterfaceRegressionFunction, java.io.Serializ * @param x Input vector. * @return y the function result. */ + @Override public double evaluateFunction(double[] x) { double result = 0; for (int i = 0; i < x.length; i++) result += Math.log(4+2*Math.sin(x[i]*Math.sin(8*x[i])))*Math.exp(Math.cos(3*x[i])); diff --git a/src/eva2/server/go/strategies/ANPSO.java b/src/eva2/server/go/strategies/ANPSO.java index 61b93921..03c9a383 100644 --- a/src/eva2/server/go/strategies/ANPSO.java +++ b/src/eva2/server/go/strategies/ANPSO.java @@ -167,6 +167,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi * Take care that all properties which may be hidden (and currently are) send a "hide" message to the Java Bean properties. * This is called by PropertySheetPanel in use with the GenericObjectEditor. */ + @Override public void hideHideable() { // hide the following unused properties from the GUI GenericObjectEditor.setHideProperty(getClass(), "subswarmCreationStrategy", true); @@ -195,6 +196,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi this.neighborCntNicheGraphForEdge = o.neighborCntNicheGraphForEdge; } + @Override public Object clone(){ return (Object) new ANPSO(this); } @@ -202,6 +204,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi /********************************************************************************************************************** * inits */ + @Override public void init() { // MOE: wird vor Optimierung / n�chstem multirun 1x aufgerufen super.init(); initMainSwarm(); @@ -557,6 +560,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi /** @tested * (non-Javadoc) @see javaeva.server.oa.go.Strategies.InterfaceOptimizer#optimize() */ + @Override public void optimize() { // System.out.println(BeanInspector.toString(getMainSwarm())); // main swarm: @@ -639,6 +643,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi * Deactivation */ + @Override protected void deactivationEventFor(ParticleSubSwarmOptimization subswarm) { super.deactivationEventFor(subswarm); resetSMatrixEntriesFor(subswarm); @@ -653,6 +658,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi * use this instead of getPopulation.setPopulationSize() * @param size */ + @Override public void setMainSwarmSize(int size){ // set member this.mainSwarmSize = size; @@ -689,6 +695,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi * the actual size of the complete population is accessed via getPopulation().size() * @return a population consisting of copies from the mainswarm and all subswarms. */ + @Override public Population getPopulation() { // construct a metapop with clones from the mainswarm and all subswarms Population metapop = (Population)getMainSwarm().getPopulation().clone(); @@ -772,6 +779,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi /** @tested * plots all subswarms as connected lines to their respective best individual */ + @Override protected void plotSubSwarms() { if (this.m_Problem instanceof Interface2DBorderProblem) { //DPointSet popRep = new DPointSet(); @@ -858,6 +866,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi * This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "ANPSO-"+getMainSwarmSize(); } diff --git a/src/eva2/server/go/strategies/BOA.java b/src/eva2/server/go/strategies/BOA.java index 16f5cabc..dcf1289e 100644 --- a/src/eva2/server/go/strategies/BOA.java +++ b/src/eva2/server/go/strategies/BOA.java @@ -131,10 +131,12 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { this.printTimestamps = b.printTimestamps; } + @Override public Object clone() { return new BOA(this); } + @Override public String getName() { return "Bayesian Optimization Algorithm"; } @@ -156,6 +158,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { // !printExtraOutput); } + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; @@ -170,6 +173,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { } } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener == ea) { @@ -241,6 +245,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { this.edgeRate = new int[this.probDim][this.probDim]; } + @Override public void init() { defaultInit(); this.problem.initPopulation(this.population); @@ -254,6 +259,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { } } + @Override public void initByPopulation(Population pop, boolean reset) { if (reset) { init(); @@ -531,6 +537,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { } } + @Override public void optimize() { this.problem.evaluatePopulationStart(this.population); // get the best individuals from the population @@ -579,38 +586,47 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable { this.m_Listener.registerPopulationStateChanged(this, name); } + @Override public Population getPopulation() { return this.population; } + @Override public void setPopulation(Population pop) { this.population = pop; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(this.population); } + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.problem = (AbstractOptimizationProblem) problem; } + @Override public InterfaceOptimizationProblem getProblem() { return this.problem; } + @Override public String getStringRepresentation() { return "Bayesian Network"; } + @Override public void freeWilly() { } diff --git a/src/eva2/server/go/strategies/BinaryScatterSearch.java b/src/eva2/server/go/strategies/BinaryScatterSearch.java index 09ddbbb9..aeb4d0ca 100644 --- a/src/eva2/server/go/strategies/BinaryScatterSearch.java +++ b/src/eva2/server/go/strategies/BinaryScatterSearch.java @@ -138,19 +138,23 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ /** * @return a copy of the current BinaryScatterSearch */ + @Override public Object clone(){ return new BinaryScatterSearch(this); } + @Override public String getName() { return "BSS"; } + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -194,12 +198,14 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ this.refSet.setNotifyEvalInterval(this.generationCycle); } + @Override public void init() { defaultInit(); initRefSet(diversify()); this.firePropertyChangedEvent(Population.nextGenerationPerformed); } + @Override public void initByPopulation(Population pop, boolean reset) { defaultInit(); initRefSet(diversify(pop)); @@ -664,6 +670,7 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ } } + @Override public void optimize() { problem.evaluatePopulationStart(refSet); int funCallsStart = this.refSet.getFunctionCalls(); @@ -706,10 +713,12 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ problem.evaluatePopulationEnd(refSet); } + @Override public Population getPopulation() { return this.refSet; } + @Override public void setPopulation(Population pop) { this.refSet = pop; this.refSetSize = pop.getTargetSize(); @@ -719,30 +728,37 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ return "The Population"; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(this.refSet); } + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.problem = (AbstractOptimizationProblem) problem; } + @Override public InterfaceOptimizationProblem getProblem() { return this.problem; } + @Override public String getStringRepresentation() { return "BinaryScatterSearch"; } + @Override public void freeWilly() { // TODO Auto-generated method stub @@ -752,6 +768,7 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ if (this.m_Listener != null) this.m_Listener.registerPopulationStateChanged(this, name); } + @Override public void registerPopulationStateChanged(Object source, String name) { // The events of the interim hill climbing population will be caught here if (name.compareTo(Population.funCallIntervalReached) == 0) { diff --git a/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java b/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java index 3194674b..5c2b69d9 100644 --- a/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java +++ b/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java @@ -62,10 +62,12 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S this.m_PopulSelectionOperator = (InterfaceSelection)a.m_PopulSelectionOperator.clone(); } + @Override public Object clone() { return (Object) new CHCAdaptiveSearchAlgorithm(this); } + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); AbstractEAIndividual tmpIndy = ((AbstractEAIndividual)(this.m_Population.get(0))); @@ -83,6 +85,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) this.m_Population.init(); @@ -191,6 +194,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S this.evaluatePopulation(this.m_Population); } + @Override public void optimize() { Population nextGeneration, tmp; //AbstractEAIndividual elite; @@ -218,9 +222,11 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S this.firePropertyChangedEvent(Population.nextGenerationPerformed); } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -238,9 +244,11 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -249,6 +257,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "CHC Adaptive Search Algorithm:\n"; @@ -261,9 +270,11 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -271,6 +282,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -287,6 +299,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "CHC"; } @@ -296,9 +309,11 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -306,6 +321,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/ClusterBasedNichingEA.java b/src/eva2/server/go/strategies/ClusterBasedNichingEA.java index 8a2b38b4..e06ceed4 100644 --- a/src/eva2/server/go/strategies/ClusterBasedNichingEA.java +++ b/src/eva2/server/go/strategies/ClusterBasedNichingEA.java @@ -176,10 +176,12 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis this.m_maxSpeciesSize = a.m_maxSpeciesSize; } + @Override public Object clone() { return (Object) new ClusterBasedNichingEA(this); } + @Override public void init() { if (m_Undifferentiated==null) this.m_Undifferentiated = new Population(m_PopulationSize); else { @@ -235,6 +237,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Undifferentiated = (Population)pop.clone(); if (reset) this.m_Undifferentiated.init(); @@ -513,6 +516,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis return retPop; } + @Override public void optimize() { Population reinitPop = null; if (TRACE_STATE) { @@ -951,13 +955,16 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis * @param source The source of the event. * @param name Could be used to indicate the nature of the event. */ + @Override public void registerPopulationStateChanged(Object source, String name) { //Population population = ((InterfaceOptimizer)source).getPopulation(); } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -972,10 +979,12 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; this.m_Optimizer.setProblem(this.m_Problem); } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -984,6 +993,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Genetic Algorithm:\n"; @@ -996,9 +1006,11 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -1006,6 +1018,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -1022,10 +1035,12 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "CBN-EA"; } + @Override public Population getPopulation() { // this.m_Population = (Population)m_Undifferentiated.clone(); // for (int i = 0; i < this.m_Species.size(); i++) this.m_Population.addPopulation((Population)this.m_Species.get(i)); @@ -1033,6 +1048,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Undifferentiated = pop; if (m_Archive==null) m_Archive = new Population(); @@ -1057,6 +1073,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis return (Population)m_Archive.clone(); } + @Override public SolutionSet getAllSolutions() { // return inactive species Population sols = getArchivedSolutions(); @@ -1290,11 +1307,13 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis return "If fitness improves less than this value within the halting window, convergence is assumed. May be set to zero."; } + @Override public String[] getAdditionalDataHeader() { return new String[]{"numUndiff","numActSpec","avgSpecMeas","numArchived", "archivedMedCorr", "archivedMeanDist", "numCollisions", "clustSig"}; } + @Override public String[] getAdditionalDataInfo() { return new String[] { "The number of exploring individuals in the main population", @@ -1308,6 +1327,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis }; } + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { // int actives = countActiveSpec(); return new Object[] { diff --git a/src/eva2/server/go/strategies/ClusteringHillClimbing.java b/src/eva2/server/go/strategies/ClusteringHillClimbing.java index 7fc4364f..31c43cdd 100644 --- a/src/eva2/server/go/strategies/ClusteringHillClimbing.java +++ b/src/eva2/server/go/strategies/ClusteringHillClimbing.java @@ -84,6 +84,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { loopCnt = 0; } + @Override public Object clone() { return (Object) new ClusteringHillClimbing(this); } @@ -97,9 +98,11 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { setLocalSearchMethod(getLocalSearchMethod()); } + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -107,16 +110,20 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -124,6 +131,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { return true; } else return false; } + @Override public void init() { loopCnt = 0; mutator = new MutateESFixedStepSize(initialStepSize); @@ -140,6 +148,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { loopCnt = 0; this.m_Population = (Population)pop.clone(); @@ -157,6 +166,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { if (this.m_Listener != null) this.m_Listener.registerPopulationStateChanged(this, name); } + @Override public void optimize() { double improvement; @@ -219,6 +229,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { } + @Override public void registerPopulationStateChanged(Object source, String name) { // The events of the interim hill climbing population will be caught here if (name.compareTo(Population.funCallIntervalReached) == 0) { @@ -240,9 +251,11 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -250,6 +263,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { return "Change the number of starting individuals stored (Cluster-HC)."; } + @Override public InterfaceSolutionSet getAllSolutions() { Population tmp = new Population(); tmp.addPopulation(archive); @@ -264,6 +278,7 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { StringBuffer sbuf = new StringBuffer("Clustering Hill Climbing"); sbuf.append(", initial pop size: "); @@ -274,8 +289,10 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { return sbuf.toString(); } + @Override public void freeWilly() {} + @Override public String getName() { return "ClustHC-"+initialPopSize+"-"+localSearchMethod; } @@ -425,14 +442,17 @@ InterfaceOptimizer, Serializable, InterfaceAdditionalPopulationInformer { return "Set the method to be used for the hill climbing as local search"; } + @Override public String[] getAdditionalDataHeader() { return new String[]{"numIndies", "sigma", "numArchived", "archivedMeanDist"}; } + @Override public String[] getAdditionalDataInfo() { return new String[]{"The current population size", "Current step size in case of stochastic HC", "Number of archived solutions", "Mean distance of archived solutions"}; } + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { return new Object[]{m_Population.size(), mutator.getSigma(), archive.size(), archive.getPopulationMeasures()[0]}; } diff --git a/src/eva2/server/go/strategies/DifferentialEvolution.java b/src/eva2/server/go/strategies/DifferentialEvolution.java index 2d871908..8ed0f04f 100644 --- a/src/eva2/server/go/strategies/DifferentialEvolution.java +++ b/src/eva2/server/go/strategies/DifferentialEvolution.java @@ -94,10 +94,12 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial this.compareToParent = a.compareToParent; } + @Override public Object clone() { return (Object) new DifferentialEvolution(this); } + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); // children = new Population(m_Population.size()); @@ -113,6 +115,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -448,6 +451,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial } } + @Override public void optimize() { if (generational) optimizeGenerational(); else optimizeSteadyState(); @@ -638,12 +642,14 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { if(this.m_Listener ==null){ this.m_Listener=new Vector(); } this.m_Listener.add(ea); } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener!=null&&m_Listener.removeElement(ea)) { @@ -665,9 +671,11 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = (AbstractOptimizationProblem)problem; } + @Override public InterfaceOptimizationProblem getProblem () { return (InterfaceOptimizationProblem)this.m_Problem; } @@ -676,6 +684,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Differential Evolution:\n"; @@ -687,9 +696,11 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial /** This method allows you to set an identifier for the algorithm * @param name The identifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -697,6 +708,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -712,6 +724,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "DE"; } @@ -721,9 +734,11 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -731,6 +746,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { Population pop = getPopulation(); return new SolutionSet(pop, pop); diff --git a/src/eva2/server/go/strategies/DynamicParticleSwarmOptimization.java b/src/eva2/server/go/strategies/DynamicParticleSwarmOptimization.java index 99aac038..815ca2df 100644 --- a/src/eva2/server/go/strategies/DynamicParticleSwarmOptimization.java +++ b/src/eva2/server/go/strategies/DynamicParticleSwarmOptimization.java @@ -82,6 +82,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization changeDetectStrategy.setSelectedAs(a.changeDetectStrategy); } + @Override public Object clone() { return (Object) new DynamicParticleSwarmOptimization(this); } @@ -89,6 +90,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization /** * Call all methods that may hide anything, cf. PSO */ + @Override public void hideHideable() { super.hideHideable(); setQuantumRatio(quantumRatio); @@ -177,6 +179,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization } } + @Override protected void plotIndy(double[] curPosition, double[] curVelocity, int index) { if (this.m_Show) { if (plotBestOnly) { @@ -346,6 +349,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization * @param popSize the size of the population * @return the speed limit of the individual */ + @Override protected double getSpeedLimit(int index) { if (index >= ((double)(m_Population.size() * highEnergyRatio))) return m_SpeedLimit; else { @@ -355,6 +359,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization } /////////////////////////////////////////// these are called from the optimize loop + @Override protected void startOptimize() { super.startOptimize(); if (detectAnchor >= 0) { // set the new detection anchor individual @@ -368,6 +373,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { super.initByPopulation(pop, reset); double quantumCount = 0.; @@ -389,6 +395,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization * @param pop The current population. * @param best The best individual found so far. */ + @Override protected void updateIndividual(int index, AbstractEAIndividual indy, Population pop) { if (index != detectAnchor) { // only for non anchor individuals (its -1 if other detect strategy is used) if (indy instanceof InterfaceDataTypeDouble) { @@ -414,6 +421,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization * given problem. * @param population The population that is to be evaluated */ + @Override protected void evaluatePopulation(Population population) { envHasChanged = false; super.evaluatePopulation(population); @@ -433,10 +441,12 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization // } } + @Override protected boolean isIndividualToUpdate(AbstractEAIndividual indy) { return (envHasChanged || super.isIndividualToUpdate(indy)); } + @Override protected void logBestIndividual() { // log the best individual of the population if (envHasChanged || (this.m_Population.getBestEAIndividual().isDominatingDebConstraints(this.m_BestIndividual))) { @@ -480,6 +490,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization if (detectAnchor>=pop.size()) detectAnchor=0; } + @Override public void init() { super.init(); setEmaPeriods(15); @@ -487,6 +498,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization } + @Override public void setProblem (InterfaceOptimizationProblem problem) { super.setProblem(problem); if (problem instanceof AbstractOptimizationProblem) { @@ -498,6 +510,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { StringBuilder strB = new StringBuilder(200); strB.append("Dynamic Particle Swarm Optimization:\nOptimization Problem: "); @@ -520,6 +533,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "DynPSO"; } diff --git a/src/eva2/server/go/strategies/EsDpiNiching.java b/src/eva2/server/go/strategies/EsDpiNiching.java index 9e6cde28..7e7f9271 100644 --- a/src/eva2/server/go/strategies/EsDpiNiching.java +++ b/src/eva2/server/go/strategies/EsDpiNiching.java @@ -220,10 +220,12 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface GenericObjectEditor.setHideProperty(this.getClass(), "population", true); } + @Override public Object clone() { return new EsDpiNiching(this); } + @Override public void init() { convCount = 0; // reset number of converged species (found peaks) collisions = 0; // reset the number of collisions @@ -372,6 +374,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface return "Activate online adaption of the number of expected peaks"; } + @Override public void optimize() { Population peakPopSet[]; if (increaseExpectedPeaksCriterion() > 0) { @@ -1018,6 +1021,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface return "The number of additional explorer peaks."; } + @Override public String getName() { return identifier + "_" + getExpectedPeaks() + "_" + getNicheRadius(); } @@ -1028,11 +1032,13 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface + "in parallel, which are reclustered in each iteration based on the dynamic peak set."; } + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (ea.equals(m_Listener)) { @@ -1043,9 +1049,11 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface } } + @Override public void freeWilly() { } + @Override public InterfaceSolutionSet getAllSolutions() { Population peaks = new Population(peakOpts.length); for (int i = 0; i < peakOpts.length; i++) { @@ -1058,31 +1066,38 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface return new SolutionSet(getPopulation(), peaks); } + @Override public String getIdentifier() { return identifier; } + @Override public void setIdentifier(String name) { identifier = name; } + @Override public void setPopulation(Population pop) { // this might cause problems if the pop.size() does not fit the EsDpiNiching parameters mu/lamba per peak this.population = pop; } + @Override public Population getPopulation() { return population; } + @Override public InterfaceOptimizationProblem getProblem() { return problem; } + @Override public void setProblem(InterfaceOptimizationProblem prob) { this.problem = prob; } + @Override public String getStringRepresentation() { StringBuffer sb = new StringBuffer("EsDpiNiching:\n"); sb.append("Optimization Problem: "); @@ -1092,6 +1107,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface return sb.toString(); } + @Override public void initByPopulation(Population pop, boolean reset) { // int pSize = pop.size(); this.population = (Population) pop.clone(); @@ -1240,16 +1256,19 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface return "If fitness std. dev. changes less than this value within the halting window, convergence is assumed."; } + @Override public String[] getAdditionalDataHeader() { return new String[]{"nicheRadius", "numExpectedPeaks", "numArchived", "archivedMeanDist", "numCollisions"}; } + @Override public String[] getAdditionalDataInfo() { return new String[]{"The niche radius employed for Dynamic Peak Identificatio", "The number of expected peaks", "The number of stored potential local optima", "Mean distance of archived solutions", "The number of collisions detected so far"}; } + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { return new Object[]{getNicheRadius(), getExpectedPeaks(), archive.size(), archive.getPopulationMeasures()[0], collisions}; } @@ -1287,6 +1306,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface return "Indicate whether already known (archived) peaks should trigger a reset of close-by species (corresp. to niche radius)."; } + @Override public void registerPopulationStateChanged(Object source, String name) { if (getPopulation() != source) { System.err.println("Warning, mismatching population in " + this.getClass().getName()); diff --git a/src/eva2/server/go/strategies/EvolutionStrategies.java b/src/eva2/server/go/strategies/EvolutionStrategies.java index a6ba1040..2de15c22 100644 --- a/src/eva2/server/go/strategies/EvolutionStrategies.java +++ b/src/eva2/server/go/strategies/EvolutionStrategies.java @@ -85,10 +85,12 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ // GenericObjectEditor.setHideProperty(this.getClass(), "population", true); } + @Override public Object clone() { return (Object) new EvolutionStrategies(this); } + @Override public void init() { checkPopulationConstraints(); population.putData(esMuParam, getMu()); @@ -103,6 +105,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { origPopSize = pop.getTargetSize(); this.population = (Population) pop.clone(); @@ -268,10 +271,12 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * * @param problem */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.optimizationProblem = problem; } + @Override public InterfaceOptimizationProblem getProblem() { return this.optimizationProblem; } @@ -282,6 +287,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Evolution Strategies:\n"; @@ -323,10 +329,12 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.identifier = name; } + @Override public String getIdentifier() { return this.identifier; } @@ -335,6 +343,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * This method is required to free the memory on a RMIServer, but there is * nothing to implement. */ + @Override public void freeWilly() { } @@ -360,6 +369,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * * @return The name of the algorithm */ + @Override public String getName() { return "(" + getMu() + (isPlusStrategy() ? "+" : ",") + getLambda() + ")-ES"; } @@ -371,6 +381,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ * * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.population; } @@ -380,6 +391,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ this.population = pop; } + @Override public void setPopulation(Population pop) { origPopSize = pop.size(); this.population = pop; @@ -389,6 +401,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/EvolutionStrategyIPOP.java b/src/eva2/server/go/strategies/EvolutionStrategyIPOP.java index 6999c857..a9bf9c01 100644 --- a/src/eva2/server/go/strategies/EvolutionStrategyIPOP.java +++ b/src/eva2/server/go/strategies/EvolutionStrategyIPOP.java @@ -75,10 +75,12 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf if (other.fitConvTerm != null) fitConvTerm = new FitnessConvergenceTerminator(other.fitConvTerm); } + @Override public Object clone() { return new EvolutionStrategyIPOP(this); } + @Override public void optimize() { // Population nextGeneration, parents; // @@ -111,6 +113,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf } } + @Override public void hideHideable() { GenericObjectEditor.setHideProperty(this.getClass(), "population", true); setStagnationTimeUserDef(isStagnationTimeUserDef()); @@ -141,12 +144,14 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf getProblem().evaluate(getPopulation()); } + @Override protected void firePropertyChangedEvent(String name) { if (name.equals(Population.funCallIntervalReached)) { super.firePropertyChangedEvent(Population.nextGenerationPerformed); } else {} // nothing, evt is produced in #registerPopulationStateChanged, dont forward original due to changing pop size } + @Override public void init() { // setMu(initialMu); if (getMu()>initialLambda) { @@ -224,6 +229,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf * * @return A solution set of the current population and possibly earlier solutions */ + @Override public SolutionSet getAllSolutions() { Population sols = getPopulation().cloneWithoutInds(); if (bestList != null) sols.addAll(bestList); @@ -234,6 +240,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf return solSet; } + @Override public void registerPopulationStateChanged(Object source, String name) { if (name.equals(Population.funCallIntervalReached)) { getPopulation().SetFunctionCalls(((Population)source).getFunctionCalls()); // TODO this is ugly @@ -243,6 +250,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf } } + @Override public String getName() { return getIncPopSizeFact()+"-IPOP-ES"; } @@ -362,6 +370,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataHeader() */ + @Override public String[] getAdditionalDataHeader() { return new String[] {"numArchived", "archivedMeanDist", "lambda"}; } @@ -370,6 +379,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataInfo() */ + @Override public String[] getAdditionalDataInfo() { return new String[] {"Number of archived solutions", "Mean distance of archived solutions", "Current population size parameter lambda"}; } @@ -378,6 +388,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf * (non-Javadoc) * @see eva2.server.go.problems.InterfaceAdditionalPopulationInformer#getAdditionalDataValue(eva2.server.go.PopulationInterface) */ + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { return new Object[]{(bestList==null) ? ((int)0) : bestList.size(), (getMeanArchivedDist()), getLambda()}; } diff --git a/src/eva2/server/go/strategies/EvolutionaryProgramming.java b/src/eva2/server/go/strategies/EvolutionaryProgramming.java index 050d6058..a69d94e4 100644 --- a/src/eva2/server/go/strategies/EvolutionaryProgramming.java +++ b/src/eva2/server/go/strategies/EvolutionaryProgramming.java @@ -43,10 +43,12 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri this.m_EnvironmentSelection = (InterfaceSelection)a.m_EnvironmentSelection.clone(); } + @Override public Object clone() { return (Object) new EvolutionaryProgramming(this); } + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.evaluatePopulation(this.m_Population); @@ -57,6 +59,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri /** This method will init the optimizer with a given population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -94,6 +97,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri return result; } + @Override public void optimize() { Population nextGeneration, parents; @@ -112,9 +116,11 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -131,9 +137,11 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -142,6 +150,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Evolutionary Programming:\n"; @@ -153,9 +162,11 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -163,6 +174,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -178,6 +190,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "EP"; } @@ -187,9 +200,11 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -197,6 +212,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/FloodAlgorithm.java b/src/eva2/server/go/strategies/FloodAlgorithm.java index a13c9032..64e14637 100644 --- a/src/eva2/server/go/strategies/FloodAlgorithm.java +++ b/src/eva2/server/go/strategies/FloodAlgorithm.java @@ -49,12 +49,14 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable this.m_DrainRate = a.m_DrainRate; } + @Override public Object clone() { return (Object) new FloodAlgorithm(this); } /** This method will init the HillClimber */ + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.m_Problem.evaluate(this.m_Population); @@ -65,6 +67,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method will init the optimizer with a given population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -77,6 +80,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method will optimize */ + @Override public void optimize() { AbstractEAIndividual indy; Population original = (Population)this.m_Population.clone(); @@ -120,9 +124,11 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -168,9 +174,11 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -188,6 +196,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; if (this.m_Population.size() > 1) result += "Multi(" + this.m_Population.size() + ")-Start Hill Climbing:\n"; @@ -200,9 +209,11 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -210,6 +221,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -225,6 +237,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "MS-FA"; } @@ -234,9 +247,11 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -245,6 +260,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/GeneticAlgorithm.java b/src/eva2/server/go/strategies/GeneticAlgorithm.java index de3f45c6..84ccb88b 100644 --- a/src/eva2/server/go/strategies/GeneticAlgorithm.java +++ b/src/eva2/server/go/strategies/GeneticAlgorithm.java @@ -245,6 +245,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl * This method is required to free the memory on a RMIServer, but there is * nothing to implement. */ + @Override public void freeWilly() { } diff --git a/src/eva2/server/go/strategies/GradientDescentAlgorithm.java b/src/eva2/server/go/strategies/GradientDescentAlgorithm.java index 339c8070..bcc01c97 100644 --- a/src/eva2/server/go/strategies/GradientDescentAlgorithm.java +++ b/src/eva2/server/go/strategies/GradientDescentAlgorithm.java @@ -61,6 +61,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser private static final String changesKey = "gdaChangesDataKey"; private static final String oldParamsKey = "gdaOldParamsDataKey"; + @Override public void initByPopulation(Population pop, boolean reset) { this.setPopulation((Population) pop.clone()); if (reset) { @@ -95,15 +96,18 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser maximumabsolutechange = maxAbsoluteChange; } + @Override public Object clone() { /**@todo Implement InterfaceOptimizer method*/ throw new java.lang.UnsupportedOperationException("Method clone() not yet implemented."); } + @Override public String getName() { return "GradientDescentAlgorithm"; } + @Override public void init() { //System.out.println("init() called "); // indyhash = new Hashtable(); @@ -115,6 +119,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser return (val < 0) ? -1 : 1; } + @Override public void optimize() { // System.out.println("opt. called"); AbstractEAIndividual indy; @@ -295,14 +300,17 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser if (this.m_Listener != null)this.m_Listener.registerPopulationStateChanged(this, name); } + @Override public Population getPopulation() { return this.m_Population; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } + @Override public void setPopulation(Population pop) { // Hashtable newindyhash = new Hashtable(); // for (int i = 0; i < pop.size(); i++) { @@ -316,30 +324,37 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } + @Override public void setProblem(InterfaceOptimizationProblem problem) { m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem() { return m_Problem; } + @Override public String getStringRepresentation() { return "GradientDescentAlgorithm"; } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -362,6 +377,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser } } + @Override public void freeWilly() { } public static String globalInfo() { diff --git a/src/eva2/server/go/strategies/HillClimbing.java b/src/eva2/server/go/strategies/HillClimbing.java index 8849fb26..df675f34 100644 --- a/src/eva2/server/go/strategies/HillClimbing.java +++ b/src/eva2/server/go/strategies/HillClimbing.java @@ -46,18 +46,21 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { this.m_Problem = (InterfaceOptimizationProblem)a.m_Problem.clone(); } + @Override public Object clone() { return (Object) new HillClimbing(this); } /** This method will init the HillClimber */ + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.m_Problem.evaluate(this.m_Population); this.firePropertyChangedEvent(Population.nextGenerationPerformed); } + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -69,6 +72,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { /** This method will optimize */ + @Override public void optimize() { AbstractEAIndividual indy; Population original = (Population)this.m_Population.clone(); @@ -128,9 +132,11 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -176,9 +182,11 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -196,6 +204,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; if (this.m_Population.size() > 1) result += "Multi(" + this.m_Population.size() + ")-Start Hill Climbing:\n"; @@ -208,9 +217,11 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -218,6 +229,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -233,16 +245,20 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "MS-HC"+getIdentifier(); } + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/IslandModelEA.java b/src/eva2/server/go/strategies/IslandModelEA.java index 2cf7cffe..0509b013 100644 --- a/src/eva2/server/go/strategies/IslandModelEA.java +++ b/src/eva2/server/go/strategies/IslandModelEA.java @@ -83,10 +83,12 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I this.m_localOnly = a.m_localOnly; } + @Override public Object clone() { return (Object) new IslandModelEA(this); } + @Override public void init() { if (this.m_Show) { if (this.m_Plot == null) { @@ -154,6 +156,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** This method will init the optimizer with a given population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population tpop, boolean reset) { // TODO this is again evil copy&paste style if (this.m_Show) { @@ -215,6 +218,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** The optimize method will compute an 'improved' and evaluated population */ + @Override public void optimize() { for (int i = 0; i < this.m_Islands.length; i++) { if (this.m_Islands[i].getPopulation().size() > 0) { @@ -278,9 +282,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -297,10 +303,12 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; this.m_Optimizer.setProblem(problem); } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -309,6 +317,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Island Model Evolutionary Algorithm:\n"; @@ -390,9 +399,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -415,6 +426,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { for (int i = 0; i < this.m_Islands.length; i++) { this.m_Islands[i].freeWilly(); @@ -428,6 +440,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I * @param source The source of the event. * @param name Could be used to indicate the nature of the event. */ + @Override public void registerPopulationStateChanged(Object source, String name) { InterfaceOptimizer opt = (InterfaceOptimizer)source; int sourceID = new Integer(opt.getIdentifier()).intValue(); @@ -452,6 +465,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "IslandEA"; } @@ -543,9 +557,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop) { // @todo Jetzt m�sste ich die pop auch auf die Rechner verteilen... this.m_Population = pop; @@ -554,6 +570,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I return "(Defunct)"; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/MemeticAlgorithm.java b/src/eva2/server/go/strategies/MemeticAlgorithm.java index 54cbaeea..118e00fe 100644 --- a/src/eva2/server/go/strategies/MemeticAlgorithm.java +++ b/src/eva2/server/go/strategies/MemeticAlgorithm.java @@ -87,6 +87,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, return new MemeticAlgorithm(this); } + @Override public void initByPopulation(Population pop, boolean reset) { this.setPopulation((Population) pop.clone()); if (reset) { @@ -96,6 +97,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, } } + @Override public void init() { // counter = 0; this.m_GlobalOptimizer.setProblem(this.m_Problem); @@ -115,6 +117,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, population.incrGeneration(); } + @Override public void optimize() { if (TRACE) System.out.println("global search"); @@ -199,10 +202,12 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * * @param ea */ + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -225,11 +230,13 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * * @param problem */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.m_Problem = problem; this.m_GlobalOptimizer.setProblem(this.m_Problem); } + @Override public InterfaceOptimizationProblem getProblem() { return this.m_Problem; } @@ -240,6 +247,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Memetic Algorithm:\n"; @@ -255,10 +263,12 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * @param name * The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -267,6 +277,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * This method is required to free the memory on a RMIServer, but there is * nothing to implement. */ + @Override public void freeWilly() { } @@ -291,6 +302,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * * @return The name of the algorithm */ + @Override public String getName() { return "MemeticAlgorithm"; } @@ -301,10 +313,12 @@ public class MemeticAlgorithm implements InterfaceOptimizer, * * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_GlobalOptimizer.getPopulation(); } + @Override public void setPopulation(Population pop) { this.m_GlobalOptimizer.setPopulation(pop); } @@ -362,6 +376,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer, return "Choose the interval between the application of the local search."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/MonteCarloSearch.java b/src/eva2/server/go/strategies/MonteCarloSearch.java index 49559184..c56de6a7 100644 --- a/src/eva2/server/go/strategies/MonteCarloSearch.java +++ b/src/eva2/server/go/strategies/MonteCarloSearch.java @@ -50,12 +50,14 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl this.m_Problem = (InterfaceOptimizationProblem)a.m_Problem.clone(); } + @Override public Object clone() { return (Object) new MonteCarloSearch(this); } /** This method will init the MonteCarloSearch */ + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.m_Problem.evaluate(this.m_Population); @@ -66,6 +68,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -79,6 +82,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl * This method will optimize without specific operators, by just calling the individual method * for initialization. */ + @Override public void optimize() { Population original = (Population)this.m_Population.clone(); @@ -103,9 +107,11 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -151,9 +157,11 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -171,6 +179,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Monte-Carlo Search:\n"; @@ -182,9 +191,11 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -192,6 +203,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -207,6 +219,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "MCS"; } @@ -215,9 +228,11 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -225,6 +240,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl return "Change the number of best individuals stored."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/MultiObjectiveCMAES.java b/src/eva2/server/go/strategies/MultiObjectiveCMAES.java index e93b58d0..b3755532 100644 --- a/src/eva2/server/go/strategies/MultiObjectiveCMAES.java +++ b/src/eva2/server/go/strategies/MultiObjectiveCMAES.java @@ -61,6 +61,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { m_lambda = a.m_lambda; } + @Override public MultiObjectiveCMAES clone() { return new MultiObjectiveCMAES(this); } @@ -77,6 +78,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * eva2.server.go.strategies.InterfaceOptimizer#setIdentifier(java.lang. * String) */ + @Override public void setIdentifier(String name) { m_Identifier = name; } @@ -88,6 +90,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * eva2.server.go.strategies.InterfaceOptimizer#SetProblem(eva2.server.go * .problems.InterfaceOptimizationProblem) */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { m_Problem = (AbstractOptimizationProblem) problem; } @@ -97,6 +100,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @param ea */ + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; @@ -107,6 +111,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#freeWilly() */ + @Override public void freeWilly() { } @@ -115,6 +120,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#getAllSolutions() */ + @Override public InterfaceSolutionSet getAllSolutions() { Population pop = getPopulation(); return new SolutionSet(pop, pop); @@ -125,6 +131,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#getIdentifier() */ + @Override public String getIdentifier() { return m_Identifier; } @@ -134,6 +141,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#getName() */ + @Override public String getName() { return "(1+" + m_lambda + ") MO-CMA-ES"; } @@ -147,6 +155,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#getPopulation() */ + @Override public Population getPopulation() { return m_Population; } @@ -156,6 +165,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#getProblem() */ + @Override public InterfaceOptimizationProblem getProblem() { return m_Problem; } @@ -166,6 +176,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * @see * eva2.server.go.strategies.InterfaceOptimizer#getStringRepresentation() */ + @Override public String getStringRepresentation() { StringBuilder strB = new StringBuilder(200); strB.append("(1+" + m_lambda + ") MO-CMA-ES:\nOptimization Problem: "); @@ -180,6 +191,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#init() */ + @Override public void init() { // initByPopulation(m_Population, true); this.m_Population.setTargetSize(m_lambdamo); @@ -197,6 +209,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * eva2.server.go.strategies.InterfaceOptimizer#initByPopulation(eva2.server * .go.populations.Population, boolean) */ + @Override public void initByPopulation(Population pop, boolean reset) { setPopulation(pop); if (reset) { @@ -221,6 +234,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * * @see eva2.server.go.strategies.InterfaceOptimizer#optimize() */ + @Override public void optimize() { HashMap SuccessCounterMap = new HashMap(); @@ -359,6 +373,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * removePopulationChangedEventListener * (eva2.server.go.InterfacePopulationChangedEventListener) */ + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { return false; @@ -371,6 +386,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable { * eva2.server.go.strategies.InterfaceOptimizer#setPopulation(eva2.server * .go.populations.Population) */ + @Override public void setPopulation(Population pop) { m_Population = pop; m_Population.setNotifyEvalInterval(1); diff --git a/src/eva2/server/go/strategies/MultiObjectiveEA.java b/src/eva2/server/go/strategies/MultiObjectiveEA.java index 931b01e3..d66d7854 100644 --- a/src/eva2/server/go/strategies/MultiObjectiveEA.java +++ b/src/eva2/server/go/strategies/MultiObjectiveEA.java @@ -70,10 +70,12 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl setProblem(problem); } + @Override public Object clone() { return (Object) new MultiObjectiveEA(this); } + @Override public void init() { this.m_Optimizer.init(); this.m_Archiver.addElementsToArchive(this.m_Optimizer.getPopulation()); @@ -85,6 +87,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Optimizer.initByPopulation(pop, reset); this.m_Archiver.addElementsToArchive(this.m_Optimizer.getPopulation()); @@ -93,6 +96,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl /** The optimize method will compute a 'improved' and evaluated population */ + @Override public void optimize() { // double[][] may = this.showMay(this.m_Optimizer.getPopulation()); // This is in total compliance with Koch's framework nice isn't it? @@ -152,10 +156,12 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl return result; } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -171,10 +177,12 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; this.m_Optimizer.setProblem(problem); } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -183,6 +191,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Multi-Objective Evolutionary Algorithm:\n"; @@ -201,9 +210,11 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -211,6 +222,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -226,6 +238,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "MOEA"; } @@ -235,9 +248,11 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Optimizer.getPopulation(); } + @Override public void setPopulation(Population pop){ this.m_Optimizer.setPopulation(pop); } @@ -245,6 +260,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl return "Edit the properties of the Population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation(), ArchivingNSGAII.getNonDominatedSortedFront(getPopulation().getArchive()).getSortedPop(new AbstractEAIndividualComparator(0))); } diff --git a/src/eva2/server/go/strategies/NelderMeadSimplex.java b/src/eva2/server/go/strategies/NelderMeadSimplex.java index b8ee45c8..0efdf824 100644 --- a/src/eva2/server/go/strategies/NelderMeadSimplex.java +++ b/src/eva2/server/go/strategies/NelderMeadSimplex.java @@ -54,14 +54,17 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte m_Identifier = a.m_Identifier; } + @Override public NelderMeadSimplex clone() { return new NelderMeadSimplex(this); } + @Override public void setIdentifier(String name) { m_Identifier = name; } + @Override public void setProblem(InterfaceOptimizationProblem problem) { m_Problem = (AbstractOptimizationProblem)problem; } @@ -81,6 +84,7 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte return false; } + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (ea!=null) { @@ -89,12 +93,14 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte } } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==null) return false; else return m_Listener.remove(ea); } + @Override public void freeWilly() {} protected double[] calcChallengeVect(double[] centroid, double[] refX) { @@ -204,10 +210,12 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte return e_ind; } + @Override public String getIdentifier() { return m_Identifier; } + @Override public String getName() { return m_Identifier; } @@ -216,14 +224,17 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte return "The Nelder-Mead simplex search algorithm for local search. Reflection on bounds may be used for constraint handling."; } + @Override public Population getPopulation() { return m_Population; } + @Override public InterfaceOptimizationProblem getProblem() { return m_Problem; } + @Override public String getStringRepresentation() { StringBuilder strB = new StringBuilder(200); strB.append("Nelder-Mead-Simplex Strategy:\nOptimization Problem: "); @@ -233,10 +244,12 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte return strB.toString(); } + @Override public void init() { initByPopulation(m_Population, true); } + @Override public void initByPopulation(Population pop, boolean reset) { setPopulation(pop); pop.addPopulationChangedEventListener(this); @@ -254,6 +267,7 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte } } + @Override public void optimize() { // make at least as many calls as there are individuals within the population. // this simulates the generational loop expected by some other modules @@ -291,12 +305,14 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte this.m_Population.incrGeneration(); } + @Override public void setPopulation(Population pop) { m_Population = pop; m_Population.addPopulationChangedEventListener(this); m_Population.setNotifyEvalInterval(populationSize); } + @Override public InterfaceSolutionSet getAllSolutions() { Population pop = getPopulation(); return new SolutionSet(pop, pop); @@ -324,6 +340,7 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte return "The population size should be adapted to the dimensions of the problem (e.g. n+1)"; } + @Override public void registerPopulationStateChanged(Object source, String name) { if (name.compareTo(Population.funCallIntervalReached) == 0) { fireNextGenerationPerformed(); diff --git a/src/eva2/server/go/strategies/NicheGraph.java b/src/eva2/server/go/strategies/NicheGraph.java index 6799205d..0bf9b559 100644 --- a/src/eva2/server/go/strategies/NicheGraph.java +++ b/src/eva2/server/go/strategies/NicheGraph.java @@ -38,6 +38,7 @@ public class NicheGraph implements java.io.Serializable { this.set = (HashSet)o.set.clone(); } + @Override public Object clone(){ return (Object) new NicheGraph(this); } diff --git a/src/eva2/server/go/strategies/NichePSO.java b/src/eva2/server/go/strategies/NichePSO.java index da6d9a26..f39ebd30 100644 --- a/src/eva2/server/go/strategies/NichePSO.java +++ b/src/eva2/server/go/strategies/NichePSO.java @@ -242,6 +242,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac /** @tested * (non-Javadoc) @see java.lang.Object#clone() */ + @Override public Object clone(){ return (Object) new NichePSO(this); } @@ -318,6 +319,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac /** @tested junit, junit&, emp, ... * (non-Javadoc) @see javaeva.server.oa.go.Strategies.InterfaceOptimizer#init() */ + @Override public void init() { // (called right before next optimize/mutltirun) // initialize main swarm initMainSwarm(); // MOE: auch bei multirun: m�gliche �nderungen an Gr��e, AlgoType, maxrad, delta etc. aus letzter Optimierung zur�cksetzen @@ -344,6 +346,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * (non-Javadoc) * uses the given population and basically sets rnd velocity vectors (if reset == false) */ + @Override public void initByPopulation(Population pop, boolean reset) { // initByPopulation(...): // - use indys from pop @@ -361,6 +364,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac /** @tested * (non-Javadoc) @see javaeva.server.oa.go.Strategies.InterfaceOptimizer#optimize() */ + @Override public void optimize() { // System.out.println(BeanInspector.toString(getMainSwarm())); if (isVerbose()) { @@ -670,10 +674,12 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -685,6 +691,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -695,6 +702,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac /** @tested nn * (non-Javadoc) @see eva2.server.go.strategies.InterfaceOptimizer#setPopulation(javaeva.server.oa.go.Populations.Population) */ + @Override public void setPopulation(Population pop) { //pass on to mainswarm optimizer getMainSwarm().setPopulation(pop); @@ -738,6 +746,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * the actual size of the complete population is accessed via getPopulation().size() * @return a population consisting of copies from the mainswarm and all subswarms. */ + @Override public Population getPopulation() { boolean activeOnly = true; // true makes problems if all subswarms are deactivated at the same time! // construct a metapop with clones from the mainswarm and all subswarms @@ -790,6 +799,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * @see eva2.server.go.strategies.InterfaceOptimizer#getAllSolutions() * @return a population consisting of the personal best solutions of every particle in the mainswarm and all subswarms */ + @Override public SolutionSet getAllSolutions() { // hier kann dasselbe geliefert werden wie bei getPopulation // speziell fuer multi-modale optimierung kann aber noch "mehr" als die aktuelle Population zurueckgeliefert werden @@ -1211,6 +1221,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac /** @tested nn * (non-Javadoc) @see javaeva.server.oa.go.Strategies.InterfaceOptimizer#getProblem() */ + @Override public InterfaceOptimizationProblem getProblem() { return this.m_Problem; } @@ -1219,6 +1230,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { // set member this.m_Problem = problem; @@ -1234,6 +1246,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } @@ -1241,6 +1254,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac /** @tested nn * (non-Javadoc) @see javaeva.server.oa.go.Strategies.InterfaceOptimizer#getIdentifier() */ + @Override public String getIdentifier() { return this.m_Identifier; } @@ -1346,6 +1360,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "NichePSO-"+getMainSwarmSize(); } @@ -1355,6 +1370,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "niching particle swarm optimization." + @@ -2141,10 +2157,12 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac return npso; } + @Override public String[] getAdditionalDataHeader() { return new String[]{"mainSwarmSize","numActSpec","avgSpecSize", "numArchived", "archivedMedCorr", "archivedMeanDist", "mainSwarmInertness"}; } + @Override public String[] getAdditionalDataInfo() { return new String[]{"Size of the main swarm of explorers", "Number of sub-swarms currently active", @@ -2155,6 +2173,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac "Current inertness of the main swarm"}; } + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { int actSwarms = countActiveSubswarms(); double avgSpSize = getAvgActiveSubSwarmSize(); diff --git a/src/eva2/server/go/strategies/ParticleFilterOptimization.java b/src/eva2/server/go/strategies/ParticleFilterOptimization.java index d443c834..2a0e31bc 100644 --- a/src/eva2/server/go/strategies/ParticleFilterOptimization.java +++ b/src/eva2/server/go/strategies/ParticleFilterOptimization.java @@ -87,10 +87,12 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S GenericObjectEditor.setHideProperty(this.getClass(), "population", true); } + @Override public Object clone() { return (Object) new ParticleFilterOptimization(this); } + @Override public void init() { //System.out.println("popsize is " + m_Population.size()); //System.out.println("pops targ is " + m_Population.getPopulationSize()); @@ -113,6 +115,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -218,6 +221,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S * Optimization loop of a resampling particle filter, restructured by MK. * */ + @Override public void optimize() { Population nextGeneration; //AbstractEAIndividual elite; @@ -240,9 +244,11 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -257,12 +263,14 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; if (problem instanceof AbstractOptimizationProblem) { ((AbstractOptimizationProblem)problem).informAboutOptimizer(this); } } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -271,6 +279,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { StringBuilder strB=new StringBuilder(200); strB.append("Particle Filter:\nOptimization Problem: "); @@ -282,9 +291,11 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -292,6 +303,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -307,6 +319,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "PF"; } @@ -316,9 +329,11 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -326,6 +341,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/ParticleSubSwarmOptimization.java b/src/eva2/server/go/strategies/ParticleSubSwarmOptimization.java index 9eccbb92..c94e8361 100644 --- a/src/eva2/server/go/strategies/ParticleSubSwarmOptimization.java +++ b/src/eva2/server/go/strategies/ParticleSubSwarmOptimization.java @@ -68,6 +68,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO /** @tested * (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#clone() */ + @Override public Object clone() { return (Object) new ParticleSubSwarmOptimization(this); } @@ -79,6 +80,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO /** @tested ps * (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#init() */ + @Override public void init(){ super.init(); @@ -93,6 +95,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO /** @tested ps * (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#initByPopulation(javaeva.server.oa.go.Populations.Population, boolean) */ + @Override public void initByPopulation(Population pop, boolean reset){ super.initByPopulation(pop, reset); initIndividuals(); @@ -156,6 +159,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO /** @tested ps * (non-Javadoc) @see javaeva.server.oa.go.Strategies.ParticleSwarmOptimization#optimize() */ + @Override public void optimize(){ super.optimize(); updateFitnessArchives(); @@ -209,6 +213,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO /* (non-Javadoc) * @see eva2.server.go.strategies.ParticleSwarmOptimization#addSortedIndizesTo(eva2.server.go.populations.Population) */ + @Override protected void addSortedIndicesTo(Object[] sortedPopulation, Population pop) { int origIndex; for (int i=0; i>> " + m_Population.getStringRepresentation()); startOptimize(); @@ -1659,10 +1663,12 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se } } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener == ea) { @@ -1684,10 +1690,12 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * * @param problem */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem() { return this.m_Problem; } @@ -1698,6 +1706,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Particle Swarm Optimization:\n"; @@ -1712,10 +1721,12 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -1724,6 +1735,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * This method is required to free the memory on a RMIServer, but there is * nothing to implement. */ + @Override public void freeWilly() { } @@ -1745,15 +1757,18 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * * @return The name of the algorithm */ + @Override public String getName() { // return "PSO-"+getTopology()+getTopologyRange()+(isDoLocalSearch() ? "-ls_" : "_")+getPhi1()+"_"+getPhi2(); return "PSO-" + getTopology() + getTopologyRange() + "_" + getPhi1() + "_" + getPhi2(); } + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop) { this.m_Population = pop; if (pop.size() != pop.getTargetSize()) { // new particle count! @@ -1782,6 +1797,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } @@ -2253,6 +2269,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se // public void setDoLocalSearch(boolean doLocalSearch) { // this.doLocalSearch = doLocalSearch; // } + @Override public String[] getAdditionalDataHeader() { if (emaPeriods > 0) { return new String[]{"meanEMASpeed", "meanCurSpeed"}; @@ -2261,6 +2278,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se } } + @Override public String[] getAdditionalDataInfo() { if (emaPeriods > 0) { return new String[]{"Exponential moving average of the (range-relative) speed of all particles", "The mean (range-relative) current speed of all particles"}; @@ -2269,6 +2287,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se } } + @Override public Object[] getAdditionalDataValue(PopulationInterface pop) { AbstractEAIndividual indy = (AbstractEAIndividual) pop.get(0); if (emaPeriods > 0) { diff --git a/src/eva2/server/go/strategies/ParticleSwarmOptimizationGCPSO.java b/src/eva2/server/go/strategies/ParticleSwarmOptimizationGCPSO.java index 51bb184c..dc0bc93f 100644 --- a/src/eva2/server/go/strategies/ParticleSwarmOptimizationGCPSO.java +++ b/src/eva2/server/go/strategies/ParticleSwarmOptimizationGCPSO.java @@ -84,6 +84,7 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization { /** @tested * (non-Javadoc) @see javaeva.server.go.strategies.ParticleSwarmOptimization#optimize() */ + @Override public void optimize() { super.optimize(); //updatePopulation->updateIndividual->updateVelocity (s.u.) updateGCPSOMember(); @@ -93,6 +94,7 @@ public class ParticleSwarmOptimizationGCPSO extends ParticleSwarmOptimization { * (non-Javadoc) @see javaeva.server.go.strategies.ParticleSwarmOptimization#updateVelocity(int, double[], double[], double[], double[], double[][]) * uses a special velocity update strategy for the gobal best particle. */ + @Override protected double[] updateVelocity(int index, double[] lastVelocity, double[] personalBestPos, double[] curPosition, double[] neighbourBestPos, double[][] range) { double[] accel, curVelocity = new double[lastVelocity.length]; diff --git a/src/eva2/server/go/strategies/PopulationBasedIncrementalLearning.java b/src/eva2/server/go/strategies/PopulationBasedIncrementalLearning.java index 0598b75e..17c32a03 100644 --- a/src/eva2/server/go/strategies/PopulationBasedIncrementalLearning.java +++ b/src/eva2/server/go/strategies/PopulationBasedIncrementalLearning.java @@ -59,10 +59,12 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j this.m_SelectionOperator = (InterfaceSelection)a.m_SelectionOperator.clone(); } + @Override public Object clone() { return (Object) new PopulationBasedIncrementalLearning(this); } + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); if ((m_initialProbabilities!=null) && (m_initialProbabilities.length==((PBILPopulation)m_Population).getProbabilityVector().length)) { @@ -78,6 +80,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { if (!(pop.getEAIndividual(0) instanceof InterfaceGAIndividual)) { System.err.println("Error: PBIL only works with GAIndividuals!"); @@ -119,6 +122,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j return result; } + @Override public void optimize() { Population nextGeneration; AbstractEAIndividual elite; @@ -138,6 +142,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; if (m_Problem instanceof AbstractOptimizationProblem) { @@ -146,12 +151,15 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j } } } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -169,6 +177,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Population Based Incremental Learning:\n"; @@ -180,9 +189,11 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -190,6 +201,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -205,6 +217,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "PBIL"; } @@ -214,9 +227,11 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -224,6 +239,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j return "Edit the properties of the PBIL population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/ScatterSearch.java b/src/eva2/server/go/strategies/ScatterSearch.java index c3b56be5..77328ba7 100644 --- a/src/eva2/server/go/strategies/ScatterSearch.java +++ b/src/eva2/server/go/strategies/ScatterSearch.java @@ -95,6 +95,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, this.lastImprovementCount = o.lastImprovementCount; } + @Override public Object clone() { return new ScatterSearch(this); } @@ -104,23 +105,28 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, GenericObjectEditor.setHideProperty(this.getClass(), "population", true); } + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.problem = (AbstractOptimizationProblem)problem; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(refSet); } + @Override public Population getPopulation() { return refSet; } + @Override public void init() { defaultInit(); initRefSet(diversify()); } + @Override public void initByPopulation(Population pop, boolean reset) { defaultInit(); @@ -176,6 +182,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, // return indy.getFitness(0); // } + @Override public void registerPopulationStateChanged(Object source, String name) { // The events of the interim hill climbing population will be caught here if (name.compareTo(Population.funCallIntervalReached) == 0) { @@ -193,6 +200,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, //else System.err.println("ERROR, event was " + name); } + @Override public void optimize() { // Diversification // Refset Formation @@ -504,6 +512,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, return resIndy; } + @Override public void setPopulation(Population pop) { refSet = pop; } @@ -664,22 +673,27 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, ///////////// Trivials... + @Override public void setIdentifier(String name) { m_Identifier = name; } + @Override public InterfaceOptimizationProblem getProblem() { return problem; } + @Override public String getStringRepresentation() { return "ScatterSearch"; } + @Override public void addPopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -687,12 +701,15 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, return true; } else return false; } + @Override public void freeWilly() {} + @Override public String getIdentifier() { return m_Identifier; } + @Override public String getName() { return "ScatterSearch"; } diff --git a/src/eva2/server/go/strategies/SimulatedAnnealing.java b/src/eva2/server/go/strategies/SimulatedAnnealing.java index 357b6212..101a19fa 100644 --- a/src/eva2/server/go/strategies/SimulatedAnnealing.java +++ b/src/eva2/server/go/strategies/SimulatedAnnealing.java @@ -48,12 +48,14 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa this.m_Alpha = a.m_Alpha; } + @Override public Object clone() { return (Object) new SimulatedAnnealing(this); } /** This method will init the HillClimber */ + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.m_Problem.evaluate(this.m_Population); @@ -65,6 +67,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); this.m_CurrentTemperature = this.m_InitialTemperature; @@ -77,6 +80,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa /** This method will optimize */ + @Override public void optimize() { AbstractEAIndividual indy; Population original = (Population)this.m_Population.clone(); @@ -126,9 +130,11 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -171,9 +177,11 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa System.out.println("("+program.m_MultiRuns+"/"+program.m_FitnessCalls+") Mean Fitness : " + TmpMeanFitness + " Mean Calls needed: " + TmpMeanCalls); } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -189,6 +197,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; if (this.m_Population.size() > 1) result += "Multi(" + this.m_Population.size() + ")-Start Hill Climbing:\n"; @@ -201,9 +210,11 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -211,6 +222,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -226,6 +238,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "MS-SA"; } @@ -234,9 +247,11 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -244,6 +259,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa return "Change the number of best individuals stored (MS-SA))."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/SqPSO.java b/src/eva2/server/go/strategies/SqPSO.java index 15e9240b..dc9271c1 100644 --- a/src/eva2/server/go/strategies/SqPSO.java +++ b/src/eva2/server/go/strategies/SqPSO.java @@ -39,6 +39,7 @@ public class SqPSO extends ClusterBasedNichingEA { // public void hideHideable() + @Override public String getName() { return "SqPSO"; } diff --git a/src/eva2/server/go/strategies/SteadyStateGA.java b/src/eva2/server/go/strategies/SteadyStateGA.java index 458470fa..8570d6c0 100644 --- a/src/eva2/server/go/strategies/SteadyStateGA.java +++ b/src/eva2/server/go/strategies/SteadyStateGA.java @@ -47,10 +47,12 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { this.m_ReplacementSelection = (InterfaceReplacement)a.m_ReplacementSelection.clone(); } + @Override public Object clone() { return (Object) new SteadyStateGA(this); } + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.evaluatePopulation(this.m_Population); @@ -60,6 +62,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { /** This method will init the optimizer with a given population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); if (reset) { @@ -107,15 +110,18 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { this.m_ReplacementSelection.insertIndividual(offSprings[0], this.m_Population, parents); } + @Override public void optimize() { for (int i = 0; i < this.m_Population.size(); i++) this.generateChildren(); this.m_Population.incrFunctionCallsBy(this.m_Population.size()); this.m_Population.incrGeneration(); this.firePropertyChangedEvent(Population.nextGenerationPerformed); } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -130,9 +136,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -141,6 +149,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "Genetic Algorithm:\n"; @@ -152,9 +161,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -162,6 +173,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -177,6 +189,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "SS-GA"; } @@ -186,9 +199,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -196,6 +211,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { return "Edit the properties of the population used."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/ThresholdAlgorithm.java b/src/eva2/server/go/strategies/ThresholdAlgorithm.java index f9ef12a1..7ab8d40e 100644 --- a/src/eva2/server/go/strategies/ThresholdAlgorithm.java +++ b/src/eva2/server/go/strategies/ThresholdAlgorithm.java @@ -46,12 +46,14 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa this.m_Alpha = a.m_Alpha; } + @Override public Object clone() { return (Object) new ThresholdAlgorithm(this); } /** This method will init the HillClimber */ + @Override public void init() { this.m_Problem.initPopulation(this.m_Population); this.m_Problem.evaluate(this.m_Population); @@ -63,6 +65,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { this.m_Population = (Population)pop.clone(); this.m_CurrentT = this.m_InitialT; @@ -75,6 +78,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa /** This method will optimize */ + @Override public void optimize() { AbstractEAIndividual indy; Population original = (Population)this.m_Population.clone(); @@ -118,9 +122,11 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -162,9 +168,11 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa TmpMeanFitness = TmpMeanFitness/program.m_MultiRuns; System.out.println("("+program.m_MultiRuns+"/"+program.m_FitnessCalls+") Mean Fitness : " + TmpMeanFitness + " Mean Calls needed: " + TmpMeanCalls); } + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -180,6 +188,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; if (this.m_Population.size() > 1) result += "Multi(" + this.m_Population.size() + ")-Start Hill Climbing:\n"; @@ -192,9 +201,11 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -202,6 +213,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -217,6 +229,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "MS-TA"; } @@ -225,9 +238,11 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -235,6 +250,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa return "Change the number of best individuals stored (MS-TA)."; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/Tribes.java b/src/eva2/server/go/strategies/Tribes.java index c70da2a3..5800efb8 100644 --- a/src/eva2/server/go/strategies/Tribes.java +++ b/src/eva2/server/go/strategies/Tribes.java @@ -175,6 +175,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { transient protected eva2.gui.Plot m_Plot = null; // private int useAnchors = 0; // use anchors to detect environment changes? + @Override public Object clone() { return new Tribes(this); } @@ -202,6 +203,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { hideHideable(); } + @Override public void setProblem(InterfaceOptimizationProblem problem) { // System.out.println("TRIBES.SetProblem()"); m_problem = (AbstractOptimizationProblem)problem; @@ -214,6 +216,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { setPopulation(pop); } + @Override public void init() { // System.out.println("TRIBES.init()"); // Generate a swarm @@ -244,6 +247,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { * and memories), the setPopulation method is only telling Tribes the range * of the indiviuals in the beginning of the run, the individuals will be discarded. */ + @Override public void initByPopulation(Population pop, boolean reset) { setPopulation(pop); } @@ -259,6 +263,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { } else return bestExp; } + @Override public void optimize() { int initOption = 0; @@ -632,6 +637,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { * and memories), the setPopulation method is only telling Tribes the range * of the indiviuals in the beginning of the run, the individuals will be discarded. */ + @Override public void setPopulation(Population pop) { if (pop == null) return; population = pop; @@ -658,6 +664,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { * in the returned population. This, however, means that the best found solution might not * be inluded as well at several if not most stages of the search. */ + @Override public Population getPopulation() { return population; } @@ -668,6 +675,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { * * @return a population of possible solutions. */ + @Override public InterfaceSolutionSet getAllSolutions() { // return population and memories? Population all = (Population)population.clone(); @@ -695,9 +703,11 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -713,23 +723,29 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable { return (evals % notifyGenChangedEvery) == 0; } + @Override public void freeWilly() {} + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return m_Identifier; } + @Override public String getName() { return "TRIBES"; } + @Override public InterfaceOptimizationProblem getProblem() { return m_problem; } + @Override public String getStringRepresentation() { return globalInfo(); } diff --git a/src/eva2/server/go/strategies/WingedMultiObjectiveEA.java b/src/eva2/server/go/strategies/WingedMultiObjectiveEA.java index 731e2c41..57c030b2 100644 --- a/src/eva2/server/go/strategies/WingedMultiObjectiveEA.java +++ b/src/eva2/server/go/strategies/WingedMultiObjectiveEA.java @@ -53,10 +53,12 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria this.m_Population = (Population)a.m_Population.clone(); } + @Override public Object clone() { return (Object) new WingedMultiObjectiveEA(this); } + @Override public void init() { if (this.m_Problem instanceof AbstractMultiObjectiveOptimizationProblem) { AbstractMultiObjectiveOptimizationProblem tmpProb = (AbstractMultiObjectiveOptimizationProblem)this.m_Problem; @@ -95,6 +97,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria * @param pop The initial population * @param reset If true the population is reset. */ + @Override public void initByPopulation(Population pop, boolean reset) { if (this.m_Problem instanceof AbstractMultiObjectiveOptimizationProblem) { AbstractMultiObjectiveOptimizationProblem tmpProb = (AbstractMultiObjectiveOptimizationProblem)this.m_Problem; @@ -130,6 +133,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria /** The optimize method will compute a 'improved' and evaluated population */ + @Override public void optimize() { this.m_MOOptimizer.optimize(); @@ -205,9 +209,11 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria /** This method allows you to add the LectureGUI as listener to the Optimizer * @param ea */ + @Override public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_Listener = ea; } + @Override public boolean removePopulationChangedEventListener( InterfacePopulationChangedEventListener ea) { if (m_Listener==ea) { @@ -224,9 +230,11 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria /** This method will set the problem that is to be optimized * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem () { return this.m_Problem; } @@ -235,6 +243,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria * and the applied methods. * @return A descriptive string */ + @Override public String getStringRepresentation() { String result = ""; result += "EMO:\n"; @@ -246,9 +255,11 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria /** This method allows you to set an identifier for the algorithm * @param name The indenifier */ + @Override public void setIdentifier(String name) { this.m_Identifier = name; } + @Override public String getIdentifier() { return this.m_Identifier; } @@ -256,6 +267,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria /** This method is required to free the memory on a RMIServer, * but there is nothing to implement. */ + @Override public void freeWilly() { } @@ -271,6 +283,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria /** This method will return a naming String * @return The name of the algorithm */ + @Override public String getName() { return "EMO-LS"; } @@ -280,9 +293,11 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria * of the optimizer. * @return The population of current solutions to a given problem. */ + @Override public Population getPopulation() { return this.m_Population; } + @Override public void setPopulation(Population pop){ this.m_Population = pop; } @@ -290,6 +305,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria return "(Defunct)"; } + @Override public InterfaceSolutionSet getAllSolutions() { return new SolutionSet(getPopulation()); } diff --git a/src/eva2/server/go/strategies/tribes/TribesExplorer.java b/src/eva2/server/go/strategies/tribes/TribesExplorer.java index 5db624f8..a64fded7 100644 --- a/src/eva2/server/go/strategies/tribes/TribesExplorer.java +++ b/src/eva2/server/go/strategies/tribes/TribesExplorer.java @@ -82,10 +82,12 @@ public class TribesExplorer extends AbstractEAIndividual implements InterfaceDat // output.out.append(string); // } + @Override public double[] getFitness() { return position.getFitness(); } + @Override public double getFitness(int index) { return position.getFitness()[index]; } @@ -94,6 +96,7 @@ public class TribesExplorer extends AbstractEAIndividual implements InterfaceDat * Be aware that for a TribesExplorer, an objective value might be taken into account * by reducing the fitness (in the first dimension). */ + @Override public void setFitness(double[] fitness) { position.fitness = fitness; super.setFitness(fitness); @@ -105,6 +108,7 @@ public class TribesExplorer extends AbstractEAIndividual implements InterfaceDat * Be aware that for a TribesExplorer, an objective value might be taken into account * by reducing the fitness (in the first dimension). */ + @Override public void SetFitness(int index, double fitness) { super.SetFitness(index, fitness); if (index > position.fitness.length) { @@ -120,6 +124,7 @@ public class TribesExplorer extends AbstractEAIndividual implements InterfaceDat position.setTotalError(); } + @Override public TribesExplorer clone() { return new TribesExplorer(this); } @@ -956,6 +961,7 @@ v[d] = cmin * v[d]; } } + @Override public void defaultInit(InterfaceOptimizationProblem prob) { // shouldnt be called as we are beyond the EvA framework in this class for (int i = 0; i < this.position.x.length; i++) { @@ -963,6 +969,7 @@ v[d] = cmin * v[d]; } } + @Override public void defaultMutate() { // shouldnt be called as we are beyond the EvA framework in this class } @@ -990,14 +997,17 @@ v[d] = cmin * v[d]; System.err.println("TRIBES: mutation is not available!"); } + @Override public void SetDoublePhenotype(double[] doubleData) { position.setDoubleArray(doubleData); } + @Override public void SetDoubleGenotype(double[] doubleData) { position.setDoubleArray(doubleData); } + @Override public void SetDoubleRange(double[][] range) { if (position.x.length != range.length) { // we will need to fully reinit the particle initPositions(range.length); @@ -1005,6 +1015,7 @@ v[d] = cmin * v[d]; this.range = range; } + @Override public double[] getDoubleData() { return position.x; } @@ -1013,20 +1024,24 @@ v[d] = cmin * v[d]; return velocity.x; } + @Override public double[] getDoubleDataWithoutUpdate() { return position.x; } + @Override public double[][] getDoubleRange() { return range; } + @Override public void setDoubleDataLength(int length) { if (position.x.length != length) { // we will need to fully reinit the particle initPositions(length); } } + @Override public int size() { return position.x.length; } diff --git a/src/eva2/server/go/strategies/tribes/TribesMemory.java b/src/eva2/server/go/strategies/tribes/TribesMemory.java index e6693085..02056c61 100644 --- a/src/eva2/server/go/strategies/tribes/TribesMemory.java +++ b/src/eva2/server/go/strategies/tribes/TribesMemory.java @@ -51,6 +51,7 @@ public class TribesMemory implements java.io.Serializable { return positionPrev; } + @Override public TribesMemory clone() { TribesMemory clone = new TribesMemory(position.x.length); clone.status = status; diff --git a/src/eva2/server/go/strategies/tribes/TribesPosition.java b/src/eva2/server/go/strategies/tribes/TribesPosition.java index b488179c..e7c340d3 100644 --- a/src/eva2/server/go/strategies/tribes/TribesPosition.java +++ b/src/eva2/server/go/strategies/tribes/TribesPosition.java @@ -39,6 +39,7 @@ public class TribesPosition implements java.io.Serializable { // return Clone; // } + @Override public TribesPosition clone() { // Pour remplacer "implements Cloneable" TribesPosition Clone = new TribesPosition(x.length); @@ -895,6 +896,7 @@ public class TribesPosition implements java.io.Serializable { return t; } + @Override public String toString() { StringBuffer sb = new StringBuffer("TribesMemory at ["); for (int i=0; i { fitCriterion = o.fitCriterion; } + @Override public Object clone() { return new DoubleArrayComparator(this); } @@ -46,6 +47,7 @@ public class DoubleArrayComparator implements Comparator { * @param o2 the second double[] to compare * @return -1 if the first is dominant, 1 if the second is dominant, otherwise 0 */ + @Override public int compare(Object o1, Object o2) { boolean o1domO2, o2domO1; diff --git a/src/eva2/server/go/tools/GeneralGEOFaker.java b/src/eva2/server/go/tools/GeneralGEOFaker.java index d9fad101..749b7517 100644 --- a/src/eva2/server/go/tools/GeneralGEOFaker.java +++ b/src/eva2/server/go/tools/GeneralGEOFaker.java @@ -39,6 +39,7 @@ public class GeneralGEOFaker extends JPanel { open.setToolTipText("Load a configured object"); open.setEnabled(true); open.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { Object object = openObject(); if (object != null) { @@ -56,6 +57,7 @@ public class GeneralGEOFaker extends JPanel { save.setToolTipText("Save the current configured object"); save.setEnabled(true); save.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { saveObject(m_Editor.getValue()); } @@ -89,6 +91,7 @@ public class GeneralGEOFaker extends JPanel { ok = new JButton("OK"); ok.setEnabled(true); ok.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if ((getTopLevelAncestor() != null) && (getTopLevelAncestor() instanceof Window)) { Window w = (Window) getTopLevelAncestor(); diff --git a/src/eva2/server/go/tools/GeneralGenericObjectEditorPanel.java b/src/eva2/server/go/tools/GeneralGenericObjectEditorPanel.java index 8f00c0e3..b99a9590 100644 --- a/src/eva2/server/go/tools/GeneralGenericObjectEditorPanel.java +++ b/src/eva2/server/go/tools/GeneralGenericObjectEditorPanel.java @@ -62,6 +62,7 @@ public class GeneralGenericObjectEditorPanel extends JPanel implements ItemListe m_PPWrapper = new JPanel(); m_PropertyPanel = this.m_ObjectEditor.getPropertyPanel(); m_PropertyPanel.addPropertyChangeListener(new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { m_ObjectEditor.firePropertyChange("", null, m_ObjectEditor.getValue()); } @@ -70,6 +71,7 @@ public class GeneralGenericObjectEditorPanel extends JPanel implements ItemListe m_OpenBut.setToolTipText("Load a configured object"); m_OpenBut.setEnabled(true); m_OpenBut.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { Object object = openObject(); if (object != null) { @@ -87,6 +89,7 @@ public class GeneralGenericObjectEditorPanel extends JPanel implements ItemListe m_SaveBut.setToolTipText("Save the current configured object"); m_SaveBut.setEnabled(true); m_SaveBut.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { saveObject(m_ObjectEditor.getValue()); } @@ -120,6 +123,7 @@ public class GeneralGenericObjectEditorPanel extends JPanel implements ItemListe m_okBut = new JButton("OK"); m_okBut.setEnabled(true); m_okBut.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { m_ObjectEditor.makeBackup(); if ((getTopLevelAncestor() != null) && (getTopLevelAncestor() instanceof Window)) { @@ -132,6 +136,7 @@ public class GeneralGenericObjectEditorPanel extends JPanel implements ItemListe m_cancelBut = new JButton("Cancel"); m_cancelBut.setEnabled(false); m_cancelBut.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { m_ObjectEditor.undoBackup(); updateClassType(); @@ -303,6 +308,7 @@ public class GeneralGenericObjectEditorPanel extends JPanel implements ItemListe * is changed appropriately. * @param e a value of type 'ItemEvent' */ + @Override public void itemStateChanged(ItemEvent e) { String className = (String)m_ObjectChooser.getSelectedItem(); diff --git a/src/eva2/server/modules/AbstractGOParameters.java b/src/eva2/server/modules/AbstractGOParameters.java index 8ce8e7f1..1d328b34 100644 --- a/src/eva2/server/modules/AbstractGOParameters.java +++ b/src/eva2/server/modules/AbstractGOParameters.java @@ -100,11 +100,13 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser } } + @Override public void saveInstance() { String fileName = this.getClass().getSimpleName() + ".ser"; saveInstance(fileName); } + @Override public String toString() { StringBuilder sBuilder = new StringBuilder(getName()); sBuilder.append("\n"); @@ -120,12 +122,14 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser return sBuilder.toString(); } + @Override public void addInformableInstance(InterfaceNotifyOnInformers o) { if (toInformAboutInformers==null) toInformAboutInformers=new LinkedList(); if (!toInformAboutInformers.contains(o)) toInformAboutInformers.add(o); o.setInformers(getInformerList()); } + @Override public boolean removeInformableInstance(InterfaceNotifyOnInformers o) { if (toInformAboutInformers==null) return false; else return toInformAboutInformers.remove(o); @@ -137,6 +141,7 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser } } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { this.m_Optimizer = optimizer; this.m_Optimizer.setProblem(this.m_Problem); @@ -151,6 +156,7 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser return ret; } + @Override public InterfaceOptimizer getOptimizer() { return this.m_Optimizer; } @@ -158,6 +164,7 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser return "Choose an optimization strategy."; } + @Override public String getName() { return "Optimization parameters"; } @@ -166,15 +173,18 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser * This method will set the problem that is to be optimized. * @param problem */ + @Override public void setProblem (InterfaceOptimizationProblem problem) { this.m_Problem = problem; this.m_Optimizer.setProblem(this.m_Problem); fireNotifyOnInformers(); } + @Override public InterfaceOptimizationProblem getProblem() { return this.m_Problem; } + @Override public String problemTipText() { return "Choose the problem that is to optimize and the EA individual parameters."; } @@ -182,6 +192,7 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser /** This methods allow you to set and get the Seed for the Random Number Generator. * @param x Long seed. */ + @Override public void setSeed(long x) { randomSeed = x; } @@ -191,10 +202,12 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser * * @return The current seed for the random number generator. */ + @Override public long getSeed() { return randomSeed; } + @Override public String seedTipText() { return "Random number seed, set to zero to use current system time."; } @@ -203,25 +216,32 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser * evolutionary algorithm. * @param term The new terminator */ + @Override public void setTerminator(InterfaceTerminator term) { this.m_Terminator = term; } + @Override public InterfaceTerminator getTerminator() { return this.m_Terminator; } + @Override public String terminatorTipText() { return "Choose a termination criterion."; } + @Override public InterfacePostProcessParams getPostProcessParams() { return m_PostProc; } + @Override public void setPostProcessParams(InterfacePostProcessParams ppp) { m_PostProc = ppp; } + @Override public String postProcessParamsTipText() { return "Parameters for the post processing step"; } + @Override public void setDoPostProcessing(boolean doPP){ m_PostProc.setDoPostProcessing(doPP); } diff --git a/src/eva2/server/modules/AbstractModuleAdapter.java b/src/eva2/server/modules/AbstractModuleAdapter.java index f64ac12b..f59d4534 100644 --- a/src/eva2/server/modules/AbstractModuleAdapter.java +++ b/src/eva2/server/modules/AbstractModuleAdapter.java @@ -64,6 +64,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * From the interface RemoteStateListener. Added this method to make progress bar possible. */ + @Override public void updateProgress(final int percent, String msg) { for (RemoteStateListener listener : remoteStateListeners) { listener.updateProgress(percent, msg); @@ -75,6 +76,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab * * @return The adapter name */ + @Override public String getAdapterName() { return adapterName; } @@ -82,6 +84,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * Start optimization on processor. */ + @Override public void startOpt() { processor.startOpt(); } @@ -89,6 +92,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * Restart optimization on processor. */ + @Override public void restartOpt() { processor.restartOpt(); } @@ -96,6 +100,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * Stop optimization on processor. */ + @Override public void stopOpt() { // This means user break processor.stopOpt(); @@ -106,6 +111,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab * * @return true if post processing is available */ + @Override public boolean hasPostProcessing() { return ((processor instanceof Processor) && ((Processor) processor).getGOParams().getPostProcessParams().isDoPostProcessing()); } @@ -115,6 +121,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab * * @return true if post processing was performed, false otherwise. */ + @Override public boolean startPostProcessing() { if (hasPostProcessing() && ((Processor) processor).getGOParams().getPostProcessParams().isDoPostProcessing()) { ((Processor) processor).performPostProcessing(); @@ -149,6 +156,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * Adds a remote state listener. */ + @Override public void addRemoteStateListener(RemoteStateListener remoteListener) { remoteStateListeners.add(remoteListener); } @@ -156,6 +164,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * */ + @Override public void setConnection(boolean flag) { hasConnection = flag; } @@ -165,6 +174,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab * * @return true if the adapter has a connection. */ + @Override public boolean hasConnection() { return hasConnection; } @@ -172,6 +182,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * */ + @Override public void setRemoteThis(ModuleAdapter x) { remoteModuleAdapter = x; } @@ -181,6 +192,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab * * @return The host name */ + @Override public String getHostName() { return hostName; } @@ -188,18 +200,21 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab /** * */ + @Override public void performedStop() { for (RemoteStateListener listener : remoteStateListeners) { listener.performedStop(); } } + @Override public void performedStart(String infoString) { for (RemoteStateListener listener : remoteStateListeners) { listener.performedStart(infoString); } } + @Override public void performedRestart(String infoString) { for (RemoteStateListener listener : remoteStateListeners) { listener.performedRestart(infoString); diff --git a/src/eva2/server/modules/DEParameters.java b/src/eva2/server/modules/DEParameters.java index de9b5a32..c6d3b3c5 100644 --- a/src/eva2/server/modules/DEParameters.java +++ b/src/eva2/server/modules/DEParameters.java @@ -59,6 +59,7 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar super(Source); } + @Override public Object clone() { return new DEParameters(this); } @@ -73,6 +74,7 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar /** This method allows you to set the current optimizing algorithm * @param optimizer The new optimizing algorithm */ + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // *pff* i'll ignore that! } diff --git a/src/eva2/server/modules/EPParameters.java b/src/eva2/server/modules/EPParameters.java index 9ee64f2f..982f6136 100644 --- a/src/eva2/server/modules/EPParameters.java +++ b/src/eva2/server/modules/EPParameters.java @@ -65,6 +65,7 @@ public class EPParameters extends AbstractGOParameters implements InterfaceGOPar /** * */ + @Override public Object clone() { return new EPParameters(this); } @@ -76,6 +77,7 @@ public class EPParameters extends AbstractGOParameters implements InterfaceGOPar return "This is a Evolutionary Programming optimization method, limit EP to mutation operators only."; } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // i'm a Monte Carlo Search Algorithm // *pff* i'll ignore that! diff --git a/src/eva2/server/modules/GAParameters.java b/src/eva2/server/modules/GAParameters.java index aff11a44..e6610892 100644 --- a/src/eva2/server/modules/GAParameters.java +++ b/src/eva2/server/modules/GAParameters.java @@ -63,6 +63,7 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar /** * */ + @Override public Object clone() { return new GAParameters(this); } @@ -73,6 +74,7 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar return "This is a Genetic Algorithm, which transforms into a GP or GE if the appropriate problem and genotype is used."; } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // i'm a Monte Carlo Search Algorithm // *pff* i'll ignore that! diff --git a/src/eva2/server/modules/GOParameters.java b/src/eva2/server/modules/GOParameters.java index 5f8abbb4..e1de7b7b 100644 --- a/src/eva2/server/modules/GOParameters.java +++ b/src/eva2/server/modules/GOParameters.java @@ -69,12 +69,14 @@ public class GOParameters extends AbstractGOParameters implements InterfaceGOPar /** * */ + @Override public String getName() { return "Optimization parameters"; } /** * */ + @Override public Object clone() { return new GOParameters(this); } diff --git a/src/eva2/server/modules/GenericModuleAdapter.java b/src/eva2/server/modules/GenericModuleAdapter.java index e79946a1..134f7802 100644 --- a/src/eva2/server/modules/GenericModuleAdapter.java +++ b/src/eva2/server/modules/GenericModuleAdapter.java @@ -86,6 +86,7 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria * @see StatisticsWithGUI * @return the EvATabbedFrameMaker */ + @Override public EvATabbedFrameMaker getModuleFrame() { if (!(statisticsModule instanceof StatisticsWithGUI)) { System.err.println("Error: Unable to create Frame when startet with noGUI option (GenericModuleAdapter)!"); @@ -151,6 +152,7 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria return statisticsModule; } + @Override public EvAJob scheduleJob() { EvAJob job = jobList.addJob(((Processor) processor).getGOParams(), (AbstractStatistics) (((Processor) processor).getStatistics())); jobPanel.getEditor().setValue(jobList); diff --git a/src/eva2/server/modules/HCParameters.java b/src/eva2/server/modules/HCParameters.java index 3f98628b..965c25fd 100644 --- a/src/eva2/server/modules/HCParameters.java +++ b/src/eva2/server/modules/HCParameters.java @@ -60,6 +60,7 @@ public class HCParameters extends AbstractGOParameters implements InterfaceGOPar /** * */ + @Override public Object clone() { return new HCParameters(this); } @@ -70,6 +71,7 @@ public class HCParameters extends AbstractGOParameters implements InterfaceGOPar return "This is a Hill-Climber, use a population size > 1 for a Multi-Start Hill-Climber."; } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // i'm a Monte Carlo Search Algorithm // *pff* i'll ignore that! diff --git a/src/eva2/server/modules/MCParameters.java b/src/eva2/server/modules/MCParameters.java index 0f176dad..66264fdc 100644 --- a/src/eva2/server/modules/MCParameters.java +++ b/src/eva2/server/modules/MCParameters.java @@ -56,6 +56,7 @@ public class MCParameters extends AbstractGOParameters implements InterfaceGOPar /** * */ + @Override public Object clone() { return new MCParameters(this); } @@ -67,6 +68,7 @@ public class MCParameters extends AbstractGOParameters implements InterfaceGOPar return "This is a simple Monte-Carlo Search, use big populations sizes for faster drawing."; } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // *pff* i'll ignore that! } diff --git a/src/eva2/server/modules/MOEAParameters.java b/src/eva2/server/modules/MOEAParameters.java index a8c7cf5b..5e9cb3d6 100644 --- a/src/eva2/server/modules/MOEAParameters.java +++ b/src/eva2/server/modules/MOEAParameters.java @@ -52,6 +52,7 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP super(Source); } + @Override public Object clone() { return new MOEAParameters(this); } @@ -81,12 +82,15 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP /** This method allows you to set/get the optimizing technique to use. * @return The current optimizing method */ + @Override public InterfaceOptimizer getOptimizer() { return ((MultiObjectiveEA)this.m_Optimizer).getOptimizer(); } + @Override public void setOptimizer(InterfaceOptimizer b){ ((MultiObjectiveEA)this.m_Optimizer).setOptimizer(b); } + @Override public String optimizerTipText() { return "Choose a population based optimizing technique to use."; } diff --git a/src/eva2/server/modules/PBILParameters.java b/src/eva2/server/modules/PBILParameters.java index fdaf7747..28ef97cf 100644 --- a/src/eva2/server/modules/PBILParameters.java +++ b/src/eva2/server/modules/PBILParameters.java @@ -51,6 +51,7 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP private PBILParameters(PBILParameters Source) { super(Source); } + @Override public Object clone() { return new PBILParameters(this); } @@ -62,6 +63,7 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP // return ((PopulationBasedIncrementalLearning)this.m_Optimizer).globalInfo(); // } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // i'm a Monte Carlo Search Algorithm // *pff* i'll ignore that! diff --git a/src/eva2/server/modules/PSOParameters.java b/src/eva2/server/modules/PSOParameters.java index 8f15f170..a59bcde7 100644 --- a/src/eva2/server/modules/PSOParameters.java +++ b/src/eva2/server/modules/PSOParameters.java @@ -58,6 +58,7 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa super(Source); } + @Override public Object clone() { return new PSOParameters(this); } @@ -78,6 +79,7 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa setTopology(getTopology()); } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // *pff* i'll ignore that! } diff --git a/src/eva2/server/modules/Processor.java b/src/eva2/server/modules/Processor.java index bca5b5bc..32c30317 100644 --- a/src/eva2/server/modules/Processor.java +++ b/src/eva2/server/modules/Processor.java @@ -105,6 +105,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo /** * */ + @Override public void startOpt() { m_createInitialPopulations = true; if (isOptRunning()) { @@ -377,6 +378,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo * @param source The source of the event. * @param name Could be used to indicate the nature of the event. */ + @Override public void registerPopulationStateChanged(Object source, String name) { if (name.equals(Population.nextGenerationPerformed)) { // System.out.println(getGOParams().getOptimizer().getPopulation().getFunctionCalls() + " " + getGOParams().getOptimizer().getPopulation().getBestFitness()[0]); @@ -418,6 +420,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo // System.err.println("Problems writing to output file!"); // } // } + @Override public String getInfoString() { //StringBuffer sb = new StringBuffer("processing "); StringBuilder sb = new StringBuilder(this.goParams.getProblem().getName()); diff --git a/src/eva2/server/modules/SAParameters.java b/src/eva2/server/modules/SAParameters.java index daa9f4ea..79fc7b86 100644 --- a/src/eva2/server/modules/SAParameters.java +++ b/src/eva2/server/modules/SAParameters.java @@ -62,6 +62,7 @@ public class SAParameters extends AbstractGOParameters implements InterfaceGOPar private SAParameters(SAParameters Source) { super(Source); } + @Override public Object clone() { return new SAParameters(this); } @@ -73,6 +74,7 @@ public class SAParameters extends AbstractGOParameters implements InterfaceGOPar return "This is a simple Simulated Annealing algorithm."; } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // *pff* i'll ignore that! } diff --git a/src/eva2/server/modules/SSGAParameters.java b/src/eva2/server/modules/SSGAParameters.java index ba94649d..ba2b13a6 100644 --- a/src/eva2/server/modules/SSGAParameters.java +++ b/src/eva2/server/modules/SSGAParameters.java @@ -55,6 +55,7 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP super(Source); } + @Override public Object clone() { return new SSGAParameters(this); } @@ -67,6 +68,7 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP return "This is a steady-state GA."; } + @Override public void setOptimizer(InterfaceOptimizer optimizer) { // *pff* i'll ignore that! } diff --git a/src/eva2/server/stat/AbstractStatistics.java b/src/eva2/server/stat/AbstractStatistics.java index 769b5953..e1609c98 100644 --- a/src/eva2/server/stat/AbstractStatistics.java +++ b/src/eva2/server/stat/AbstractStatistics.java @@ -118,6 +118,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter textListeners = new ArrayList(); } + @Override public void addDataListener(InterfaceStatisticsListener l) { if (dataListeners==null) { dataListeners=new LinkedList(); @@ -125,6 +126,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter if (l!=null && !dataListeners.contains(l)) dataListeners.add(l); } + @Override public boolean removeDataListener(InterfaceStatisticsListener l) { if (dataListeners==null) return false; else return dataListeners.remove(l); @@ -169,12 +171,14 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter } } + @Override public void addTextListener(InterfaceTextListener listener) { if (!textListeners.contains(listener)) { textListeners.add(listener); } } + @Override public boolean removeTextListener(InterfaceTextListener listener) { return textListeners.remove(listener); } @@ -236,6 +240,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter saveParams = doSave; } + @Override public void startOptPerformed(String infoString, int runNumber, Object params, List informerList) { if (TRACE) { System.out.println("AbstractStatistics.startOptPerformed " + runNumber); @@ -298,6 +303,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter fireDataListenersStartStop(runNumber, true, true); } + @Override public void stopOptPerformed(boolean normal, String stopMessage) { if (TRACE) System.out.println("AbstractStatistics.stopOptPerformed"); if (lastSols==null) System.err.println("WARNING, possibly there was no call to createNextGenerationPerformed before calling stopOptPerformed (AnstractStatistics)."); @@ -362,6 +368,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter fireDataListenersStartStop(optRunsPerformed, normal, false); } + @Override public void postProcessingPerformed(Population resultPop) { // called from processor if (!printRunStoppedVerbosity() && printFinalVerbosity() && optRunsPerformed >= m_StatsParams.getMultiRuns()) printToTextListener("\n"); if (printRunStoppedVerbosity()) { @@ -590,6 +597,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter public abstract String getHostName(); + @Override public void printToTextListener(String s) { if ((resultOut != null)) resultOut.print(s); for (InterfaceTextListener l : textListeners) { @@ -598,15 +606,18 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter } ////////////// InterfaceTextListener + @Override public void print(String str) { printToTextListener(str); } ////////////// InterfaceTextListener + @Override public void println(String str) { printToTextListener(str); printToTextListener("\n"); } + @Override public InterfaceStatisticsParameter getStatisticsParameter() { return m_StatsParams; } @@ -898,6 +909,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter /** * @deprecated The method {@link #createNextGenerationPerformed(PopulationInterface, List)} should be used instead. */ + @Override public synchronized void createNextGenerationPerformed(double[] bestfit, double[] worstfit, int calls) { functionCalls = calls; @@ -1047,6 +1059,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter * Do some data collection on the population. * */ + @Override public synchronized void createNextGenerationPerformed(PopulationInterface pop, InterfaceOptimizer opt, List informerList) { lastInformerList = informerList; @@ -1190,14 +1203,17 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter return (indy2.isDominant(indy1)); } + @Override public double[] getBestFitness() { return currentBestFit; } + @Override public IndividualInterface getBestSolution() { return bestIndyAllRuns; } + @Override public IndividualInterface getRunBestSolution() { return bestOfRunIndy; } diff --git a/src/eva2/server/stat/EvAJob.java b/src/eva2/server/stat/EvAJob.java index b549153f..3caad490 100644 --- a/src/eva2/server/stat/EvAJob.java +++ b/src/eva2/server/stat/EvAJob.java @@ -131,12 +131,14 @@ public class EvAJob implements Serializable, InterfaceStatisticsListener { return params; } + @Override public void finalMultiRunResults(String[] header, List multiRunFinalObjDat) { fieldHeaders=header; multiRunFinalObjectData = multiRunFinalObjDat; } + @Override public void notifyGenerationPerformed(String[] header, Object[] statObjects, Double[] statDoubles) { fieldHeaders=header; @@ -145,6 +147,7 @@ public class EvAJob implements Serializable, InterfaceStatisticsListener { // onlineData.add(statObjects); } + @Override public void notifyRunStarted(int runNumber, int plannedMultiRuns, String[] header, String[] metaInfo) { state=StateEnum.running; @@ -152,12 +155,14 @@ public class EvAJob implements Serializable, InterfaceStatisticsListener { // multiRunFinalObjectData = null; } + @Override public void notifyRunStopped(int runsPerformed, boolean completedLastRun) { numRuns=runsPerformed; lastRunIncompl = !completedLastRun; if (TRACE) System.out.println("EvAJob.notifyRunStopped, " + runsPerformed + " " + completedLastRun); } + @Override public boolean notifyMultiRunFinished(String[] header, List multiRunFinalObjDat) { fieldHeaders=header; multiRunFinalObjectData = multiRunFinalObjDat; diff --git a/src/eva2/server/stat/EvAJobList.java b/src/eva2/server/stat/EvAJobList.java index 594b85cc..8ec5bdf3 100644 --- a/src/eva2/server/stat/EvAJobList.java +++ b/src/eva2/server/stat/EvAJobList.java @@ -170,6 +170,7 @@ public class EvAJobList extends PropertySelectableList implements Serial genericArrayEditor.setWithSetButton(false); ActionListener al = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { EvAStatisticalEvaluation.evaluate((InterfaceTextListener) jobList, jobList.getObjects(), genericArrayEditor.getSelectedIndices(), (StatsOnSingleDataSetEnum[]) EvAStatisticalEvaluation.statsParams.getOneSampledStats().getSelectedEnum(StatsOnSingleDataSetEnum.values()), @@ -178,12 +179,14 @@ public class EvAJobList extends PropertySelectableList implements Serial }; ActionListener sl = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { genericArrayEditor.selectDeselectAll(); } }; ActionListener sal = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { jobList.saveSelectedJobs(genericArrayEditor); } @@ -209,6 +212,7 @@ public class EvAJobList extends PropertySelectableList implements Serial private static ActionListener getReuseActionListener(final Component parent, final EvAJobList jobList) { ActionListener al = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { List jobs = jobList.getSelectedJobs(); if (jobs.size() == 1) { @@ -229,6 +233,7 @@ public class EvAJobList extends PropertySelectableList implements Serial private static ActionListener getClearSelectedActionListener(final Component parent, final EvAJobList jobList) { ActionListener al = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { List jobs = jobList.getSelectedJobs(); for (EvAJob j : jobs) { @@ -268,6 +273,7 @@ public class EvAJobList extends PropertySelectableList implements Serial /* * (non-Javadoc) @see eva2.server.stat.InterfaceTextListener#print(java.lang.String) */ + @Override public void print(String str) { if (listeners != null) { for (InterfaceTextListener lst : listeners) { @@ -279,6 +285,7 @@ public class EvAJobList extends PropertySelectableList implements Serial /* * (non-Javadoc) @see eva2.server.stat.InterfaceTextListener#println(java.lang.String) */ + @Override public void println(String str) { if (listeners != null) { for (InterfaceTextListener lst : listeners) { diff --git a/src/eva2/server/stat/StatisticsDummy.java b/src/eva2/server/stat/StatisticsDummy.java index 6365eaa9..8f1e3410 100644 --- a/src/eva2/server/stat/StatisticsDummy.java +++ b/src/eva2/server/stat/StatisticsDummy.java @@ -34,10 +34,12 @@ public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListen consoleOut = doConsoleOut; } + @Override public void addTextListener(InterfaceTextListener listener) { System.err.println("addTextListener not provided!"); } + @Override public void createNextGenerationPerformed(PopulationInterface pop, InterfaceOptimizer opt, List informerList) { bestCurrentIndividual = (AbstractEAIndividual)pop.getBestIndividual(); @@ -49,56 +51,70 @@ public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListen } } + @Override public void createNextGenerationPerformed(double[] bestfit, double[] worstfit, int calls) { } + @Override public double[] getBestFitness() { if (bestIndividualAllover != null) return bestCurrentIndividual.getFitness(); else return null; } + @Override public IndividualInterface getBestSolution() { return bestIndividualAllover; } + @Override public IndividualInterface getRunBestSolution() { return bestRunIndy; } + @Override public InterfaceStatisticsParameter getStatisticsParameter() { return sParams; } + @Override public void printToTextListener(String s) { if (consoleOut) System.out.println(s); } + @Override public boolean removeTextListener(InterfaceTextListener listener) { System.err.println("removeTextListener not provided!"); return false; } + @Override public void startOptPerformed(String InfoString, int runnumber, Object params, List informerList) { if (runnumber==0) bestIndividualAllover = null; bestRunIndy = null; } + @Override public void stopOptPerformed(boolean normal, String stopMessage) {} + @Override public void postProcessingPerformed(Population resultPop) {} + @Override public void print(String str) { if (consoleOut) System.out.print(str); } + @Override public void println(String str) { if (consoleOut) System.out.println(str); } + @Override public void addDataListener(InterfaceStatisticsListener l) { System.err.println("addDataListener not provided!"); } + @Override public boolean removeDataListener(InterfaceStatisticsListener l) { System.err.println("removeDataListener not provided!"); return false; diff --git a/src/eva2/server/stat/StatisticsParameter.java b/src/eva2/server/stat/StatisticsParameter.java index 7bc6581d..a87d136b 100644 --- a/src/eva2/server/stat/StatisticsParameter.java +++ b/src/eva2/server/stat/StatisticsParameter.java @@ -354,6 +354,7 @@ public class StatisticsParameter implements InterfaceStatisticsParameter, Interf * * @see InterfaceAdditionalPopulationInformer */ + @Override public void setInformers(List informers) { ArrayList headerFields = new ArrayList(); ArrayList infoFields = new ArrayList(); diff --git a/src/eva2/server/stat/StatisticsStandalone.java b/src/eva2/server/stat/StatisticsStandalone.java index ed0d6758..fdb3c965 100644 --- a/src/eva2/server/stat/StatisticsStandalone.java +++ b/src/eva2/server/stat/StatisticsStandalone.java @@ -75,6 +75,7 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac this(new StatisticsParameter()); } + @Override protected void initPlots(PopulationInterface pop, List informerList) { if (collectData) { m_ResultData = new ArrayList>(m_StatsParams.getMultiRuns()); @@ -89,12 +90,14 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac } } + @Override protected void plotCurrentResults() { if (collectData && (m_ResultData!=null)) { m_ResultData.get(optRunsPerformed).add(currentStatObjectData); } } + @Override public void plotSpecificData(PopulationInterface pop, List informerList) { if (TRACE) System.out.println(" m_SpecificData !!"); double[] specificData = pop.getSpecificData(); @@ -260,6 +263,7 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac // return m_FitnessMedianofALL; // } + @Override public String getHostName() { return m_MyHostName; } diff --git a/src/eva2/server/stat/StatisticsWithGUI.java b/src/eva2/server/stat/StatisticsWithGUI.java index bdc6716d..1484d6fe 100644 --- a/src/eva2/server/stat/StatisticsWithGUI.java +++ b/src/eva2/server/stat/StatisticsWithGUI.java @@ -100,6 +100,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl /** * */ + @Override public synchronized void startOptPerformed(String infoString, int runNumber, Object goParams, List informerList) { super.startOptPerformed(infoString, runNumber, goParams, informerList); graphInfoString = infoString; @@ -114,6 +115,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl } } + @Override public void stopOptPerformed(boolean normal, String stopMessage) { super.stopOptPerformed(normal, stopMessage); @@ -158,6 +160,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl } } + @Override protected void initPlots(PopulationInterface pop, List informerList) { if (m_StatsParams instanceof StatisticsParameter) { graphDesc = lastFieldSelection.getSelectedWithIndex(); @@ -228,6 +231,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl /** * Plots the selected data to the fitness graphs. */ + @Override protected void plotCurrentResults() { // m_PlotCounter--; @@ -256,6 +260,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl * does not define specific data. However its used by the ES module * implementation. */ + @Override public void plotSpecificData(PopulationInterface pop, List informer) { double[] specificData = pop.getSpecificData(); int calls = pop.getFunctionCalls(); @@ -301,6 +306,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl // } } + @Override public String getHostName() { return hostName; } diff --git a/src/eva2/tools/BasicResourceLoader.java b/src/eva2/tools/BasicResourceLoader.java index 8a9a2fcd..2bd00004 100644 --- a/src/eva2/tools/BasicResourceLoader.java +++ b/src/eva2/tools/BasicResourceLoader.java @@ -394,6 +394,7 @@ public class BasicResourceLoader implements ResourceLoader * @param rawResrcLoc Description of the Parameter * @return the byte array of file. */ + @Override public byte[] getBytesFromResourceLocation(String rawResrcLoc) { return getBytesFromResourceLocation(rawResrcLoc, false); } diff --git a/src/eva2/tools/JPasswordDialog.java b/src/eva2/tools/JPasswordDialog.java index cad408c7..2dd4b2b8 100644 --- a/src/eva2/tools/JPasswordDialog.java +++ b/src/eva2/tools/JPasswordDialog.java @@ -91,6 +91,7 @@ public class JPasswordDialog extends JDialog { * * @since ostermillerutils 1.00.00 */ + @Override public void setName(String name){ this.name.setText(name); } @@ -168,6 +169,7 @@ public class JPasswordDialog extends JDialog { * * @since ostermillerutils 1.00.00 */ + @Override public String getName(){ return name.getText(); } @@ -253,6 +255,7 @@ public class JPasswordDialog extends JDialog { * * @since ostermillerutils 1.00.00 */ + @Override protected void dialogInit(){ @@ -265,6 +268,7 @@ public class JPasswordDialog extends JDialog { super.dialogInit(); KeyListener keyListener = (new KeyAdapter() { + @Override public void keyPressed(KeyEvent e){ if (e.getKeyCode() == KeyEvent.VK_ESCAPE || (e.getSource() == cancelButton @@ -282,6 +286,7 @@ public class JPasswordDialog extends JDialog { addKeyListener(keyListener); ActionListener actionListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e){ Object source = e.getSource(); if (source == name){ diff --git a/src/eva2/tools/KMEANSJAVA.java b/src/eva2/tools/KMEANSJAVA.java index 943e14ec..b3aea968 100644 --- a/src/eva2/tools/KMEANSJAVA.java +++ b/src/eva2/tools/KMEANSJAVA.java @@ -134,6 +134,7 @@ class ClusterComp implements Comparator { /** * */ + @Override public int compare (Object p1,Object p2) { int x1 = ((Cluster) p1).m_SamplesInCluster; int x2 = ((Cluster) p2).m_SamplesInCluster; @@ -146,6 +147,7 @@ class ClusterComp implements Comparator { /** * */ + @Override public boolean equals (Object x) { return false; } diff --git a/src/eva2/tools/MultirunRefiner.java b/src/eva2/tools/MultirunRefiner.java index 03193116..7184ec85 100644 --- a/src/eva2/tools/MultirunRefiner.java +++ b/src/eva2/tools/MultirunRefiner.java @@ -65,6 +65,7 @@ public class MultirunRefiner { this.m_LoadExpItem = new JMenuItem("Load"); this.m_LoadExpItem.setEnabled(true); this.m_LoadExpItem.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent ev) { loadFile(); } @@ -72,6 +73,7 @@ public class MultirunRefiner { this.m_SaveExpItem = new JMenuItem("Save"); this.m_SaveExpItem.setEnabled(true); this.m_SaveExpItem.addActionListener (new java.awt.event.ActionListener () { + @Override public void actionPerformed (java.awt.event.ActionEvent evt) { writeFile(); } @@ -79,6 +81,7 @@ public class MultirunRefiner { this.m_ExitItem = new JMenuItem("Exit"); this.m_ExitItem.setEnabled(true); this.m_ExitItem.addActionListener (new java.awt.event.ActionListener () { + @Override public void actionPerformed (java.awt.event.ActionEvent evt) { System.exit(0); } @@ -93,6 +96,7 @@ public class MultirunRefiner { this.m_Frame.setSize(300,300); this.m_Frame.setLocation(0, 150); this.m_Frame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.exit(0); } @@ -114,6 +118,7 @@ public class MultirunRefiner { refineJButton = new JButton("Refine Multiruns"); refineJButton.addMouseListener (new java.awt.event.MouseAdapter () { + @Override public void mouseClicked (java.awt.event.MouseEvent evt) { m_OutputText.setText(refineToText(refine(m_InputText.getText()))); } @@ -126,6 +131,7 @@ public class MultirunRefiner { // }); exitJButton = new JButton("EXIT"); exitJButton.addMouseListener (new java.awt.event.MouseAdapter () { + @Override public void mouseClicked (java.awt.event.MouseEvent evt) { System.exit (0); } diff --git a/src/eva2/tools/Pair.java b/src/eva2/tools/Pair.java index 0260537d..f9a6af2d 100644 --- a/src/eva2/tools/Pair.java +++ b/src/eva2/tools/Pair.java @@ -49,6 +49,7 @@ public class Pair implements Serializable { * * @see java.lang.Object#clone() */ + @Override public Pair clone() { return new Pair(head, tail); } diff --git a/src/eva2/tools/PairComparator.java b/src/eva2/tools/PairComparator.java index 67289a6c..1aafbf67 100644 --- a/src/eva2/tools/PairComparator.java +++ b/src/eva2/tools/PairComparator.java @@ -21,6 +21,7 @@ public class PairComparator implements Comparator> { * Return 1 if the first is larger, -1 if the second is larger, 0 if they * are equal or not comparable. */ + @Override public int compare(Pair o1, Pair o2) { Pair p1=(Pair)o1; Pair p2=(Pair)o2; diff --git a/src/eva2/tools/ReflectPackage.java b/src/eva2/tools/ReflectPackage.java index 52fc35a9..20e615b9 100644 --- a/src/eva2/tools/ReflectPackage.java +++ b/src/eva2/tools/ReflectPackage.java @@ -40,6 +40,7 @@ public class ReflectPackage { // static HashMap> pathMap = new HashMap>(); static class ClassComparator implements Comparator { + @Override public int compare(Object o1, Object o2) { return (o1.toString().compareTo(o2.toString())); } diff --git a/src/eva2/tools/SelectedTag.java b/src/eva2/tools/SelectedTag.java index 24ea1bc8..e4d76572 100644 --- a/src/eva2/tools/SelectedTag.java +++ b/src/eva2/tools/SelectedTag.java @@ -9,6 +9,7 @@ public class SelectedTag implements java.io.Serializable { protected int m_Selected; protected Tag[] m_Tags; + @Override public Object clone() { SelectedTag result = new SelectedTag(this.m_Selected, this.m_Tags); return (Object) result; @@ -151,6 +152,7 @@ public class SelectedTag implements java.io.Serializable { /** * */ + @Override public boolean equals(Object o) { if ((o == null) || !(o.getClass().equals(this.getClass()))) { return false; @@ -183,6 +185,7 @@ public class SelectedTag implements java.io.Serializable { } } + @Override public String toString() { return m_Tags[m_Selected].getString(); // Character selSign = '*'; diff --git a/src/eva2/tools/SerializedObject.java b/src/eva2/tools/SerializedObject.java index e382880e..efd01e31 100644 --- a/src/eva2/tools/SerializedObject.java +++ b/src/eva2/tools/SerializedObject.java @@ -98,6 +98,7 @@ public class SerializedObject implements Serializable { * @param other the other Object. * @return true if the objects are equal. */ + @Override public final boolean equals(Object other) { // Check class type @@ -123,6 +124,7 @@ public class SerializedObject implements Serializable { * * @return the hashcode for this object. */ + @Override public final int hashCode() { return m_Serialized.length; } @@ -132,6 +134,7 @@ public class SerializedObject implements Serializable { * * @return a String representing this object. */ + @Override public String toString() { return (m_Compressed ? "Compressed object: " : "Uncompressed object: ") + m_Serialized.length + " bytes"; diff --git a/src/eva2/tools/ServerPingThread.java b/src/eva2/tools/ServerPingThread.java index 5c0e5747..c9368c34 100644 --- a/src/eva2/tools/ServerPingThread.java +++ b/src/eva2/tools/ServerPingThread.java @@ -26,6 +26,7 @@ public class ServerPingThread extends Thread { this.hostname = hostname; } + @Override public void run() { while (true) { try { diff --git a/src/eva2/tools/StringSelection.java b/src/eva2/tools/StringSelection.java index 1167762a..56a2e104 100644 --- a/src/eva2/tools/StringSelection.java +++ b/src/eva2/tools/StringSelection.java @@ -104,6 +104,7 @@ public class StringSelection implements Serializable { enumClass = e.getClass(); } + @Override public Object clone() { return new StringSelection(this); } diff --git a/src/eva2/tools/TXTFileFilter.java b/src/eva2/tools/TXTFileFilter.java index 9292e7da..706f2755 100644 --- a/src/eva2/tools/TXTFileFilter.java +++ b/src/eva2/tools/TXTFileFilter.java @@ -25,6 +25,7 @@ public class TXTFileFilter extends FileFilter { public TXTFileFilter() { } + @Override public boolean accept(java.io.File file) { if (file.isDirectory()) return true; String fileName = file.getName(); @@ -33,6 +34,7 @@ public class TXTFileFilter extends FileFilter { else return false; } + @Override public String getDescription() { return "*.TXT; *.txt"; } diff --git a/src/eva2/tools/chart2d/Chart2DDPointContentSelectable.java b/src/eva2/tools/chart2d/Chart2DDPointContentSelectable.java index 8a6dd8e5..cc337fa3 100644 --- a/src/eva2/tools/chart2d/Chart2DDPointContentSelectable.java +++ b/src/eva2/tools/chart2d/Chart2DDPointContentSelectable.java @@ -32,6 +32,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten /** this method has to be overridden to paint the icon. The point itself lies * at coordinates (0, 0) */ + @Override public void paint( Graphics g ){ Color prev = g.getColor(); if (this.m_Indy.isMarked()) this.m_Fill = Color.RED; @@ -47,6 +48,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten * icon is visible * @return the border */ + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } @@ -69,6 +71,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten * it should need more than one listener to this abstruse event * @param a The selection listener */ + @Override public void addSelectionListener(InterfaceRefSolutionListener a) { this.m_Listener = a; } @@ -76,12 +79,14 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten /** This method returns the selection listner to the PointIcon * @return InterfaceSelectionListener */ + @Override public InterfaceRefSolutionListener getSelectionListener() { return this.m_Listener; } /** This method allows to remove the selection listner to the PointIcon */ + @Override public void removeSelectionListeners() { this.m_Listener = null; } @@ -89,9 +94,11 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten /** This method allows you to set the according individual * @param indy AbstractEAIndividual */ + @Override public void setEAIndividual(AbstractEAIndividual indy) { this.m_Indy = indy; } + @Override public AbstractEAIndividual getEAIndividual() { return this.m_Indy; } @@ -99,19 +106,23 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten /** This method allows you to set the according optimization problem * @param problem InterfaceOptimizationProblem */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem() { return this.m_Problem; } /** This method allows you to draw additional data of the individual */ + @Override public void showIndividual() { JFrame newFrame = new JFrame(); newFrame.setTitle(this.m_Indy.getName()+": "+this.m_Indy); newFrame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.gc(); } diff --git a/src/eva2/tools/chart2d/Chart2DDPointIconCircle.java b/src/eva2/tools/chart2d/Chart2DDPointIconCircle.java index babd2b99..0826556d 100644 --- a/src/eva2/tools/chart2d/Chart2DDPointIconCircle.java +++ b/src/eva2/tools/chart2d/Chart2DDPointIconCircle.java @@ -20,6 +20,7 @@ public class Chart2DDPointIconCircle implements DPointIcon { * this method has to be overridden to paint the icon. The point itself lies * at coordinates (0, 0) */ + @Override public void paint( Graphics g ){ Color prev = g.getColor(); if (m_Fill != null) { @@ -37,6 +38,7 @@ public class Chart2DDPointIconCircle implements DPointIcon { * * @return the border */ + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } diff --git a/src/eva2/tools/chart2d/Chart2DDPointIconContent.java b/src/eva2/tools/chart2d/Chart2DDPointIconContent.java index 06e2cc47..b531f302 100644 --- a/src/eva2/tools/chart2d/Chart2DDPointIconContent.java +++ b/src/eva2/tools/chart2d/Chart2DDPointIconContent.java @@ -28,6 +28,7 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo * this method has to be overridden to paint the icon. The point itself lies * at coordinates (0, 0) */ + @Override public void paint( Graphics g ){ g.drawOval(-4, -4, 8, 8); g.drawLine(-2, 2, 2,-2); @@ -40,6 +41,7 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo * * @return the border */ + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } @@ -47,9 +49,11 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo /** This method allows you to set the according individual * @param indy AbstractEAIndividual */ + @Override public void setEAIndividual(AbstractEAIndividual indy) { this.m_Indy = indy; } + @Override public AbstractEAIndividual getEAIndividual() { return this.m_Indy; } @@ -57,15 +61,18 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo /** This method allows you to set the according optimization problem * @param problem InterfaceOptimizationProblem */ + @Override public void setProblem(InterfaceOptimizationProblem problem) { this.m_Problem = problem; } + @Override public InterfaceOptimizationProblem getProblem() { return this.m_Problem; } /** This method allows you to draw additional data of the individual */ + @Override public void showIndividual() { JFrame newFrame = new JFrame(); if (this.m_Indy == null) { @@ -74,6 +81,7 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo } newFrame.setTitle(this.m_Indy.getName()+": "+this.m_Indy); newFrame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent ev) { System.gc(); } diff --git a/src/eva2/tools/chart2d/Chart2DDPointIconCross.java b/src/eva2/tools/chart2d/Chart2DDPointIconCross.java index 6bb22401..dcf97021 100644 --- a/src/eva2/tools/chart2d/Chart2DDPointIconCross.java +++ b/src/eva2/tools/chart2d/Chart2DDPointIconCross.java @@ -19,6 +19,7 @@ public class Chart2DDPointIconCross implements DPointIcon { * this method has to be overridden to paint the icon. The point itself lies * at coordinates (0, 0) */ + @Override public void paint( Graphics g ){ Color prev = g.getColor(); g.setColor(this.m_Color); @@ -33,6 +34,7 @@ public class Chart2DDPointIconCross implements DPointIcon { * * @return the border */ + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } diff --git a/src/eva2/tools/chart2d/Chart2DDPointIconPoint.java b/src/eva2/tools/chart2d/Chart2DDPointIconPoint.java index 7e3dde9f..7514819f 100644 --- a/src/eva2/tools/chart2d/Chart2DDPointIconPoint.java +++ b/src/eva2/tools/chart2d/Chart2DDPointIconPoint.java @@ -21,6 +21,7 @@ public class Chart2DDPointIconPoint implements DPointIcon { * this method has to be overridden to paint the icon. The point itself lies * at coordinates (0, 0) */ + @Override public void paint( Graphics g ){ Color prev = g.getColor(); if (m_Fill != null) { @@ -38,6 +39,7 @@ public class Chart2DDPointIconPoint implements DPointIcon { * * @return the border */ + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } diff --git a/src/eva2/tools/chart2d/Chart2DDPointIconText.java b/src/eva2/tools/chart2d/Chart2DDPointIconText.java index 48082f39..aa7e939b 100644 --- a/src/eva2/tools/chart2d/Chart2DDPointIconText.java +++ b/src/eva2/tools/chart2d/Chart2DDPointIconText.java @@ -32,6 +32,7 @@ public class Chart2DDPointIconText implements DPointIcon { * this method has to be overridden to paint the icon. The point itself lies * at coordinates (0, 0) */ + @Override public void paint( Graphics g ){ this.m_Icon.paint(g); g.setColor(m_Color); @@ -44,6 +45,7 @@ public class Chart2DDPointIconText implements DPointIcon { * * @return the border */ + @Override public DBorder getDBorder() { return new DBorder(4, 4, 4, 4); } diff --git a/src/eva2/tools/chart2d/DArea.java b/src/eva2/tools/chart2d/DArea.java index 8737968d..7189a710 100644 --- a/src/eva2/tools/chart2d/DArea.java +++ b/src/eva2/tools/chart2d/DArea.java @@ -118,6 +118,7 @@ public class DArea extends JComponent implements DParent, Printable { * @param clip * the java.awt.Insets object of the new clip */ + @Override public void addDBorder(DBorder b) { dborder.insert(b); } @@ -128,6 +129,7 @@ public class DArea extends JComponent implements DParent, Printable { * @param e * the new DElement */ + @Override public void addDElement(DElement e) { container.addDElement(e); } @@ -139,6 +141,7 @@ public class DArea extends JComponent implements DParent, Printable { * the element * @return if it is contained */ + @Override public boolean contains(DElement e) { return container.contains(e); } @@ -157,6 +160,7 @@ public class DArea extends JComponent implements DParent, Printable { * * @return the elements of the container */ + @Override public DElement[] getDElements() { return container.getDElements(); } @@ -358,6 +362,7 @@ public class DArea extends JComponent implements DParent, Printable { * @param g * the java.awt.Graphics object */ + @Override public void paint(Graphics g) { if (TRACE) System.out.println("DArea.paint(Graphics)"); @@ -477,6 +482,7 @@ public class DArea extends JComponent implements DParent, Printable { * * @return int @see java.awt.print.Printable */ + @Override public int print(Graphics g, PageFormat pf, int pi) { if (TRACE) System.out.println("DArea.print(...)"); @@ -537,6 +543,7 @@ public class DArea extends JComponent implements DParent, Printable { * @param e * the element to remove */ + @Override public boolean removeDElement(DElement e) { return container.removeDElement(e); } @@ -547,6 +554,7 @@ public class DArea extends JComponent implements DParent, Printable { * @param r * the rectangle to repaint */ + @Override public void repaint(DRectangle r) { if (TRACE) System.out.println("DArea.repaint(DRectangle)" + r); @@ -570,6 +578,7 @@ public class DArea extends JComponent implements DParent, Printable { } } + @Override public void restoreBorder() { dborder = container.getDBorder(); if (TRACE) diff --git a/src/eva2/tools/chart2d/DArray.java b/src/eva2/tools/chart2d/DArray.java index 9f268715..62e80924 100644 --- a/src/eva2/tools/chart2d/DArray.java +++ b/src/eva2/tools/chart2d/DArray.java @@ -60,6 +60,7 @@ public class DArray implements DIntDoubleMap{ * @param source the source value * @param image the image value */ + @Override public boolean setImage(int source, double image){ if(source<0 || source>=size) throw new ArrayIndexOutOfBoundsException(source); @@ -83,6 +84,7 @@ public class DArray implements DIntDoubleMap{ // new ArrayIndexOutOfBoundsException(source); // return value[source]; // } + @Override public double getImage(int source){ if(source<0) new ArrayIndexOutOfBoundsException(source); if(source>=size && size > 1) return value[size-1]; @@ -97,6 +99,7 @@ public class DArray implements DIntDoubleMap{ * has been changed by this method call, else it returns * false @see #getMinImageValue(), #getMaxImageValue() */ + @Override public boolean addImage(double image){ if( size >= value.length ){ int new_length = (int)(value.length * capacity_multiplier); @@ -121,6 +124,7 @@ public class DArray implements DIntDoubleMap{ * * @return the size of the source value set */ + @Override public int getSize(){ return size; } @@ -130,6 +134,7 @@ public class DArray implements DIntDoubleMap{ * * @return true if one of them changed */ + @Override public boolean restore(){ if( size == 0 ) return false; double old_min = min, old_max = max; @@ -148,6 +153,7 @@ public class DArray implements DIntDoubleMap{ /** * throws all information away */ + @Override public void reset(){ size = 0; value = new double[initial_capacity]; @@ -158,6 +164,7 @@ public class DArray implements DIntDoubleMap{ * * @return the minimal image value */ + @Override public double getMinImageValue(){ if( size == 0 ) throw new IllegalArgumentException("DArray is empty. No minimal value exists"); @@ -168,6 +175,7 @@ public class DArray implements DIntDoubleMap{ * Return the minimal positive image value or the maximal value if none is positive. * @return */ + @Override public double getMinPositiveImageValue() { if ( size==0) throw new IllegalArgumentException("DArray is empty. No minimal value exists"); @@ -178,6 +186,7 @@ public class DArray implements DIntDoubleMap{ * * @return the maxmal image value */ + @Override public double getMaxImageValue(){ if( size == 0 ) throw new IllegalArgumentException("DArray is empty. No maximal value exists"); @@ -192,6 +201,7 @@ public class DArray implements DIntDoubleMap{ * @return true when the object is an DArray object, containing * the same values */ + @Override public boolean equals(Object o){ if( !(o instanceof DArray) ) return false; DArray comp = (DArray)o; @@ -204,6 +214,7 @@ public class DArray implements DIntDoubleMap{ return true; } + @Override public String toString(){ String text = "eva2.tools.chart2d.DArray[size:"+size; if( size < 11 ) diff --git a/src/eva2/tools/chart2d/DBorder.java b/src/eva2/tools/chart2d/DBorder.java index 8fd2fec3..ef49fb32 100644 --- a/src/eva2/tools/chart2d/DBorder.java +++ b/src/eva2/tools/chart2d/DBorder.java @@ -37,12 +37,14 @@ public class DBorder extends Insets{ return changed; } + @Override public boolean equals( Object o ){ if( o instanceof DBorder ) return super.equals( o ); return false; } + @Override public String toString(){ return "eva2.tools.chart2d.DBorder[top="+top+",left="+left +",bottom="+bottom+",right="+right+"]"; diff --git a/src/eva2/tools/chart2d/DComponent.java b/src/eva2/tools/chart2d/DComponent.java index e0481a5a..61fedc7a 100644 --- a/src/eva2/tools/chart2d/DComponent.java +++ b/src/eva2/tools/chart2d/DComponent.java @@ -70,6 +70,7 @@ public abstract class DComponent implements DElement /** * returns the rectangle in which the object lies */ + @Override public DRectangle getRectangle(){ return (DRectangle)rectangle.clone(); } @@ -80,6 +81,7 @@ public abstract class DComponent implements DElement * * @param b the new DBorder */ + @Override public void setDBorder( DBorder b ){ if( parent != null ) { if( border.insert(b) ) { parent.addDBorder( b ); repaint(); } @@ -93,6 +95,7 @@ public abstract class DComponent implements DElement * * @return the DBorder of the DComponent */ + @Override public DBorder getDBorder(){ return border; } @@ -101,6 +104,7 @@ public abstract class DComponent implements DElement * sets the parent of the component, which should take care of painting the * component to the right time */ + @Override public void setDParent( DParent parent ){ if( this.parent != null && this.parent != parent ){ this.parent.removeDElement( this ); @@ -112,11 +116,13 @@ public abstract class DComponent implements DElement /** * returns the parent of the component */ + @Override public DParent getDParent(){ return parent; } /** * invoces the parent to repaint the rectangle in which the component lies */ + @Override public void repaint(){ //System.out.println("DComponent.repaint()"); if( parent != null ) parent.repaint( getRectangle() ); @@ -125,6 +131,7 @@ public abstract class DComponent implements DElement /** * sets the color of the component */ + @Override public void setColor( Color color ){ if( this.color == null || !this.color.equals( color ) ) { this.color = color; @@ -135,11 +142,13 @@ public abstract class DComponent implements DElement /** * returns the color of the component */ + @Override public Color getColor(){ return color; } /** * sets the component visible or not */ + @Override public void setVisible( boolean aFlag ){ boolean changed = ( aFlag != visible ); visible = aFlag; @@ -150,6 +159,7 @@ public abstract class DComponent implements DElement * returns if the component should be visible when the parent shows the right * area */ + @Override public boolean isVisible(){ return visible; } } diff --git a/src/eva2/tools/chart2d/DContainer.java b/src/eva2/tools/chart2d/DContainer.java index 92e09394..9d0a10f8 100644 --- a/src/eva2/tools/chart2d/DContainer.java +++ b/src/eva2/tools/chart2d/DContainer.java @@ -38,6 +38,7 @@ public class DContainer extends DComponent implements DParent{ keys = new Vector(initial_capacity); } + @Override public void repaint( DRectangle r ){ DParent parent = getDParent(); if( parent != null ) parent.repaint( r ); @@ -51,6 +52,7 @@ public class DContainer extends DComponent implements DParent{ * * @param e the new DElement to add */ + @Override public void addDElement( DElement e ){ addDElement( null, e ); } @@ -96,6 +98,7 @@ public class DContainer extends DComponent implements DParent{ * @param e the DElement to remove * @return if this was possible */ + @Override public boolean removeDElement( DElement e ){ int index = elements.indexOf( e ); if( index > -1 ){ @@ -124,6 +127,7 @@ public class DContainer extends DComponent implements DParent{ * * @return the elements of the container */ + @Override public DElement[] getDElements(){ DElement[] es = new DElement[ elements.size() ]; elements.toArray(es); @@ -151,6 +155,7 @@ public class DContainer extends DComponent implements DParent{ * * @param m the DMeasures object */ + @Override public void paint( DMeasures m ){ DElement e; for( int i=0; iDMeasures object to paint the grid */ + @Override public void paint( DMeasures m ){ Graphics g = m.getGraphics(); if( color != null ) g.setColor( color ); @@ -128,6 +129,7 @@ public class DGrid extends DComponent } } + @Override public String toString(){ return "chart2d.DGrid[ hor: "+hor_dist+", ver: "+ver_dist+" ]"; } diff --git a/src/eva2/tools/chart2d/DLine.java b/src/eva2/tools/chart2d/DLine.java index 4c6da163..b826dda2 100644 --- a/src/eva2/tools/chart2d/DLine.java +++ b/src/eva2/tools/chart2d/DLine.java @@ -44,6 +44,7 @@ public class DLine extends DComponent this.color = color; } + @Override public DRectangle getRectangle(){ double x = start.x, y = start.y, width = end.x - x, height = end.y - y; if( width < 0 ) { x += width; width *= -1; } @@ -51,6 +52,7 @@ public class DLine extends DComponent return new DRectangle( x, y, width, height ); } + @Override public void paint( DMeasures m ){ //System.out.println("DLine.paint(Measures): "+this); Graphics g = m.getGraphics(); @@ -64,6 +66,7 @@ public class DLine extends DComponent } } + @Override public String toString(){ return "DLine[("+start.x+","+start.y+") --> ("+end.x+","+end.y+", color: "+color+"]"; } diff --git a/src/eva2/tools/chart2d/DPoint.java b/src/eva2/tools/chart2d/DPoint.java index d8a1189e..d9f662b3 100644 --- a/src/eva2/tools/chart2d/DPoint.java +++ b/src/eva2/tools/chart2d/DPoint.java @@ -40,6 +40,7 @@ public class DPoint extends DComponent rectangle = new DRectangle( x, y, 0, 0 ); } + @Override public void paint( DMeasures m ){ Graphics g = m.getGraphics(); if( color != null ) g.setColor( color ); @@ -80,12 +81,14 @@ public class DPoint extends DComponent return icon; } + @Override public Object clone(){ DPoint copy = new DPoint( x, y ); copy.color = color; return copy; } + @Override public String toString(){ String text = "DPoint["; if( label != null ) text += label+", "; diff --git a/src/eva2/tools/chart2d/DPointSet.java b/src/eva2/tools/chart2d/DPointSet.java index 052e75fb..b9385911 100644 --- a/src/eva2/tools/chart2d/DPointSet.java +++ b/src/eva2/tools/chart2d/DPointSet.java @@ -60,6 +60,7 @@ public class DPointSet extends DComponent { * -------------------------------------------------------------------------* public methods *------------------------------------------------------------------------- */ + @Override public void paint(DMeasures m) { Graphics2D g = (Graphics2D) m.getGraphics(); g.setStroke(stroke); @@ -244,6 +245,7 @@ public class DPointSet extends DComponent { rectangle = DRectangle.getEmpty(); } + @Override public String toString() { String text = "eva2.tools.chart2d.DPointSet[size:" + getSize(); for (int i = 0; i < x.getSize(); i++) { diff --git a/src/eva2/tools/chart2d/DRectangle.java b/src/eva2/tools/chart2d/DRectangle.java index dd98b062..a4fa75a7 100644 --- a/src/eva2/tools/chart2d/DRectangle.java +++ b/src/eva2/tools/chart2d/DRectangle.java @@ -50,8 +50,10 @@ public class DRectangle extends DComponent status = PART; } + @Override public DRectangle getRectangle(){ return this; } + @Override public void paint( DMeasures m ){ if( isEmpty() ) return; Graphics g = m.getGraphics(); @@ -207,6 +209,7 @@ public class DRectangle extends DComponent return changed; } + @Override public Object clone(){ DRectangle copy = new DRectangle( x, y, width, height ); copy.status = status; @@ -214,6 +217,7 @@ public class DRectangle extends DComponent return copy; } + @Override public String toString(){ String text = "DRectangle[ "; switch( status ){ diff --git a/src/eva2/tools/chart2d/ScaledBorder.java b/src/eva2/tools/chart2d/ScaledBorder.java index 14ae9edf..f43bbbd4 100644 --- a/src/eva2/tools/chart2d/ScaledBorder.java +++ b/src/eva2/tools/chart2d/ScaledBorder.java @@ -211,6 +211,7 @@ public class ScaledBorder implements Border return rect; } + @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){ if( under_construction ) System.out.println("ScaledBorder.paintBorder()"); @@ -462,6 +463,7 @@ public class ScaledBorder implements Border return d; } + @Override public boolean isBorderOpaque(){ return outer_border.isBorderOpaque(); } @@ -535,6 +537,7 @@ public class ScaledBorder implements Border * it. Depends on the decimal format applied and the FontMetrics of the * current Graphics instance. */ + @Override public Insets getBorderInsets(Component c){ if( under_construction ) System.out.println("ScaledBorder.getBorderInsets()"); if( !do_refresh && old_insets != null ) return old_insets; diff --git a/src/eva2/tools/chart2d/SlimRect.java b/src/eva2/tools/chart2d/SlimRect.java index 1ad653df..d234de83 100644 --- a/src/eva2/tools/chart2d/SlimRect.java +++ b/src/eva2/tools/chart2d/SlimRect.java @@ -48,6 +48,7 @@ public class SlimRect { return (contains(xpos,ypos) && contains(xpos+wd, ypos+ht)); } + @Override public String toString() { return "SlimRect["+x+","+y+"/"+width+","+height+"]"; } diff --git a/src/eva2/tools/jproxy/ComAdapter.java b/src/eva2/tools/jproxy/ComAdapter.java index fe05e1f3..e5fc1987 100644 --- a/src/eva2/tools/jproxy/ComAdapter.java +++ b/src/eva2/tools/jproxy/ComAdapter.java @@ -563,6 +563,7 @@ class RMIRegistration implements Runnable { comAd = comAdapter; } + @Override public void run() { if (TRACE) System.out.println("LaunchRMIRegistry on Client on PORT " + ComAdapter.PORT); diff --git a/src/eva2/tools/jproxy/JProxyRemoteThread.java b/src/eva2/tools/jproxy/JProxyRemoteThread.java index 79fad6c5..a48013d5 100644 --- a/src/eva2/tools/jproxy/JProxyRemoteThread.java +++ b/src/eva2/tools/jproxy/JProxyRemoteThread.java @@ -89,6 +89,7 @@ public class JProxyRemoteThread implements InvocationHandler, Serializable { /** * */ + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object ret = null; if (method.getName().equals("getServerName")) { diff --git a/src/eva2/tools/jproxy/MainAdapterClientImpl.java b/src/eva2/tools/jproxy/MainAdapterClientImpl.java index 36238d1f..c02edb2e 100644 --- a/src/eva2/tools/jproxy/MainAdapterClientImpl.java +++ b/src/eva2/tools/jproxy/MainAdapterClientImpl.java @@ -38,6 +38,7 @@ public class MainAdapterClientImpl implements MainAdapterClient { /** * */ + @Override public RMIInvocationHandler getRMIHandler(Object obj) { if (TRACE) System.out.println("MainAdapterClientImpl.getRMIHandler"); RMIInvocationHandler ret = null; @@ -51,6 +52,7 @@ public class MainAdapterClientImpl implements MainAdapterClient { /** * */ + @Override public RMIThreadInvocationHandler getRMIThreadHandler(Object obj) { if (TRACE) System.out.println("MainAdapterClientImpl.getRMIThreadHandler"); RMIThreadInvocationHandler ret = null; @@ -64,6 +66,7 @@ public class MainAdapterClientImpl implements MainAdapterClient { /** * */ + @Override public String getHostName () { return m_HostName; } diff --git a/src/eva2/tools/jproxy/MainAdapterImpl.java b/src/eva2/tools/jproxy/MainAdapterImpl.java index c0f5f0d5..569925d5 100644 --- a/src/eva2/tools/jproxy/MainAdapterImpl.java +++ b/src/eva2/tools/jproxy/MainAdapterImpl.java @@ -34,6 +34,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public void setBuf(String s) { m_Buf = s; } @@ -41,6 +42,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public void restartServer() { LOGGER.log(Level.INFO, "Received a Message to restart the server."); try { @@ -58,6 +60,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public void killServer() { LOGGER.log(Level.INFO, "Received a Message to kill the server."); KillThread x = new KillThread(); @@ -67,6 +70,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public String getBuf() { return m_Buf; } @@ -74,6 +78,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public String getExecOutput(String command) { StringBuffer output = new StringBuffer(); try { @@ -94,6 +99,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public RMIInvocationHandler getRMIHandler(Object obj) { System.out.println("getRMIHandler"); RMIInvocationHandler ret = null; @@ -108,6 +114,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public RMIThreadInvocationHandler getRMIThreadHandler(Object obj) { RMIThreadInvocationHandler ret = null; try { @@ -122,6 +129,7 @@ public class MainAdapterImpl implements MainAdapter { /** * */ + @Override public void setRemoteThis(MainAdapter x) { remoteThis = x; } @@ -135,6 +143,7 @@ class KillThread extends Thread { /** * */ + @Override public void run() { try { sleep(3000); diff --git a/src/eva2/tools/jproxy/RMIInvocationHandlerImpl.java b/src/eva2/tools/jproxy/RMIInvocationHandlerImpl.java index 67596361..4defdb50 100644 --- a/src/eva2/tools/jproxy/RMIInvocationHandlerImpl.java +++ b/src/eva2/tools/jproxy/RMIInvocationHandlerImpl.java @@ -65,12 +65,14 @@ public class RMIInvocationHandlerImpl extends UnicastRemoteObject implements RMI /** * */ + @Override public void setWrapper(Object Wrapper) throws RemoteException { m_Wrapper = Wrapper; } /** * */ + @Override public Object getWrapper () throws RemoteException { return m_Wrapper; } @@ -78,6 +80,7 @@ public class RMIInvocationHandlerImpl extends UnicastRemoteObject implements RMI /** * */ + @Override public Object invoke (String m, Object[] args) throws RemoteException { Object ret=null; String Name = ""; diff --git a/src/eva2/tools/jproxy/RMIProxyLocal.java b/src/eva2/tools/jproxy/RMIProxyLocal.java index c801af57..93513717 100644 --- a/src/eva2/tools/jproxy/RMIProxyLocal.java +++ b/src/eva2/tools/jproxy/RMIProxyLocal.java @@ -91,6 +91,7 @@ public class RMIProxyLocal implements InvocationHandler, Serializable { /** * */ + @Override public Object invoke (Object proxy, Method m, Object[] args) throws Throwable { return m_RMIHandler.invoke(m.getName(),args); } diff --git a/src/eva2/tools/jproxy/RMIProxyLocalThread.java b/src/eva2/tools/jproxy/RMIProxyLocalThread.java index 2d8bbf84..5fce2e02 100644 --- a/src/eva2/tools/jproxy/RMIProxyLocalThread.java +++ b/src/eva2/tools/jproxy/RMIProxyLocalThread.java @@ -90,6 +90,7 @@ public class RMIProxyLocalThread implements InvocationHandler,Serializable { /** * */ + @Override public Object invoke (Object proxy, Method m, Object[] args) throws Throwable { //long start = System.currentTimeMillis(); //System.out.println("Before invoke:" +m.getName()); diff --git a/src/eva2/tools/jproxy/RMIProxyRemote.java b/src/eva2/tools/jproxy/RMIProxyRemote.java index 001de5e5..6e4eb2c5 100644 --- a/src/eva2/tools/jproxy/RMIProxyRemote.java +++ b/src/eva2/tools/jproxy/RMIProxyRemote.java @@ -94,6 +94,7 @@ public class RMIProxyRemote implements InvocationHandler,Serializable { /** * */ + @Override public Object invoke (Object proxy, Method m, Object[] args) throws Throwable { long start = System.currentTimeMillis(); ++m_counter; diff --git a/src/eva2/tools/jproxy/RMIProxyRemoteThread.java b/src/eva2/tools/jproxy/RMIProxyRemoteThread.java index ac534218..7340efbc 100644 --- a/src/eva2/tools/jproxy/RMIProxyRemoteThread.java +++ b/src/eva2/tools/jproxy/RMIProxyRemoteThread.java @@ -113,6 +113,7 @@ public class RMIProxyRemoteThread implements InvocationHandler, /** * */ + @Override public Object invoke (Object proxy, Method m, Object[] args) throws Throwable { //long start = System.currentTimeMillis(); //System.out.println("Before invoke:" +m.getName()); diff --git a/src/eva2/tools/jproxy/RMIThreadInvocationHandlerImpl.java b/src/eva2/tools/jproxy/RMIThreadInvocationHandlerImpl.java index 3dc66260..d1d466cd 100644 --- a/src/eva2/tools/jproxy/RMIThreadInvocationHandlerImpl.java +++ b/src/eva2/tools/jproxy/RMIThreadInvocationHandlerImpl.java @@ -37,6 +37,7 @@ public class RMIThreadInvocationHandlerImpl extends UnicastRemoteObject implemen * * @return */ + @Override public String getServerName() { return m_hostname; } @@ -86,18 +87,21 @@ public class RMIThreadInvocationHandlerImpl extends UnicastRemoteObject implemen /** * */ + @Override public void setWrapper(Object Wrapper) throws RemoteException { m_Wrapper = Wrapper; } /** * */ + @Override public Object getWrapper () throws RemoteException { return m_Wrapper; } /** * */ + @Override public Object invoke (String m, Object[] args) throws RemoteException { Object ret=null; String Name = ""; diff --git a/src/eva2/tools/jproxy/ThreadProxy.java b/src/eva2/tools/jproxy/ThreadProxy.java index 7916d3a0..ea77ea49 100644 --- a/src/eva2/tools/jproxy/ThreadProxy.java +++ b/src/eva2/tools/jproxy/ThreadProxy.java @@ -62,6 +62,7 @@ public class ThreadProxy implements InvocationHandler, /** * */ + @Override public Object invoke (Object proxy,Method method,Object[] args) throws Throwable { Class rettype = method.getReturnType(); if (rettype.equals(Void.TYPE)== true) { diff --git a/src/eva2/tools/jproxy/XThread.java b/src/eva2/tools/jproxy/XThread.java index 031f1bb5..7db9c619 100644 --- a/src/eva2/tools/jproxy/XThread.java +++ b/src/eva2/tools/jproxy/XThread.java @@ -175,6 +175,7 @@ public class XThread extends Thread implements Serializable { /** * */ + @Override public void run() { if (m_Method != null) { //setPriority(Thread.MAX_PRIORITY); diff --git a/src/eva2/tools/math/BayNet.java b/src/eva2/tools/math/BayNet.java index 2400009d..79104ea9 100644 --- a/src/eva2/tools/math/BayNet.java +++ b/src/eva2/tools/math/BayNet.java @@ -49,6 +49,7 @@ public class BayNet { this.lowerProbLimit = b.lowerProbLimit; } + @Override public Object clone(){ return new BayNet(this); } diff --git a/src/eva2/tools/math/BayNode.java b/src/eva2/tools/math/BayNode.java index 46b3f450..8705c855 100644 --- a/src/eva2/tools/math/BayNode.java +++ b/src/eva2/tools/math/BayNode.java @@ -31,6 +31,7 @@ public class BayNode { this.calculated = b.calculated; } + @Override public Object clone(){ return new BayNode(this); } diff --git a/src/eva2/tools/math/Jama/Matrix.java b/src/eva2/tools/math/Jama/Matrix.java index fb6e7ad7..4442dd2a 100644 --- a/src/eva2/tools/math/Jama/Matrix.java +++ b/src/eva2/tools/math/Jama/Matrix.java @@ -240,6 +240,7 @@ public class Matrix implements Cloneable, Serializable { /** Clone the Matrix object. */ + @Override public Object clone () { return this.copy(); } @@ -890,6 +891,7 @@ public class Matrix implements Cloneable, Serializable { } } + @Override public String toString() { StringBuffer sb = new StringBuffer(); for (int i=0; i