Java 求解N皇后问题的最小冲突算法
使用nQueens问题 如何将此算法转换为java代码Java 求解N皇后问题的最小冲突算法,java,algorithm,artificial-intelligence,Java,Algorithm,Artificial Intelligence,使用nQueens问题 如何将此算法转换为java代码 function MIN-CONFLICTS(csp,max_steps) returns a solution or failure inputs: csp, a constraint satisfaction problem max_steps,the number of steps allowed before giving up current<-- an initial assignmen
function MIN-CONFLICTS(csp,max_steps) returns a solution or failure
inputs: csp, a constraint satisfaction problem
max_steps,the number of steps allowed before giving up
current<-- an initial assignment for csp
for i=1 to max_steps do
if current is a solution of csp then return current
var<-- a randomly chosen, conflicted variable from VARIABLES[csp]
value<-- the value v for var that minimizes CONFLICTS(var,v,current,csp)
set var = value in current
return failure
去助教的办公时间或向教授寻求帮助。没有尝试写下限制条件?说明得不好但广为人知的问题?没有尝试自己的解决方案?最小代表用户?闻起来像是家庭作业。他被困在必须放下啤酒罐的地方。非常感谢,我怎么忘了。