CSC 520 – ARTIFICIAL INTELLIGENCE
java代写 | assignment | ARTIFICIAL INTELLIGENCE | ai代写 – 这是一个关于java的ai相关题目, 主要考察了关于ARTIFICIAL INTELLIGENCE的内容,是一个比较经典的题目, 是比较有代表性的ARTIFICIAL INTELLIGENCE等代写方向, 这是值得参考的assignment代写的题目
assignment 2.
Due Date : March 7th, 2022
Thisassignment consists of two questionswhich involvewrittenanswers andcode. Inorderto completethe assignmentyou mustsubmitawrittenreportinpdfformdetailingyouranswerstothe questionsaswellasyourcode.Asdiscussedinclassallworkmustbeyourown.Youmaynotusethird partylibrariesorexamplecodetocompletetheassignment.Allreportsmustbeclearandwellwritten.All codemustbeclear,readable,andwell-commented.PleaseincludeaREADMEwithinstructionsonhow to run the code.
QUESTION 1 – Part (a) ( 65 Points )
ProblemDescription: Youaregivena2dsearchspaceofsize(m,n)whereeachcellholdsanumber.At eachcell,youcanmoveleft,right,upordownbythenumberofplaceslistedinthecurrentcell.Inthe exampleshownbelow,fromthecell(0,0)wecanmovetotherightby 2 cellsto(0,2)ormovedownby 2 cells to (2,0).
Implement code to reach the goal cell (m,n) using the following techniques:
- Steepest Ascent Hill Climbing – Consider the initial state as (0,0)
- Steepest Ascent Hill Climbing with Random restart
- Steepest Ascent Hill Climbing with Random walk – Consider the initial state as (0,0)
Implement the algorithms using both the heuristics mentioned below: ( 60 Points) Heuristic 1 (H1): Ifyouareeitherinthesameroworsamecolumnasthegoalthenconsidertheheuristic value as 1, otherwise consider the heuristic value as 2.
Heuristic 2 (H2): Use manhattan distance between thecurrent cell and goal cell as the heuristic value.
For each 2d space you are expected to calculate the following:
- Find the path taken to reach (m,n). If not possible then your code should return Not Possible
- Find the total number of nodes visited
- For Random Restart you are expected to print the initial state for every restart
- ForRandomWalkyouareexpectedtoprintthemovechosen-bestmoveorrandommoveat every step.
Note: Preference of directions : left > right > up > down Rememberdifferentparametersyoucanchooseforyoursearch(e.g.numberofstepstotake beforefinishing the search(searches 1, 2, and 3), numberofrandomrestarts(search2), probability value (search 3).
Fornumberofstepstotakebeforefinishingthesearch,choosevaluesintherange[500-1000]
with a step value of 100
For number of random restarts, choose values in the range [10 - 25] with a step value of 5
For the probability value, choose values in the range [0.2 - 0.8] with a step value of 0.
When using the random function please set the seed value as 1234
Now that you have implemented the algorithms, in the solutions PDF explain the following: ( 5 Points)
- Conduct exploration to find a reasonable combination of values forthese parametersand investigatethetrade-offbetweenefficiencyandaccuracy.Provideananalysisoftheexploration in the solution PDF. Explain your search strategy (this can be a simple grid search).
Sample Maze:
2 , 2 , 1 , 1
1 , 2 , 1 , 1
2 , 1 , 1 , 0
QUESTION 1 – Part (b) ( 40 Points )
Usingthe same ProblemDescription asinPart(a)andManhattanDistancefortheHeuristicvalues, implement RBFS to reach the goal state. Postimplementation,pleasenotethenumberoftimesbacktrackingtakesplaceforeachmazeanddisplay it in a table.
Note: Preference of directions : left > right > up > down
Sample Maze:
2 , 2 , 1 , 3
1 , 2 , 1 , 1
2 , 1 , 1 , 0
Heuristic Values (Manhattan Distance):
5 , 4 , 3 , 2
4 , 3 , 2 , 1
3 , 2 , 1 , 0
Please output the result in the following format at each stage:
Node Selected: [0, 0] F-Value: 5 , alternative_best_f: 9223372036854775807 Further Child Nodes: [0,2],[2,0],
———————————–
Node Selected: [0, 2] F-Value: 4 , alternative_best_f: 4 Further Child Nodes: [0,1],[0,3],[1,2],
Node Selected: [0, 3] F-Value: 4 , alternative_best_f: 4 Further Child Nodes: [0,0],
Node Selected: [1, 2] Backtracking to bestalternative takes place in this step. F-Value: 4 , alternative_best_f: 4 Further Child Nodes: [1,1],[1,3],[0,2],[2,2],
Node Selected: [1, 3] F-Value: 4 , alternative_best_f: 4 Further Child Nodes: [1,2],[0,3],[2,3],
Node Selected: [2, 3] F-Value: 4 , alternative_best_f: 4
QUESTION 1 – Part (c) ( 5 Points ):
Basedonyouroverallworking,inthesolutionPDF,determineiftheheuristicsH1andH2areadmissible and / or consistent? Explain your reasoning.
Execution Instructions :
Part 1(a):
- Please make sure that your code is executable on running the command : For Python: python3 q1a.py
<hc / rr / rw> Example command : python3 q1a.py Maze1.txt hc
For Java:
javac q1a.java
java q1a <maze filename> <hc / rr / rw>
- Writethe outputof the program toatext fileintheQ1a/Solutionsfolderwiththenaming convention – <Maze_filename>_solution.txt.
- AnswerstoHillClimbing,Random restart,Randomwalkmust beintheQ1a/Solutions/HC, Q1a/Solutions/RR, Q1a/Solutions/RW folders respectively.
SamplesolutionfilesforafewmazeshavebeenaddedtotheQ1a/Solutionsfolder.Thesolutionswere generated using parameter values of 1000 iterations, 10 restarts and 0.8 probability.
Part 1(b):
- Please make sure that your code is executable on running the command : For Python: python3 q1b.py
Example command : python3 q1b.py Maze1.txt
For Java:
javac q1b.java
java q1b <maze filename>
- Writethe outputof the program toatext fileintheQ1b/Solutionsfolderwiththe naming convention – <Maze_filename>_solution.txt.
- Answers must be in the Q1b/Solutions folder respectively.
Sample solution files for a few mazes have been added to the Q1b/Solutions folder.