Arti cial Intelligence Coursework (COMS30062) Boiler-plate · Coursework Brief · GridWorld Library · Part 1 · Part 2 · Part 3 · Part 4 · Marking Scheme
This document provides an overview of and guidelines for the coursework assessment (COMS30062) on the 3rd year Arti cial Intelligence (AI) unit in the 2021-2 academic year. After outlining the standard boiler-plate text (Section 1) this document provides a general coursework brief (Section 2), followed by an introduction of the relevant features of the GridWorld library (Section 3), a breakdown of the four individual parts that you will need to submit (Section 4 – Section 7), and a summary of the marking scheme (Section 8).
1 Boiler-plate
Value: This coursework is for unit COMS30062 AI and is worth 15 credit points.
Copyright By PowCoder代写 加微信 powcoder
Mode: This coursework is individual work. You must not collaborate with other students,
which would be considered cheating.
Timing: The coursework will be released on Monday 22 November (Week 9) at 9am and must be submitted by Friday 10 December (Week 11) at 1pm at the very latest. The intention is that you submit by 12pm and keep the last hour as emergency reserve for e.g. technical problems. In case of problems with your submission, you must e-mail coms- before the 1pm nal deadline to avoid your work being counted as late.
Submission: You must submit the coursework on the Blackboard page for the assessment unit COMS30062 (not the teaching unit COMS30014). On the assessment unit, go to the menu item “Assessment, Submission and Feedback” and follow the instructions there.
Commitment: You are expected to work on both your courseworks in the 3-week period from Week 9 to Week 11 as if it were a working week in a regular job, that is 5 days a week for no more than 8 hours a day. It is up to you how you distribute your time and workload between the two units within those constraints. You are strongly advised not to try and work excessive hours during the coursework period: this is more likely to make your health worse than to make your marks better. If you need further pastoral/mental health support, please talk to your personal tutor, a senior tutor, or the university wellbeing service.
Support: For this unit COMS30062 AI, the following support is available during the coursework period: we will continue running the Drop-In clinic on Thursdays at 12:00-13:00;
and you may also continue posting questions to the Discussion Forum on the Teaching Unit (COMS30014).
Marking: A summary of the marking scheme for this coursework is included in Section 8 of this document.
2 Coursework Brief
This coursework comprises 4 equally weighted parts that are brie y outlined below (and explained in more detail in subsequent sections of this document):
Part 1 (25%) involves you extending Lab Search with an A* algorithm in order to more e ciently nd shortest paths from an agent’s position to speci ed cells or objects without running out of energy in grids containing walls, oracles and charging stations;
Part 2 (25%) involves you integrating Part 1 with Lab Identity to plan complex routes that enable your agent to consult as many oracles as possible, topping up its energy as required, in order to nd a secret actor identity;
Part 3 (25%) involves you coordinating the movement of multiple agents in order to explore and solve an initially hidden maze by guiding each agent from an “entrance” point near the top left to an “exit” point at the bottom right;
Part 4 (25%) is a more open-ended exercise that involves writing a short report where you consider (at a conceptual level rather than an implementation level) potential extensions of and re ections upon your solutions to the above tasks.
The following table provides a brief overview of the three coding Parts 1-3 showing the submission predicates and les (where 12345 stands for your student number – which should actually be 7 digits long) along with the associated grid con gurations, a quick-start guide to running the code, and the relevant marking criteria:
Solution predicate
Submission lename
Grid size: Visibility
# Chargers # Obstacles
How to run
Task Marking
solve_task/2
cw_12345.pl
initially visible 1
start in top left
max=100 initial=100%
but is reduced by
1 unit per move and 10 units per query
./ailp.pl cw part1
find_identity/1
cw_wp_12345.pl
15-25 (odd or even) initially visible
2-4 ~80-100
start at random
max= /4 initial=50-100%
but is reduced by
1 unit per move and max/10 per query
./ailp.pl cw part2
solve_maze/0
cw_maze_12345.pl
11-31 (odd only) initially hidden 1-10
start in top left
exit at bottom right
not applicable!
./ailp.pl cw part3
join_game(As,4).
reset_game.
start_game.
solve_maze.
Use A* search to solve tasks of form: find(Obj) ; go(Pos)
* minimising moves
visit and query oracles to nd secret actor id
* maximise oracles
lead all agents out of the maze
* one agent
Criteria (5 marks each)
* minimising time * indirect paths
* edge cases
* good coding
* minimising moves * minimising time
* edge cases
* good coding
* three agents * multi agents * end game
* time taken
Table 1: Quick-start Guide for Parts 1-3.
You are advised to tackle the parts in the order they are listed above as the level of guidance deliberately decreases as you progress through Parts 1-4. Moreover, Parts 2 and 3 both build upon the insights and code you develop in Part 1; and Part 4 will bene t from your experiences all the other Parts 1-3.
As there is no dependency between Parts 2&3, you may start work on either or both of these after you’ve made some progress on (but not necessarily completed) Part 1. Similarly, you may begin working on Part 4 after making some progress on (but not necessaarily completing) Parts 1-3.
This coursework assumes you have a running version of SWI Prolog and a working knowledge of logic programs obtained by working through Chapters 1-6 & 10-11 of the recommended Learn Prolog Now! tutorial. You should have studied the content of the Prolog I-IV lectures along with Prolog and SWI introductions (in weeks 1 and 2) and worked through all four Prolog labs (in weeks 1,2,3 and 7) including re ecting on the example solutions. You should be familiar with the web-server and Wikipedia functionality of the GridWorld library and you should be comfortable editing and running programs in SWIPL as well as using the online manual and the built-in debugger.
Note that an introductory guide to interactive and declarative logic program debugging was provided in SWIIntro lecture from week 2
Please note that you MUST hit “run” in the GridWorld browser window that will open (or nothing will happen until you do)! See later in this document for alternative ways of running the code in Linux and Windows
Remember to rename the default skeleton submission les above by replacing the number 12345 with your actual student number (a 7-digit number that is not the same as your candidate number or your user id)! Note that failure to use your student number will disrupt the loader and lead to seemingly obscure errors.
Note that, in this documentation, predicates are often annotated with their respective arities (name/arity) and arguments are often annotated with their intended modes (+In, -Out or ?Any) These arity and mode decorations should not
be typed in any actual code – there are included in the documentation to show how the predicates should be used. As explained in the SWI manual:
an input argument (+) must be instantiated to a correctly typed term when the predicate is called,
an output argument (-) will become instantiated (if it wasn’t already) when the predicate succeeds,
and partial arguments (?) may be variable, ground or partially instantiated when the predicate is called and/or succeeds.
Please note that (SWI built-in and GridWorld library) predicates are only guaranteed to work properly (or even at all) when used in the correct way!
You should treat this coursework as a individual take-home open-book time-limited extended-exam. You should work by yourself and without assistance from each other or TAs. But the following support will be available: we will continue running the Drop-In clinic on Thursdays at 12:00-13:00; and you may also continue posting questions to the discussion forum on the Teaching Unit (COMS30014). Please note that sta will be able to help clarify expectations and discuss general issues but they will not be allowed to explicitly help you write coursework solutions.
The deadline for this coursework is 13:00 on Friday (the 10th of December) of Week 11. Answers should be submitted in Blackboard by uploading exactly 4 les (corresponding to the four respective parts) named as follows: cw_12345.pl, cw_wp_12345.pl, cw_maze_12345.pl and cw_report_12345.pdf (where 12345 should be replaced by your student number). Note that you may overwrite your les until the deadline – at which point standard Faculty late penalties will apply (to the submission as a whole). The relevant submission point should be available at least a week before the deadline.
Academic o ences (including submission of work that is not your own, falsi cation of data/evidence or the use of materials without appropriate referencing) are all taken very seriously by the University. Suspected o ences will be dealt with in accordance with the University’s policies and procedures. If an academic o ence is suspected in your work, you will be asked to attend an interview with senior members of the school, where you will be given the opportunity to defend your work. The plagiarism panel are able to apply a range of penalties, depending the severity of the o ence. These include: requirement to resubmit work, capping of grades and the award of no mark for an element of assessment.
If the completion of your assignment issigni cantly disrupted by serious health conditions, personal problems, or other similar issues, you may be able to apply for consideration of extenuating circumstances (in accordance with the normal university policy and processes).
3 GridWorld Library
A Zip le containing the GridWorld library les and skeleton submission les should be downloaded from Blackboard and unzipped on your working machine. These les extend and supersede the library code from the earlier Prolog labs (which means that many of the exported predicates should already be familiar to you). The following diagram provides an overview of the key dependencies between Parts 1-4 of the coursework, the user predicates they’ll need to de ne, the library predicates they’ll need to call, and the les where everything is or needs to be located. Note that:
plain rectangles show library modules (with the exported predicates you may use); round rectangles show parts of the assignment (along with their weighting); semi-round rectangles show the les (and predicates) you’ll need to modify.
In this coursework, you will not need to look at the library code or understand how it works – although you are welcome to look inside the given les if you wish!
Remember that 12345 should be replaced by your (7-digit) student number.
game_predicates.pl command_channel.pl www_browser.pl http.pl
oscar_library.pl
ailp_grid_size/1 ailp_grid_size/1 my_agents/1 my_agent/1
get_agent_position/2 get_agent_position/2
wp_library.pl
link/1 actor/1 wp/1 wp/2 wt_link/2 init_identity/0
cw_wp_12345.pl find_identity/1
agent_adjacent/3 map_adjacent/3 map_distance/3
agent_do_moves/2 agents_do_moves/2
lookup_pos/2 leave_maze/1
cw_maze_12345.pl solve_maze/0
PART 3 (25%) Multi-Agent Maze
get_agent_energy/2 map_adjacent/3 map_distance/3
agent_do_moves/2 say/2
lookup_pos/2 agent_ask_oracle/4
agent_check_oracle/2
cw_12345.pl solve_task/2
PART 1 (25%) Simple Path-Search
PART 2 (25%) ……….. ailp.pl ……… Complex Route-Planning
part3 part1 part2
cw_report_12345.pdf
PART 4 (25%) Short Report
Figure 1: Overview of part/ le/predicate dependencies and grid con gurations
The above dependencies are set up by a le loader ailp.pl that allows you to run the di erent parts of the assignment from the command line. After moving to the library root folder (containing ailp.pl le) you should run the following command:
on a Linux machine type ./ailp.pl cw part in a bash terminal (if necessary, after rst making the le executable with the command chmod +x ailp.pl)
on a Windows machine type swipl ailp.pl cw part or swipl-win ailp.pl cw part in a cmd or powershell terminal; or double click on aipl.pl in an explorer window and type cw part at the Prolog prompt
To enable interaction with the user, the GridWorld provides the additional commands, shown below, to open and close a session. The commands in the top table allow the user to set up a local web-server, display the grid in a browser window, add one or more agents to the game, (re-)initialise the grid, and start the game running. This setup must be completed before the GridWorld library predicates can be called; The commands in the bottom table allow the user to remove agents from the game (one-by-one) and stop the web-server. These commands must be executed, at the Prolog prompt, in the order shown below:
When running the above commands, remember to replace the symbol by the actual digit (1, 2 or 3) representing the required part number:
}3,2,1{ ∈ n
?-start. .
?-join_game(-A).
?-reset_game.
?-start_game.
start web-server
add a new agent to the game and return its integer ID (e.g. 1) – only 1 agent allowed in Parts 1 and 2
(re-)initialise the grid (and stop the game if it is running) begin the game
The extra ” .” after the “start.” command can be optionally used to accept the dialog box which asks the user whether to “open in browser window (y/n)”
☒ Don’tforgettousemakeandreset_gameafteryoumakechangestoyourcode(and you may also need to refresh your browser window).
Remember to hit “run” in the browser window after starting the web-server (or nothing else will happen until you do)!
In order to further facilitate user interaction during a session, the GridWorld also provides an interactive user shell that can be invoked with the following command that allows the user to run the set of macros listed below (which are especially useful for Parts 1 and 2):
Command Meaning
?-shell. open interactive shell that provides the following macros
Note that, while you are not required to use the shell in this coursework, the following macros can signi cantly reduce the amount of typing required and will also print some helpful messages (to the Prolog console and GridWorld window):
?-leave_game.
remove (the current) agent from the game
stop web-server
Table 2: commands to start (top) and end (bottom) a GridWorld session.
% display a list the macros below
% exit from this command shell ?-join_game(A),reset_game,start_game. ?-reset_game,start_game.
?-my_agent(A) ?-my_agent(A),get_agent_position(A,P) ?-my_agent(A),get_agent_energy(A,Energy). ?-my_agent(A),agent_topup_energy(A,Stat).
?position.
?topup(+Stat).
?ask(+Orac,+Qu). ?-my_agent(A),agent_ask_oracle(A,Orac,Qu,Ans).
?call(+G).
?go(+Pos).
?find(+Obj).
?identity.
?-findall(G,call(G),L).
?-search_bf % Lab Search ?-solve_task(go(Pos),Cost). % Part 1 ?-solve_task(find(Obj),Cost). % Part 1
?reset, find(o(1)), ask(o(1),’What is the meaning of life, the universe and everything?’), go(p(7,7)), energy, position, go(p(19,9)), energy, position, call(map_adjacent(p(19,9),_P,_O)), topup(c(3)), energy, go(p(10,10)), energy. % Part 1
?-find_identity(ActorName). % Lab Identity, Part 2 ?-solve_maze. % Part 3
Table 3: Possible shell macros.
Note how the shell prompt “?” omits the dash in the standard Prolog prompt “?-“.
Notice how some of these macros refer to the user predicates solve_task/2, find_identity/1 and solve_maze/0 that you’ll need to (re)de ne in Parts 1, 2 and 3 – so you can use the shell to help you test the behaviour of your code.
Note that the above commands and macros should not themselves be used in any code you submit as they are only there to help you run and test that code!
The easiest way to get a feel for how the GridWorld works is to run the Part1 demo from the library command shell, which will take you step by step through a preprogrammed use case involving the following sequence of main operations:
1. reset the game and execute a path to oracle 1;
2. ask oracle 1 “What is the meaning of life, the universe and everything?”; 3. execute a path to position 7,7;
4. execute a path to position 19,9;
5. verify that the agent is adjacent to charge station 3;
6. top up the agent’s energy;
7. execute a path to position 10,10 (default code fails!).
As you can see from the following gure, because your agent has a limited supply of energy which gets used up as it moves around and queries oracles, and because it only comes with a naive depth- rst search algorithm, by default the agent runs out of energy on this last task – which is an outcome that you’ll need to change as you work through this coursework!
Terminal output GridWorld output
Figure 2: Result of running Part 1 Demo with Skeleton Code
The simplest way to run the demo is with the following sequence of commands which will allow you to easily step through the complete command sequence by just repeatedly pressing the
?- start. . ?- shell.
Various other ways of running the demo are illustrated below – using either the built-in demo macro (centre), or running the constituent shell macros individually (left), or calling their corresponding GridWorld library expansions (right):
The vertical alignment and extent of each box is intended to show the correspondence between the macros and their constituents or expansions:
remember to hit “run” in browser window
start web-server and open browser window
start running the grid simulation
join at least one agent with command join_game/1 or (shell) macro setup/0
<..... join new agent : up to the game
setup the grid (and stop game if already started)
start the game
<.......... :
: :..........
start_game.
. ... shell. ...
join_game(A).
reset_game.
find( (1) ).
solve_task(find( (1) ) ).
:: :
go(p(10,10) ). solve_task(go(p(10,10) ) ). energy.
my_agent(A),
get agent energy(A,E).
get_agent_energy(A,E).
stop shell stop.
leave_game.
<.... . .....
remove current agent from game
stop web-server
remember to close your browser window
halt. exit from Prolog
Figure 3: Some di erent ways the user can run the GridWorld demo
You can enter and leave the user shell at any time; and you can run non-shell commands from within the shell by wrapping them up as an argument to a call macro - which will implicitly nd all solutions of the speci ed goal. If you want to make your head hurt, try running call(shell) from within the shell!
The dotted lines show some ways you can add more agents to the game (applicable in Part 3 which is not restricted to one agent). To do this when the game has started (after a call to start_game or one of the macros setup, reset or demo), you'll need to run a precise sequence of commands comprising a reset_game, one or more join_game, another reset_game and a st
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com