Ejemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  public void initialise(Problem problem) {
    StructuredType harmony = problem.getDomain().getBuiltRepresenation().getClone();
    harmony.randomize(new MersenneTwister());

    setCandidateSolution(harmony);
    this.getProperties().put(EntityType.FITNESS, InferiorFitness.instance());
  }
  /**
   * Update personal best if and only if the particle is within the bounds of the search space /
   * problem.
   *
   * @param particle The particle to update.
   */
  @Override
  public void updatePersonalBest(Particle particle) {
    if (!Types.isInsideBounds(particle.getPosition())) {
      particle.getProperties().put(EntityType.FITNESS, InferiorFitness.instance());
      return;
    }

    delegate.updatePersonalBest(particle);
  }
 /** {@inheritDoc} */
 @Override
 public void algorithmInitialisation() {
   if (problem != null) {
     optimisationAlgorithm.setOptimisationProblem(problem);
   }
   fitness = InferiorFitness.instance();
   restarts = 0;
   algorithm.performInitialisation();
   solution = optimisationAlgorithm.getBestSolution();
 }
 @Override
 public Fitness getFitness(Individual entity) {
   return InferiorFitness.instance();
 }