Implement a search algorithm that can find a route between any two
cities. Your program will be called find_route, and will take exactly
three commandline arguments, as follows:
Argument input_filename
is the name of a text file such as input1.txt,
that describes road connections between cities in some part of the
world. For example, the road system described by file input1.txt can be
visualized in Figure 1 shown above. You can assume that the input file
is formatted in the same way as input1.txt:
each line contains three
items. The last line contains the items "END OF INPUT", and that is how
the program can detect that it has reached the end of the file. The
other lines of the file contain, in this order, a source city, a
destination city, and the length in kilometers of the road connecting
directly those two cities. Each city name will be a single word (for
example, we will use New_York instead of New York), consisting of upper
and lowercase letters and possibly underscores.
IMPORTANT NOTE: MULTIPLE INPUT FILES WILL BE USED TO GRADE THE
ASSIGNMENT, FILE input1.txt
IS JUST AN EXAMPLE. YOUR CODE SHOULD WORK
WITH ANY INPUT FILE FORMATTED AS SPECIFIED ABOVE.
The program will compute a route between the origin city and the
destination city, and will print out both the length of the route and
the list of all cities that lie on that route. For example,
find_route input1.txt Bremen Frankfurt
should have the following:
distance: 455 km
route:
Bremen to Dortmund, 234 km
Dortmund to Frankfurt, 221 km
and
find_route input1.txt London Frankfurt
should have the following output:
distance: infinity
route:
none
For full credit, you should produce outputs identical in format to the
above two examples.
Task 2 - Informed Search
Implement and compare uniform cost search, iterative deepening, A*, and
IDA* for solving the 8-puzzle. A* and IDA* should use the
sum-of-Manhattan-distances heuristic. Your program will be called
puzzle8, and will take exactly three commandline arguments, as follows:
puzzle8 start_state_file goal_state_file method
An example command line is:
puzzle8 start1.txt goal1.txt ucs
Arguments start_state_file and goal_state_file are the names of text
files such as start1.txt
and goal1.txt,
that specify the start and goal
state for the problem.
IMPORTANT NOTE: MULTIPLE INPUT FILES WILL BE USED TO GRADE THE TASK,
FILES start1.txt
AND goal1.txt ARE
JUST EXAMPLES. YOUR CODE SHOULD WORK
WITH ANY INPUT FILE FORMATTED AS SPECIFIED ABOVE.
Argument method is either ucs (for uniform cost search), id (for
iterative deepening), astar (for A*) or idastar (for IDA*). Please use
the exact spelling (and lower-case characters) specified here. Your
program should use the appropriate search method, based on the
arguments.
The program should find an optimal solution for achieving the goal
state from the start state. It should print out:
the list of all intermediate states, in the correct order (starting
from the start state, and ending at the goal state).
AFTER THE LIST OF INTERMEDIATE STATES, it should print the length of
the solution, the number of search nodes that were expanded, and the
maximum length reached by the list of nodes to visit.
In a text document (or
Excel file) titled report.xxx (where you replace
xxx with whatever extension is appropriate, depending on the file
format you use) you should report, for solutions of different lengths,
how much time it takes each of the methods to find the solution, how
many nodes are expanded by each method, and what is the maximum length
of the list of nodes to visit for each method. You may find that
uniform cost search and A* take up too much memory (and perhaps crash)
when the solution is too long. That is OK, but be sure to report what
lengths of solutions uniform cost and A* can or cannot handle.
Suggestions
The code needs to run on omega. If you have not even tried
logging in on omega until the last day, there is a high probability
that something
will go wrong. You may find it convenient to do the code development
and testing on your own laptop or home machine, but it is highly
recommended that you log in to omega and compile a toy program ASAP,
and that you compile and run an intermediate version of your code well
before the deadline. Notify the instructor for any problems you may
have. Pay close attention to all specifications on this page, including
specifications about output format, submission format. Even in cases
where the program works correctly, points will be taken off for
non-compliance with the instructions given on this page (such as a
different format for the program output, wrong compression format for
the submitted code, and so on). The reason is that non-compliance with
the instructions makes the grading process significantly (and
unnecessarily) more time consuming.
Interim report
The interim report should be submitted via e-mail to the instructor and
the TA, and should contain the following:
On the subject line: CSE4308 / CSE5360 - <Name>
-
PA1 Interim Report
On body of message: Your name and UTA ID (all 10 digits, no
spaces).
On body of message, or as an attachment (in text, Word,
PDF, or
OpenOffice format): a description (as brief or long as you want) of
what you have done so far for the assignment, and any
difficulties/bottlenecks you may have reached (in case you encounter
such difficulties, it is highly recommended to contact the instructor
and/or TA for help).
For purposes of grading, it is absolutely fine if your interim report
simply states that you have done nothing so far (you still get the 10
points allocated for the interim report, AS LONG AS YOU SUBMIT THE
REPORT ON TIME). At the same time, starting early and identifying
potential bottlenecks by the deadline for the interim report is
probably a good strategy for doing well in this assignment.
Grading
The assignments will be graded out of 100 points.
10 points: Submitting the interim report according to the instructions,
and on time.
10 points: In Task 1, the program always finds a route between the
origin and the destination, as long as such a route exists.
10 points: In Task 1, in addition to the above requirement, the program
terminates and reports that no route can be found when indeed no route
exists that connects source and destination (e.g., if source is London
and destination is Berlin, in the above example).
10 points: In Task 1, in addition to the above requirements, the
program always returns optimal routes. In other words, no shorter route
exists than the one reported by the program.
40 points: In Task 2, correct implementation of each of the four search
methods (10 points for each method).
20 points: In Task 2, submitting an informative report, that
illustrates how time and memory requirements scale for each method, for
solutions of different lengths.
Negative points: penalty points will be awarded by the instructor and
TA generously and at will, for issues such as: code not running on
omega, submission not including precise and accurate instructions for
how to run the code, wrong compression format for the submission, or
other failures to comply with the instructions given for this
assignment. Partial credit for incorrect solutions will be given ONLY
for code that is well designed and well documented. Code that is badly
designed and badly documented can still get full credit as long as it
accomplishes the required tasks.
How to submit
Implementations in C, C++, Java, and Python will be accepted. If you
would like to use another language, make sure it will compile on omega
and clear it with the instructor beforehand. Points will be taken off
for failure to comply
with this requirement.
The assignment should be submitted via Blackboard. Submit a
ZIPPED
directory called assignment1.zip (no other forms of compression
accepted, contact the instructor or TA if you do not know how to
produce .zip files). The directory should contain source code.
Including binaries that work on omega (for Java and C++) is optional.
The submission should also contain a file called readme.txt, which
should specify precisely:
Name and UTA ID of the student.
What programming language is used.
How the code is structured.
How to run the code, including very specific compilation instructions,
if compilation is needed. Instructions such as "compile using g++" are
NOT considered specific.
Insufficient or unclear instructions will be penalized by up to 20
points. Code that does not run on omega machines gets AT MOST half
credit (50 points).
Submission checklist
Is the code running on omega?
Does the submission include a readme.txt file, as specified?