代写COMPSCI 367 Assignment 3代写R编程

COMPSCI  367

Assignment  3

due Wednesday  19  October  2022

Due: by 11:59pm on the due date.  This is a hard due date. Late assignments will not be marked.

Total marks: 10.

Weighting: This assignment counts toward 10% of your final mark.

1.  [2.5  marks]  This  question  asks you to formulate the following problem as a  CSP.

Edmund Hillary and Tenzing Norgay play ten games of Rock-Paper-Scissors. Here are the given facts:

-     Norgay uses Rock once, Paper six times, and Scissors three times.

-     Hillary uses Rock five times, Paper four times, and Scissors once.

-     There are no ties in all 10 games.

-     The order of the games is unknown (and unimportant).

(a) Formulate this problem as a CSP. State clearly the variables, the domains of the variables and the constraints.

Note: We are given a limited vocabulary for how we can formulate our CSP constraints. We may use standard mathematical operators, including equality (=), inequality (≠), addition (+), multiplication (*), and exponentiation (^), where “2^3” is 2-to-the-power-of-3, as well as any other symbols that have been used for CSP constraints in our lectures (e.g., <, >, ≤, ≥).

(Give this a go. If you get stuck, I have put a hint on how to solve this on the last page of this assignment.)

(b) Let’s say that we have a partial assignment of game results as follows:


Given this partial assignment, perform. the Backtracking algorithm and use your results to answer the following questions:

(i)        If Norgay plays Paper in Game 6, what must Hillary play in Game 6? Which of your constraint(s), given the current variable assignments, entails this?

(ii)       Given your answer to (i), what must Hillary then play in game 7. Which of your constraint(s), given the new variable assignments, entails this?

(iii)      After completing the search, who wins the greatest number of games? And how many do they win?

2.  [2.5  marks]  This  question  asks  you to  solve a  CSP problem. We are searching for the correct assignment of numbers to variables.

Here are the given facts:

-     The variables are: A, B, C, D, E, F, G, H.

-     The Domain for each variable is: {1, 4, 5, 7, 9, 14, 16, 21}.

-     None of the variables have the same value (i.e., each value is used only once).

-     The following constraints must be satisfied:

(i)        C + F = G

(ii)       A + C = F

(iii)      B + G = D

(iv)      B + E = H

(v)       D + F = H

(a) Draw the constraint hypergraph for this CSP problem. (For the purposes of drawing the constraint hypergraph, you may ignore the constraint that no two variables have the same value).

(b) Begin with the partial assignment A=1. Apply the AC3 algorithm. At each step, if you have a single variable value assignment, you can delete that value from the other temporary domains. This has been done for you in the first row of the table below. None of the edge consistency checks have been completed, so you will need to do this.

For each row, write the edge that you are testing for consistency in the first column and fill in the rest ofthe row with the resulting temporary domains for each variable.

(Note: the edge may be written as (A,ii) for the edge between variable A and the constraint “A + C = F”)

What are the resulting temporary domains for each variable after the application of the AC3 algorithm?


Question 3 [5 marks]

For this question, you are asked to resolve the Seven Trick Candles logic problem using PDDL.

There are seven trick candles in a circle. Initially, every Candle is Lit. When you blow on a candle, your blow changes the state not just of the candle you blow on, but also both candles either side of it. So, you can think of any blowing action affecting a Trio of candles. The trick is that when a trio of candles is blown on, any candles in that trio that are currently lit will no longer be lit, and candles in the trio that are unlit will become lit! The goal of this puzzle is to blow out all of the candles.

Given what has been said, you can assume at the outset that every candle is a member of exactly three different trios of candles. For example, if you give each candle a number, you can assume that Candle3 will be in the trios: {Candle3, Candle4, Candle5}, {Candle2, Candle3, Candle4} and {Candle1, Candle2, Candle3} and likewise for the other candles. Further, you will note that there are only seven possible distinct trios of candles.

Also, note that every time you select a trio of candles to blow on (an action), there are only eight possible combinations ofthe current states of the candles—lit or unlit—in your selected trio (and eight corresponding effects as a result of the trio being blown on). See the table here:


(a) Write a PDDL domain file candles_domain.pddl that specifies the eight action schemas:

BlowTrioType1BlowTrioType2BlowTrioType3BlowTrioType4BlowTrioType5,

BlowTrioType6BlowTrioType7, and BlowTrioType8.

You need to use the PDDL syntax starting from the following:

(define (domain candles)

(:requirements :strips :equality)

(:predicates (candle ?c) (lit ?c) (trio ?t) (intrio ?t ?c))

//fill in the description here//

)

Note 1: the “equality” requirement in the code above allows you to check whether two objects are different, which will be useful for checks in your action schemas. For example, it allows the following type of check:  (not (= ?c1 ?c2)), which will return True if the variables ?c1 and ?c2 refer to different objects.

Note 2: The  (intrio ?t ?c) relation can be used to check whether a Candle is in a particular Trio of candles or not. For example, if Trio3 contains {Candle2, Candle3, Candle4} then a precondition in an action that checks  (intrio Trio3 Candle3) will return True. Likewise, the same code could be used elsewhere in part (b) of this question to assign Candle3 to Trio3.

(b) Write a PDDL problem file candles_task.pddl that specifies the initial state and the goal state.

Submit the two files candles_domain.pddl and candles_task.pddl.

You may use the PDDL Editor to test your code:http://editor.planning.domains/

Hint for Question 1(a): One way we might specify constraints for sentences like “Norgay played Rock five times, Paper four times, and Scissors once” is to utilise the properties of prime factorisation. Instead of the Domain for each game using letters—say, “R”=Rock, “P”=Paper and “S”=Scissors—the domain could instead use a different prime numberpi, to stand in for each of the options (p1=Rock, p2=Paper, p3=Scissors).

So, for example, if we knew that for a series of games, G1, G2, G3, that a player used Rock twice and Scissors only once, and we use prime numbers 2=Rock and 3=Scissors (so that the domain for each outcome is {2,3}), then we can specify the constraint that: G1 * G2 * G3 = 2^2 * 3^1.

Also note that formulating the constraint this way means that a partial assignment of two-Scissors (i.e., two-3s) to G1 and G2 in this case would be illegal, as the value of 2^2 * 3^1 (=12) cannot be divided by 3^2 (=9). Thank goodness for prime numbers!




热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图