Solve, time, and profile programs solving the traveling salesperson problem in various languages. Solution relies on use of graph object.

time_java.sh 492B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/local/bin/bash
  2. export RIGHTNOW="`date +"%Y%m%d_%H%M%S"`"
  3. export OUT="timeout_tsp_java_${RIGHTNOW}.out"
  4. touch ${OUT}
  5. cat /dev/null > ${OUT}
  6. # Compile
  7. make build
  8. for N in {4..8..1}
  9. do
  10. echo "**************************************" >> ${OUT}
  11. echo "Running TSP with $N nodes with Java..." >> ${OUT}
  12. make time SIZE=${N} >> ${OUT} 2>&1
  13. make dot
  14. mv graphviz.png graphviz_tsp_${N}.png
  15. echo "Done." >> ${OUT}
  16. echo "" >> ${OUT}
  17. done
  18. echo ""
  19. echo ${OUTFILE}
  20. echo ""