Esempio n. 1
0
 // override
 public void updateEdges(GraphEdge e_new)
 {
     foreach (GraphEdge e in allEdges)
     {
         if (e_new.ID == e.ID)
         {
             e.Tau = e_new.Tau;
             e.Eta = e_new.Eta;
         }
     }
 }
Esempio n. 2
0
        // deterministic approach, get edge with minimal pheromone
        private GraphEdge chooseEdgeDeterministic(List <GraphEdge> edges)
        {
            GraphEdge selectedEdge = null;
            double    min          = double.MaxValue;

            foreach (GraphEdge g in edges)
            {
                if (g.Probability < min)
                {
                    min          = g.Probability;
                    selectedEdge = g;
                }
            }
            foreach (GraphEdge g in edges)
            {
                if (g.Probability == min)
                {
                    g.IsChoosen = true;
                    g.updateTau(true);
                }
                g.updateTau(false);
            }
            return(selectedEdge);
        }