upd readme

This commit is contained in:
zsq259
2024-06-26 22:14:57 +08:00
parent ba1285360b
commit 3555ba6f00
142 changed files with 14835 additions and 12 deletions

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/1-ObsProb.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "1.0"

View File

@ -0,0 +1,22 @@
class: "OutputTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import inference
dist = inference.DiscreteDistribution()
dist['a'] = 0
ans5 = dist.normalize()
# ans = map(float, [ans1, ans2, ans3, ans4])
ans = map(float, [ans5 is None])
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/1-ObsProb.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "0.17 0.33 0.33 0.0 0.17"

View File

@ -0,0 +1,31 @@
class: "OutputTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import inference
dist = inference.DiscreteDistribution()
dist['a'] = 1
dist['b'] = 2
dist['c'] = 2
dist['d'] = 0
dist['e'] = 1
N = 100000.0
samples = [dist.sample() for _ in range(int(N))]
ans1 = round(samples.count('a') * 1.0/N, 2)
ans2 = round(samples.count('b') * 1.0/N, 2)
ans3 = round(samples.count('c') * 1.0/N, 2)
ans4 = round(samples.count('d') * 1.0/N, 2)
ans5 = round(samples.count('e') * 1.0/N, 2)
ans = map(float, [ans1, ans2, ans3, ans4, ans5])
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/1-ObsProb.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "0.16753926701570682 0.33507853403141363 0.041884816753926704 0.0 0.0 0.0 0.0 1.0 0.08376963350785341 1.0 1.0 0.041884816753926704 0.0"

View File

@ -0,0 +1,51 @@
class: "OutputTest"
success: "PASS"
failure: "NO PASS"
# Python statements initializing variables for the test below.
preamble: """
import inference
class dummyGhostAgent(object):
pass
dummyGhostAgent = dummyGhostAgent()
dummyGhostAgent.index = 1
inf = inference.InferenceModule(dummyGhostAgent)
pacmanPosition = (3, 5)
ghostPosition = (4, 6)
jailPosition = inf.getJailPosition()
ans1 = inf.getObservationProb(1, pacmanPosition, ghostPosition, jailPosition)
ans2 = inf.getObservationProb(2, pacmanPosition, ghostPosition, jailPosition)
ans3 = inf.getObservationProb(5, pacmanPosition, ghostPosition, jailPosition)
ans4 = inf.getObservationProb(None, pacmanPosition, ghostPosition, jailPosition)
ans5 = inf.getObservationProb(1, pacmanPosition, jailPosition, jailPosition)
ans6 = inf.getObservationProb(2, pacmanPosition, jailPosition, jailPosition)
ans7 = inf.getObservationProb(5, pacmanPosition, jailPosition, jailPosition)
ans8 = inf.getObservationProb(None, pacmanPosition, jailPosition, jailPosition)
ans9 = inf.getObservationProb(0, pacmanPosition, ghostPosition, jailPosition)
jailPosition = (1000000000000000000000, 1000000000000000000000)
ghostPosition = (1000000000000000000000, 1000000000000000000000)
ans10 = inf.getObservationProb(None, pacmanPosition, ghostPosition, jailPosition)
# battling usage of is instead of ==
jailPosition = [5, 5]
ghostPosition = [5, 5]
ans11 = inf.getObservationProb(None, pacmanPosition, ghostPosition, jailPosition)
# test for NoisyDistance is 0 or None
ans13 = inf.getObservationProb(0, pacmanPosition, ghostPosition, jailPosition)
jailPosition = [0.4, 2.4]
ghostPosition = [1.4, 2.4]
ans12 = inf.getObservationProb(1.2, pacmanPosition, ghostPosition, jailPosition)
ans = map(float, [ans1, ans2, ans3, ans4, ans5, ans6, ans7, ans8, ans9, ans10, ans11, ans12, ans13])
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
max_points: "1"
class: "PassAllTestsQuestion"