@Test public void testPerformInitialisation() { FunctionOptimisationProblem problem = new FunctionOptimisationProblem(); problem.setDomain("R(-32.768:32.768)^30"); problem.setFunction(new Ackley()); MeasuredStoppingCondition condition = new MeasuredStoppingCondition(new Iterations(), new Maximum(), 100); ABC abc = new ABC(); abc.addStoppingCondition(condition); abc.setOptimisationProblem(problem); abc.setWorkerBeePercentage(ConstantControlParameter.of(0.7)); abc.performInitialisation(); assertEquals(abc.getTopology().length(), 100); assertEquals(abc.getWorkerBees().length(), 70); assertEquals(abc.getOnlookerBees().length(), 30); HashMap<Type, Type> map = new HashMap<Type, Type>(); for (HoneyBee bee : abc.getTopology()) { map.put(bee.getPosition(), bee.getPosition()); } for (HoneyBee bee : abc.getWorkerBees()) { map.put(bee.getPosition(), bee.getPosition()); } for (HoneyBee bee : abc.getOnlookerBees()) { map.put(bee.getPosition(), bee.getPosition()); } assertEquals(100, map.size()); }