// calculates decision param for next city private double CalculateVariables(ACOCity to) { if (_CitiesToVisit.Contains(to)) { ACODistance distance = (ACODistance)_CurrentCity.GetDistanceTo(to); double length = distance.LengthDouble; double pheromone = distance.Pheromone; return(Math.Pow(1 / length, Convert.ToDouble(_Props.Beta)) * Math.Pow(pheromone, Convert.ToDouble(_Props.Alpha))); } return(0); }
private void CopyGraph(TSPGraph <ACOCity, ACODistance> graph) { foreach (ACOCity mainCity in graph.GetCities()) { ACOCity copiedCity = (ACOCity)mainCity.Clone(); for (int i = 0; i < graphState.GetCities().Count; i++) { ACODistance dist = (ACODistance)((ACODistance)mainCity.GetDistanceTo(graph.GetCities()[i])).Clone(); copiedCity.Connect(graphState.GetCities()[i], dist); } graphState.AddCity(copiedCity); } }