Search
Your task is to speed up Genetic algorithm (GA) solving Travelling Salesman Problem (TSP).
Brief recap of TSP and GA can be seen in PDF
You probably need to do the following steps to achieve the desired speedup:
git fetch origin && git diff origin/master > tsp.diff.txt
You are not allowed to modify the parameters of the GA and to parallelize the algorithm! The possible speed up (with the preset parameters) is great (approx. from 120s to 4s).
Oracle JDK 8 itself provides a number of monitoring tools located in 'JAVA_HOME/bin' folder. In later releases, some tools are not included and have to be installed individually.
The Java VisualVM is a baseline for profiling Java applications. It allows you to use both sampling and instrumentation approaches to profile the application. It allows to measure time spent in functions and see statistics about objects on the heap. It can also generate and analyse heap dumps, monitor garbage collector (and invoke it) and monitor threads.
https://visualvm.github.io/documentation.html
http://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr010.html
Although, JMC is now open source, we recommend you to use Oracle JDK 8 with bundled JMC. To use it on machines in the lab, change project JDK to /opt/jdk1.8.0_162
/opt/jdk1.8.0_162
Unlike the rest, Java Mission Control is a commercial feature (free for development) of Oracle JDK. It can be used for monitoring provided also by VisualVM but its main feature is the Java Flight Recorder (JFR). The JFR can record detailed information about various aspects of the application - e.g. object statistics, compilation, detailed GC info, I/O operations, exceptions,etc.
Flight Recording can be started automatically with VM arguments:
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -XX:StartFlightRecording=duration=10s,filename=myrecording.jfr
https://docs.oracle.com/javacomponents/index.html
http://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr003.html
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr004.html
http://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr005.html
JConsole is a tool with a basic monitoring functionality - heap size, CPU usage, thread monitor, etc. But it also allows using JMX instrumentation in order to see JVM parameters and in some cases it also allows you to change the parameters.
http://docs.oracle.com/javase/8/docs/technotes/guides/management/jconsole.html
There are also some command line tools (jcmd, jhat, jinfo,…) but most of their functionality is covered by the tools described above.
jcmd, jhat, jinfo,…
Try to find the code that is executed a lot and find out if the results cannot be precomputed and reused. Avoid unnecessary object creation e.g. boxing and unboxing of primitive variables (int vs. Integer).