首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CS 440程序讲解、辅导algorithm编程、讲解Python,Java编程 调试Matlab程序|解析C/C++编程
项目预算:
开发周期:
发布时间:
要求地区:
Computer Science Department - Rutgers University Spring 2021
CS 440: This Maze is on Fire 16:198:440
A maze will be a square grid of cells / locations, where each cell is either empty or occupied. An agent wishes to
travel from the upper left corner to the lower right corner, along the shortest path possible. The agent can only
move from empty cells to neighboring empty cells in the up/down direction, or left/right - each cell has potentially
four neighbors.
Figure 1: Successful and Unsuccessful Maze Environments.
Mazes may be generated in the following way: for a given dimension dim construct a dim x dim array; given a
probability p of a cell being occupied (0 < p < 1), read through each cell in the array and determine at random if
it should be filled or empty. When filling cells, exclude the upper left and lower right corners (the start and goal,
respectively). It is convenient to define a function to generate these maps for a given dim and p.
Figure 2: Maps generated with p = 0.1, 0.3, 0.5 respectively.
1
Computer Science Department - Rutgers University Spring 2021
Preliminaries
• Problem 1: Write an algorithm for generating a maze with a given dimension and obstacle density p.
• Problem 2: Write a DFS algorithm that takes a maze and two locations within it, and determines
whether one is reachable from the other. Why is DFS a better choice than BFS here? For as large a
dimension as your system can handle, generate a plot of ‘obstacle density p’ vs ‘probability that S can
be reached from G’.
• Problem 3: Write BFS and A∗ algorithms (using the euclidean distance metric) that take a maze and
determine the shortest path from S to G if one exists. For as large a dimension as your system can
handle, generate a plot of the average ‘number of nodes explored by BFS - number of nodes explored by
A∗
’ vs ‘obstacle density p’. If there is no path from S to G, what should this difference be?
• Problem 4: What’s the largest dimension you can solve using DFS at p = 0.3 in less than a minute?
What’s the largest dimension you can solve using BFS at p = 0.3 in less than a minute? What’s the
largest dimension you can solve using A∗ at p = 0.3 in less than a minute?
Consider, as you solve these three problems, simple diagnostic criteria to make sure you are
on track. The path returned by DFS should never be shorter than the path returned by BFS.
The path returned by A∗ should not be shorter than the path returned by BFS. How big can and
should your fringe be at any point during these algorithms?
However, we are are not just interested in solving static mazes - these mazes are on fire, actively burning down around
you. We model this in the following way: for every move the agent makes, the fire then advances (described below),
and they alternate back and forth. The agent would like to exit the maze prior to running into the fire. Under this
model, while an agent might utilize a search algorithm to generate an optimal path through the the current state
of the maze (analyzing the current state and planning a future path through it), it will not necessarily be valid for
future states of the maze. This means that while the agent may plan a short path through the maze, whether or not
it will be able to take that path depends on the fire. In this case, the environment is dynamic, changing over time.
We model the advancement of the fire in the following way: any cell in the maze is either ‘open’, ‘blocked’, or ‘on
fire’. Starting out, a randomly selected open cell is ‘on fire’. The agent can move between open cells or choose to
stay in place, once per time step. The agent cannot move into cells that are on fire, and if the agent’s cell catches
on fire it dies. But each time-step the agent moves move, the fire may spread, according to the following rules: For
some ‘flammability rate’ 0 ≤ q ≤ 1
• If a free cell has no burning neighbors, it will still be free in the next time step.
• If a cell is on fire, it will still be on fire in the next time step.
• If a free cell has k burning neighbors, it will be on fire in the next time step with probability 1 − (1 − q)
k
.
We might express this with the following pseudocode for advancing the fire one step:
2
Computer Science Department - Rutgers University Spring 2021
def advance_fire_one_step(current maze):
create a copy of the current maze
for every (x,y) in the current maze:
if (x,y) is not on fire in current maze and (x,y) is not an obstacle:
count the number of neighbors of (x,y) in current maze that are on fire
store that as k
prob = 1 - (1-q)^k
if random() <= prob
mark (x,y) as on fire in maze copy
return maze copy
Note, for q = 0, the fire is effectively frozen in place, and for q = 1, the fire spreads quite rapidly. Additionally,
blocked cells do not burn, and may serve as a barrier between the agent and the fire.
How can you solve the problem (to move the agent from upper left to lower right, as before) in this situation?
Consider the following base line strategies:
Strategy 1) At the start of the maze, wherever the fire is, solve for the shortest path from upper left to lower right, and
follow it until the agent exits the maze or burns. This strategy does not modify its initial path as the fire
changes.
Strategy 2) At every time step, re-compute the shortest path from the agent’s current position to the goal position, based
on the current state of the maze and the fire. Follow this new path one time step, then re-compute. This
strategy constantly re-adjusts its plan based on the evolution of the fire. If the agent gets trapped with no
path to the goal, it dies.
For each strategy, for as large a dimension as your system can handle, and obstacle density p = 0.3, generate a plot
of ‘average successes vs flammability q’. Which is the superior strategy? For each test value of q, generate and solve
at least 10 mazes, restarting each 10 times with new initial fire locations. Note: Please discard any maze where
there is no path from the start to the goal node. Additionally, please discard any maze where there is no path from
the initial position of the agent to the initial position of the fire - for these mazes, the fire will never catch the agent
and the agent is not in danger. Your prior functions will be useful here.
Come up with your own strategy to solve this problem (+5 points are available if you come up with a clever acronym
for your strategy), and try to beat both the above strategies. How can you formulate the problem in an approachable
way? How can you apply the algorithms discussed? Note, Strategy 1 does not account for the changing state of the
fire, but Strategy 2 does. But Strategy 2 does not account for how the fire is going to look in the future. How could
you include that?
A full credit solution must take into account not only the current state of the fire but potential future states of the
fire, and compare the strategy to Strategy 1 and Strategy 2 on a similar average successes vs flammability graph.
Additionally, while your strategy may increase survivability, analyze the time costs of your strategy compared to the
other two - in a real burning maze, you have limited time to make your decisions about where to move next. Be
clear and explicit in your writeup, presenting your reasoning and ideas behind your strategy.
3
Computer Science Department - Rutgers University Spring 2021
• Problem 5: Describe your improved Strategy 3. How does it account for the unknown future?
• Problem 6: Plot, for Strategy 1, 2, and 3, a graph of ‘average strategy success rate’ vs ‘flammability
q’ at p = 0.3. Where do the different strategies perform the same? Where do they perform differently?
Why?
• Problem 7: If you had unlimited computational resources at your disposal, how could you improve on
Strategy 3?
• Problem 8: If you could only take ten seconds between moves (rather than doing as much computation
as you like), how would that change your strategy? Describe such a potential Strategy 4.
Your report needs to be clear to the point that the grader can understand and reconstruct your
strategy from your description. If they can’t, they’re justified in giving no credit, and you’ll
have to argue for it back later.
4
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
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
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!