%%文件名:queenrot.mzn%用法:%>迷你锌-a--soln-sep“”--search-complete-msg“”-D“n=20;”queenrot.mzn|awk'NF'>temp1.txt%>awk'开始{print“[\\”};结束{print”[]];“};{打印$0“,\\”};'temp1.txt>temp2.txt%>gp-qf-s 256000000 lexsort.gp>sol20.txt%>猫lexsort.gp/*{a=读取(“temp2.txt”);b=vecsort(a,lex);对于(i=1,#b,my(len=#b[i]);if(!len,next());对于(j=1,len-1,打印1(b[i][j],“”);打印(b[i][len]);退出(0);}*/%%另请参阅http://www.minizinc.org%包括“globals.mzn”;整数:n;var 1..n:x的数组[1..n];var 1..n:y的数组[1..n];约束逆(x,y);约束alldifferent([x[k]+k|k in 1..n]);约束alldifferent([x[k]-k|k in 1..n]);所有约束([x[k]+y[k]==n+1|k in 1..n]);解决满意度;输出[显示(x)];