Reference no: EM132176716
Foundations of Artificial Intelligence Homework - CORRECTED, CLARIFIED, AND DEADLINE EXTENDED
Problem Description: You are the CTO of a new startup company, SpeedRacer, and you want your autonomous cars to navigate throughout the city of Los Angeles. The cars can move North, South, East, or West. The city can be represented in a grid, as below:
0, 0
|
1, 0
|
2, 0
|
3, 0
|
4, 0
|
0, 1
|
1, 1
|
2, 1
|
3, 1
|
4, 1
|
0, 2
|
1, 2
|
2, 2
|
3, 2
|
4, 2
|
0, 3
|
1, 3
|
2, 3
|
3, 3
|
4, 3
|
0, 4
|
1, 4
|
2, 4
|
3, 4
|
4, 4
|
There will be some obstacles, such as buildings, road closings, etc. If a car crashes into a building or road closure, SpeedRacer has to pay $100. You know the locations of these, and they will not change over time. You also spend $1 for gas each time you move. The cars will start from a given SpeedRacer parking lot, and will end at another parking lot. When you arrive at your destination parking lot, you will receive $100. Your goal is to make the most money1 over time with the greatest likelihood. Your cars have a faulty turning mechanism, so they have a chance of going in a direction other than the one suggested by your model. They will go in the correct direction 70% of the time (10% in each other direction, including along borders).
The first part of your task is to design an algorithm that determines where your cars should try to go in each city grid location given your goal of making the most money. Then, to make sure that this is a good algorithm when you present it to the rest of your board, you should simulate the car moving through the city grid. To do this, you will use your policy from your start location. You will then check to see if the car went in the correct direction using a random number generator with specific seeds to make sure you can reproduce your output. You will simulate your car moving through the city grid 10 times using the random seeds 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
You will report the mean over these 10 simulations as an integer after using the floor operation (e.g., numpy.floor(meanResult)). An example of this process is attached.
Input: The file input.txt in the current directory of your program will be formatted as follows:
- First line: strictly positive 32-bit integer s, size of grid [grid is a square of size sxs].
- Second line: strictly positive 32-bit integer n, number of cars.
- Third line: strictly positive 32-bit integer o, number of obstacles.
- Next o lines: 32-bit integer x, 32-bit integer y, denoting the location of obstacles.
- Next n lines: 32-bit integer x, 32-bit integer y, denoting the start location of each car.
- Next n lines: 32-bit integer x, 32-bit integer y, denoting the terminal location of each car.
Output:
n lines: 32-bit integer, denoting the mean money earned in simulation for each car, integer result of floor operation.
Note that although we would like to make the most money possible, you MUST use the parameters we provide to make sure everyone gets the same value. Other parameters may give better results, but you should not use them. You SHOULD use an approach we learned in class to make sure you get the same value.
Rules -
1. Use Python 2.7 to implement your homework assignment. You are allowed to use standard libraries only. You have to implement any other functions or methods by yourself.
2. Create a file named "hw3cs561f2018.py". When you submit the homework on labs.vocareum.com, the following commands will be executed: python hw3cs561f2018.py
3. Create a file named "output.txt" and print its output there. For each test case, the grading script will put an "input.txt" file in your work folder, runs your program (which reads "input.txt"), and check the "output.txt" file generated by your code. The grading script will replace the files automatically, so you do NOT need to do anything for that part.
4. Homework must be submitted through Vocareum. Please only upload your code to the "/work" directory. Don't create any subfolder or upload any other files.
5. Your program must handle all test cases within a maximum runtime of 3 minutes per test case on Vocareum.
Attachment:- Assignment Files.rar