Minor visibility changes to ES.

This commit is contained in:
Marcel Kronfeld 2009-03-19 10:21:17 +00:00
parent e3a13a495e
commit ce386ba34c
2 changed files with 11 additions and 8 deletions

View File

@ -16,7 +16,6 @@ import eva2.server.go.operators.crossover.NoCrossover;
import eva2.server.go.operators.mutation.InterfaceMutation; import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.NoMutation; import eva2.server.go.operators.mutation.NoMutation;
import eva2.server.go.populations.Population; import eva2.server.go.populations.Population;
import eva2.server.go.problems.AbstractOptimizationProblem;
import eva2.server.go.problems.InterfaceOptimizationProblem; import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR; import eva2.tools.EVAERROR;
@ -913,6 +912,9 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
sb.append(b[i].getStringRepresentation()); sb.append(b[i].getStringRepresentation());
if ((i+1) < b.length) sb.append(separator); if ((i+1) < b.length) sb.append(separator);
} }
} else if (BeanInspector.hasMethod(individual, "toString") != null) {
EVAERROR.errorMsgOnce("warning in AbstractEAIndividual::getDefaultDataString: type " + individual.getClass() + " has no default data representation, using toString...");
return individual.toString();
} else { } else {
System.err.println("error in AbstractEAIndividual::getDefaultDataString: type " + individual.getClass() + " not implemented"); System.err.println("error in AbstractEAIndividual::getDefaultDataString: type " + individual.getClass() + " not implemented");
} }

View File

@ -34,11 +34,11 @@ import eva2.server.go.problems.InterfaceOptimizationProblem;
public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializable { public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializable {
//private double m_MyuRatio = 6; //private double m_MyuRatio = 6;
private int m_Mu = 5; protected int m_Mu = 5;
private int m_Lambda = 20; protected int m_Lambda = 20;
private boolean m_UsePlusStrategy = false; protected boolean m_UsePlusStrategy = false;
private Population m_Population = new Population(); protected Population m_Population = new Population();
private InterfaceOptimizationProblem m_Problem = new B1Problem(); protected InterfaceOptimizationProblem m_Problem = new B1Problem();
private InterfaceSelection m_ParentSelection = new SelectRandom(); private InterfaceSelection m_ParentSelection = new SelectRandom();
private InterfaceSelection m_PartnerSelection = new SelectRandom(); private InterfaceSelection m_PartnerSelection = new SelectRandom();
private InterfaceSelection m_EnvironmentSelection = new SelectBestIndividuals(); private InterfaceSelection m_EnvironmentSelection = new SelectBestIndividuals();
@ -125,7 +125,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
* given problem. * given problem.
* @param population The population that is to be evaluated * @param population The population that is to be evaluated
*/ */
private void evaluatePopulation(Population population) { protected void evaluatePopulation(Population population) {
this.m_Problem.evaluate(population); this.m_Problem.evaluate(population);
population.incrGeneration(); population.incrGeneration();
} }
@ -144,7 +144,8 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
// else this.m_Population.setPopulationSize(lambda); // else this.m_Population.setPopulationSize(lambda);
// } // }
/** This method will generate the offspring population from the /**
* This method will generate the offspring population from the
* given population of evaluated individuals. * given population of evaluated individuals.
*/ */
protected Population generateEvalChildren(Population fromPopulation) { protected Population generateEvalChildren(Population fromPopulation) {