八皇后问题变种 硅谷AI硕士作业题 One assignment of the MSc in USC

前一阵子,一个在USC读书(master in AI)的哥们发来了他们一门课的作业题,让我帮着看看,我就试着写了一下,学习了学习,想看看美帝硅谷的CS学生都在学什么。

题目是这样的:


读入一个文件,which描述了一个N*N的矩阵,里面有些障碍物,然后要往里放皇后(国象的后),要使得他们之间互不能影响到。然后现在要求我们用三种方法解决这个问题:DFS、BFS、SA,分别是深搜、宽搜、模拟退火。作业的pdf文件很长,我节选了一下原文:


You will write a program that will take an input file that has an arrangement of trees and will output a new arrangement of lizards (and trees; as already mentioned, you can’t move the trees) such that no baby lizard can eat another one. You will be required to create a program that finds the solution. To find the solution you will use the following algorithms:
- Breadth-first search (BFS)
- Depth-first search (DFS)
- Simulated annealing (SA).
Input: The file input.txt in the current directory of your program will be formatted as follows:
First line: instruction of which algorithm to use: BFS, DFS or SA
Second line: strictly positive 32-bit integer n, the width and height of the square nursery

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值