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

CSE564 Lecture 05

CSE564 Lecture 05

Software Design
Assignment 01 and 02
(202101)

Javier Gonzalez-Sanchez

September 05, 2020
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs
    CSE 564
    Software Design
    Lecture 05: Assignment 02
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    javiergs.engineering.asu.edu | javiergs.com
    PERALTA 230U
    Office Hours: By appointment

    View full-size slide

  2. jgs
    Test Yourselves

    View full-size slide

  3. jgs
    564 00000101
    Thoughts?

    View full-size slide

  4. jgs
    564 00000101
    Thoughts?

    View full-size slide

  5. jgs
    564 00000101
    Thoughts?

    View full-size slide

  6. jgs
    564 00000101
    Thoughts?

    View full-size slide

  7. jgs
    564 00000101
    Thoughts?

    View full-size slide

  8. jgs
    564 00000101
    Thoughts?

    View full-size slide

  9. jgs
    564 00000101
    Thoughts?

    View full-size slide

  10. jgs
    Assignment 02

    View full-size slide

  11. jgs
    564 00000101
    Problem
    Traveling salesman problem (TSP)
    Given a set of n nodes and distances for each pair of nodes, find a roundtrip
    of minimal total length visiting each node exactly once.

    View full-size slide

  12. jgs
    564 00000101
    Problem
    Traveling salesman problem (TSP)
    Given a set of n nodes and distances for each pair of nodes, find a roundtrip
    of minimal total length visiting each node exactly once.

    View full-size slide

  13. jgs
    564 00000101
    Data
    § Symmetric
    The distance from node i to node j is the same as from node j to node i.
    http://www.math.uwaterloo.ca/tsp/world/countries.html
    29 cities - 71,009 cities

    View full-size slide

  14. jgs
    564 00000101
    Data Symmetric

    View full-size slide

  15. jgs
    564 00000101
    Data
    § Symmetric
    The distance from node i to node j is the same as from node j to node i.
    http://www.math.uwaterloo.ca/tsp/world/countries.html
    29 - 71009
    § Asymmetric
    The distance from node i to node j and the distance from node j to node i
    may be different.
    http://elib.zib.de/pub/mp-testdata/tsp/tsplib/atsp/index.html
    17 to 443

    View full-size slide

  16. jgs
    564 00000101
    Data Asymmetric

    View full-size slide

  17. jgs
    564 00000101
    Solution
    It is an NP-hard problem. Do not worry about an optimal solution
    Calculate and report the total distance using a greedy algorithm (nearest-
    neighbors) or any other fancy solution (2-opt, genetic algorithm, etc.)
    Report the path as a list of city IDs
    city1, city2, city3, city4, …
    Do not forget the GUI.

    View full-size slide

  18. jgs
    564 00000101
    Solution
    Do not forget the GUI.
    For the Symmetric Data, show the dots on the screen. They must look like this
    (file: IT16862.tsp). View solutions in the “Point Set” link on the data webpage.

    View full-size slide

  19. jgs
    564 00000101
    Test Yourselves: Software
    § Information Hiding... How?
    § Stepwise refinement… How?
    § How many modules / functions? Why ?
    § How they will be connected (who call who? Who needs who?) Why ?
    § Which is the largest file (symmetric and asymmetric) that your solution can process?
    Can you improve that? How?
    § Sequential solution is acceptable, but challenge yourselves to use at least threads
    (CPU) or go for GPU programming

    View full-size slide

  20. jgs
    564 00000101
    Assignment 02
    Submit to Canvas (individually or team of 2):
    a) Source Code (every single java files).
    b) A PDF file a paper describing
    § your code and how did you apply Wirth and Parnas ideas a.k.a. functional
    decomposition and information hiding.
    § Screenshot with the output for small, medium, and large scenario
    § A conclusion addressing the quality of your solution
    PS.1.
    Showcase your skills for readability (make your code easy to read)
    PS.2.
    Include Javadoc

    View full-size slide

  21. jgs
    564 00000101
    Questions

    View full-size slide

  22. jgs
    Appendix
    Java Swing

    View full-size slide

  23. jgs
    564 00000101
    Example

    View full-size slide

  24. jgs
    564 00000101
    Main.java

    View full-size slide

  25. jgs
    564 00000101
    Canva.java

    View full-size slide

  26. jgs
    CSE 564 Software Design
    Javier Gonzalez-Sanchez, Ph.D.
    [email protected]
    Fall 2021
    Copyright. These slides can only be used as study material for the class CSE564 at ASU.
    They cannot be distributed or used for another purpose.

    View full-size slide