Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE564 Lecture 22

CSE564 Lecture 22

Software Design
Assignment 05
(202011)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez

September 22, 2020
Tweet

Transcript

  1. jgs CSE 564 Software Design Lecture 22: Assignment 05 Dr.

    Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. jgs Previously …

  3. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 3 jgs

    Model-View-Controller
  4. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 4 jgs

    Blackboard
  5. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 5 jgs

    Client-Server
  6. jgs Assignment 05

  7. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 7 jgs

    Architecture Model View Controller
  8. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 8 jgs

    Model Architecture View Controller Blackboard KnowledgeSource Control
  9. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 9 jgs

    Model Drafting a Software Design View Controller Blackboard KnowledgeSource Control
  10. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 10 jgs

    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
  11. jgs Step 1

  12. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 12 jgs

    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
  13. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 13 jgs

    Mouse § Mouse Listener allows to draw dots on the screen. § They are visualized § They are stored in a database
  14. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 14 jgs

    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
  15. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 15 jgs

    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
  16. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 16 jgs

    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
  17. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 17 jgs

    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)
  18. jgs Step 2

  19. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 19 jgs

    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.
  20. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 20 jgs

    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
  21. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 21 jgs

    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
  22. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 22 jgs

    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
  23. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 23 jgs

    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
  24. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 24 jgs

    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
  25. Javier Gonzalez-Sanchez | CSE564 | Fall 2020 | 25 jgs

    Step 2 § Teams of 1, 2, or 3. Your choice. § Due November 19. No extensions
  26. jgs CSE 564 Computer Systems Fundamentals Javier Gonzalez-Sanchez javiergs@asu.edu Fall

    2020 Disclaimer. These slides can only be used as study material for the class CSE564 at ASU. They cannot be distributed or used for another purpose.