Академический Документы
Профессиональный Документы
Культура Документы
hardgraph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
// weights
// names
// and city
// init()
// accept/reject
// decisions
// discovered
@SuppressWarnings("rawtypes")
int[] soln;
int dist;
/*
*/
dist = 0;
// Add edges
if (index == n)
if (DBG)
}
public int compareTo(Object o)
Tour rt = (Tour) o;
if (DFS)
return c1 == 0 ? c2 : c1;
else
return c2;
return val.toString();
String line;
n = inp.nextInt();
wt = new int[n][n];
Arrays.fill(wt[sub1], -1);
city[sub1] = inp.nextLine();
while (inp.hasNext())
int dist;
head = line.indexOf('"') + 1;
blocked += dist;
x[p] = x[q];
x[q] = tmp;
int start;
vect[k] = k;
if (start >= 0)
vect[start] = 0;
vect[0] = start;
{
Tour current = work.poll();
vect = current.soln;
bestTour = current.dist;
soln.add(current);
if (DEBUG)
else if (DEBUG)
else if (DEBUG)
else
hold = vect[index];
vect[k - 1] = vect[k];
vect[n - 1] = hold;
@SuppressWarnings("unchecked")
init(inp);
tour();
if (VERBOSE)
System.out.println("Tours discovered:");
System.out.println(opt);
if (soln.size() == 0)
System.exit(0);
}
Collections.sort(soln);
System.out.println(soln.get(0));