private Edge NextEdge(Ant ant) { double c = 0; double r = random.NextDouble(); Vertex vertex = ant.visitedVertices.Peek(); foreach (Edge e in vertex.neighbors) { if (!ant.visitedVertices.Contains(e.SecondVertex)) { c += Probability(ant, e); if (c >= r) { return(e); } } } return(null); }
private void AntPath(Ant ant) { counter = 0; AntPathRecurring(ant, ant.startVertex); }