Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

/** * Pure Java console application. * This application demonstrates console I/O.

* * This file was automatically generated by * Omnicore CodeGuide. */ import java.util.*; import java.io.*; public class AntColony4SP extends AntColony4TSP { private int[] m_nodesInZ = null; private final int SOURCE_NODE_INDEX = 0; public AntColony4SP(AntGraph graph, int[] nodesInZ, int k, int iterations) { super(graph, k * nodesInZ.length - 1, iterations); m_nodesInZ = nodesInZ; } protected Ant[] createAnts(AntGraph graph, int ants) { Random ran = new Random(System.currentTimeMillis()); Ant4SP.reset(); Ant4SP.setAntColony(this); Ant4SP ant[] = new Ant4SP[ants]; for(int i = 0; i < ants; i++) { ant[i] = new Ant4SP(m_nodesInZ[SOURCE_NODE_INDEX], m_nodesInZ[(i % a nts) + 1], this); } return ant; } public int[] getNodesInZ() { return m_nodesInZ; } }

You might also like