1

I had the names of roads and which are connected

public static void inisial(ArrayList track)
{
        String[] connected = {"B","C","D","K","L"};
        information = new Street("A",connected); 
        track.add(information);

        String[] connected = {"E","F","G","A"};
        information = new Street("K",connected); 
        track.add(information);

        String[] connected = {"H","I","J","A"};
        information = new Street("L",connected); 
        track.add(information);
}

public static Street findStreet (String source, String destination)
{
    for (int i = 0;i < track.size(); i++)
    {
      if(track.get(i).getNameStreet().equalsIgnoreCase(source))
      {
        first = i;
        System.out.println(track.get(awal).getNameStreet());
        for (int j = 0;j < track.get(awal).getConnected().length;j++) 
        {
          next=i;
        }
    }
}

how do I get the path of A - J ? I'm trying to use ant colony optimization to find the best streets. Anyone can help me to solve this problem ? or maybe you have reference about ant colony optimization to find the best streets.

0 Answers0