Exemplo n.º 1
0
 private List<Loop> getSubLoops(int[][] m)
 {
     List<Loop> loops = new List<Loop>();
     List<int> cities = new List<int>(_n);
     for (int i = 0; i < _n; i++)
         cities.Add(i);
     while (cities.Count != 0)
     {
         Loop l = new Loop();
         int cur = cities[0];
         do
         {
             l.add(cur);
             cities.Remove(cur);
             cur = getInd(m[cur]);
         } while (cur != l[0]);
         loops.Add(l);
     }
     return loops;
 }
Exemplo n.º 2
0
 private void addNewTasks(Loop l, Task t)
 {
     double[][] c;
     for (int k = 0; k < l.Length; k++)
     {
         int i,j;
         c = t.getValue();
         if (k != l.Length-1)
         {
             i = l[k];
             j = l[k+1];
         }
         else
         {
             i = l[k];
             j = l[0];
         }
         c[i][j] = Double.PositiveInfinity;
         Task nt = new Task(_n, c);
         _taskList.Enqueue(nt);
     }
 }