程序代做 4/17/22, 11:28 PM Homework 10 – cscodehelp代写
4/17/22, 11:28 PM Homework 10
Homework 10
Start Assignment
Due Monday by 2:59am Points 100 Submitting a file upload
Copyright By cscodehelp代写 加微信 cscodehelp
State transition network, Haskell edition
For this assignment, we’ll return to the state-transition networks we looked at in Homework 6 (https://course.ccs.neu.edu/cs5400sp20-seattle/hw/s20ppl/hw6-prolog/) . In this exercise you will work from starter code (https://northeastern.instructure.com/courses/103049/files/13244439/download? download_frd=1) written in Haskell to implement functions that give paths through the network along the same lines of those you implemented in Prolog. There are some differences, though, in how we can best approach this problem in Haskell. Notably, we made heavy use of Prolog’s built-in backtracking to let it do the heavy lifting of finding paths through the network. Haskell does not have this sort of backtracking built in; there’s no concept of the sort of retries you get with ; in Prolog for generating solutions that you can collect using bagof or a similar predicate.
Instead, the approach we take with Haskell focuses on functions that return values based on inputs, so you will need to break the problem down into smaller problems. You will probably want to use a combination of tools that we have covered in class.
In the starter code, the StateTransitions module exports the necessary functions as well as custom data types for describing state transition networks.
The three exported functions are:
red_edge_sequence :: Network -> [Path]
alternating_edge_sequence :: Network -> [Path]
matching_edge_state_sequence :: Network -> [Path]
These each return lists of Path type elements ( Path is defined in the starter code as a list of state names).
Recall the network from Assignment 7, encoded in the starter code as testNetwork1 :
https://northeastern.instructure.com/courses/103049/assignments/1265248
4/17/22, 11:28 PM Homework 10
The expected output from the program for this network is:
Red edge sequences:
[“BDIK”,”BDFHK”,”BDFHIK”]
Alternating edge sequences:
[“AFHJ”,”ADFGJ”,”ADEIK”,”BDFGJ”,”BDEIK”,”BDFHJ”]
Matching edge/state sequences:
[“AFGHJ”,”BDIK”]
And a second one ( testNetwork2 in the starter code):
https://northeastern.instructure.com/courses/103049/assignments/1265248
4/17/22, 11:28 PM Homework 10
The expected output from the program for this network is:
Red edge sequences:
[“ACFHK”,”BDGIL”,”BDGIJL”]
Alternating edge sequences:
[“AFHIL”,”ADEJL”,”BDEJL”,”BDFHIL”]
Matching edge/state sequences:
You do not need to touch any code in the test runner ( ). Several functions in that file contain IO() in their declaration ( main and ). These are involved with input/output and necessary to write text to the screen. You do not need to fully understand these functions in order to write the functions necessary to complete this assignment. We will talk about them in class by and by (time permitting), and of course the textbooks and other resources have information available to you if you’re curious about these parts of the code.
StateTransitionTestRunner.hs
showSolution
https://northeastern.instructure.com/courses/103049/assignments/1265248
程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com