コード例 #1
0
ファイル: Harmony.java プロジェクト: JollyRogerAllDay/cilib
  /** {@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());
  }
コード例 #2
0
  /**
   * 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);
  }
コード例 #3
0
 /** {@inheritDoc} */
 @Override
 public void algorithmInitialisation() {
   if (problem != null) {
     optimisationAlgorithm.setOptimisationProblem(problem);
   }
   fitness = InferiorFitness.instance();
   restarts = 0;
   algorithm.performInitialisation();
   solution = optimisationAlgorithm.getBestSolution();
 }
コード例 #4
0
 @Override
 public Fitness getFitness(Individual entity) {
   return InferiorFitness.instance();
 }