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

avg_time_java.sh 465B

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