The Minimum Expectations Source Code It SHOULD compile and run (all functionalities) DRY and KIS Readable Class Diagram It SHOULD match the code: association, aggregation, composition, realization, etc. The diagram is not an adornment Individual Assignment or a Team of Maximum 3 You have a week to work. If you are a team, you succeed or fail together
User Interface § A GUI with a menu bar (Use a JMenu) § Three items: File, Project and About § About is Easy, will open a dialog box with your team information. § File menu and Project menu are the important ones Jmenu Tutorial https://docs.oracle.com/javase/tutorial/uiswing/components/menu.html
File Menu JFileChooser Tutorial: https://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html • Ask the user for a File path (Use a JFileChooser) • The file will be a TXT file. • Read the file and load the data into a data structure (your choice) • Files will be symmetric TSP
Open :: TSP Files NAME : ar9152 COMMENT : 9152 locations in Argentina COMMENT : National Imagery Mapping TYPE : TSP DIMENSION : 9152 EDGE_WEIGHT_TYPE : EUC_2D NODE_COORD_SECTION 1 24748.3333 50840.0000 2 24758.8889 51211.9444 3 24827.2222 51394.7222 4 24904.4444 51175.0000 5 24996.1111 51548.8889 6 25010.0000 51039.4444 7 25030.8333 51275.2778 8 25067.7778 51077.5000 World TSP http://www.math.uwaterloo.ca/tsp/world/countries.html • Ignore the green part • Black part from the file to a data structure
Open :: TSP Files • From File to Data Structure, then visualize • Adjust the dots: search for the minimum and maximum value then normalize accordingly. You did this before. Reuse your code
Save :: TSP Files 1 24748.3333 50840.0000 2 24758.8889 51211.9444 3 24827.2222 51394.7222 4 24904.4444 51175.0000 5 24996.1111 51548.8889 6 25010.0000 51039.4444 7 25030.8333 51275.2778 8 25067.7778 51077.5000 World TSP http://www.math.uwaterloo.ca/tsp/world/countries.html • First line • Data structure to a file • Ask the user for a File path (Use a JFileChooser)
Project Menu Jmenu Tutorial https://docs.oracle.com/javase/tutorial/uiswing/components/menu.html • New. Clean screen and data structure. Cancel all processes running Everything like new. • Run. Start Threads (Professor and Students – Leader and Sources) in a Blackboard. • Stop. Stop the Threads (Professor and Students – Leader and Sources) in a Blackboard. They go to sleep until run is clicked again.
Blackboard KnowledgeSource Functional Requirements § Use nearest neighbors to calculate TSP § Dots on screen (data structure) are cities § Calculate(Euclidian) distances between each pair of cities § Found the shortest possible route that visits each city exactly once and returns to the origin city Control
Blackboard KnowledgeSource Functional Requirements § Diverse results starting in different starting points § Can we have 2 Knowledge sources and split the work in 2? Can we have 4 or 8 or 16 or … § Knowledge Source only report that to the Blackboard that is. Control • Select the 3 shortest paths
Blackboard KnowledgeSource Functional Requirements § Use nearest neighbors to calculate TSP § Dots on screen (data structure) are cities § Calculate(Euclidian) distances between each pair of cities § Found the shortest possible route that visits each city exactly once and returns to the origin city Control
Model Architecture View Draw in real-time the 3 shortest paths: red, pink, gray. Red is the shortest path calculated so far. Blackboard KnowledgeSource Control
Open :: TSP Files • Real time visualization changing. • Make sure to create threads and sent them to sleep in every iteration. Thus the UI can still work. • If in some point, there is only 1 path (in red). That is OK