/** Test of reinitialiseContext method, of class CooperativeDataClusteringPSOIterationStrategy. */
  @Test
  public void testReinitialiseContext() {
    Rand.setSeed(0);
    DataClusteringPSO instance = new DataClusteringPSO();

    SlidingWindow window = new SlidingWindow();
    window.setSourceURL("library/src/test/resources/datasets/iris2.arff");
    QuantisationErrorMinimisationProblem problem = new QuantisationErrorMinimisationProblem();
    problem.setWindow(window);
    problem.setDomain("R(-5.12:5.12)");
    IterationStrategy strategy = new StandardDataClusteringIterationStrategy();
    CentroidBoundaryConstraint constraint = new CentroidBoundaryConstraint();
    constraint.setDelegate(new RandomBoundaryConstraint());
    strategy.setBoundaryConstraint(constraint);
    instance.setOptimisationProblem(problem);
    DataDependantPopulationInitialisationStrategy init =
        new DataDependantPopulationInitialisationStrategy();

    init.setEntityType(new ClusterParticle());
    init.setEntityNumber(2);
    instance.setInitialisationStrategy(init);

    instance.setOptimisationProblem(problem);
    instance.addStoppingCondition(new MeasuredStoppingCondition());

    CooperativePSO cooperative = new CooperativePSO();
    cooperative.addStoppingCondition(
        new MeasuredStoppingCondition(new Iterations(), new Maximum(), 30));
    cooperative.addPopulationBasedAlgorithm(instance);
    cooperative.setOptimisationProblem(problem);

    cooperative.performInitialisation();

    ClusterParticle particleBefore = instance.getTopology().head().getClone();

    cooperative.run();

    ClusterParticle particleAfter = instance.getTopology().head().getClone();

    Assert.assertFalse(particleAfter.getPosition().containsAll(particleBefore.getPosition()));
  }
 /*
  * Sets the sliding window to the one provided as a parameter
  * @param slidingWindow The new sliding window
  */
 public void setWindow(SlidingWindow slidingWindow) {
   window = slidingWindow;
   dataset = window.getCurrentDataset();
 }