Solves the MiniZinc model MznModel, given in the simplest form as a string in MiniZInc syntax. The problem is solved using a mapping to a concrete ECLiPSe solver, as specified in the SolverOrOptions argument. Search and output are done according to the model's solve and output items.
Note that, because of the rules for escaping characters within ECLiPSe strings, any backslashes in the MiniZinc source have to be doubled, and double quotes must be escaped with a backslash!
Obviously, one would like to pass parameters into a model. The model can therefore be given as a list of strings in MiniZinc syntax, interleaved with ECLiPSe ground terms that serve as parameter instantiations. The actual MiniZinc model then consists of the concatenation of all these parts.
?- mzn_run_string(" int: n = 8; array [1..n] of var 1..n: q; constraint forall (i in 1..n, j in i+1..n) ( q[i] != q[j] /\\ q[i] + i != q[j] + j /\\ q[i] - i != q[j] - j ); solve satisfy; ", fzn_ic). Starting search q = [1,5,8,6,3,7,2,4] Total time 0.020s cpu (0.020 setup+ 0.000 search) Yes (0.02s cpu, solution 1, maybe more) ?- N=8, mzn_run_string([" int: n = ", N, "; array [1..n] of var 1..n: q; constraint forall (i in 1..n, j in i+1..n) ( q[i] != q[j] /\\ q[i] + i != q[j] + j /\\ q[i] - i != q[j] - j ); solve satisfy; "], fzn_ic). Starting search q = [1,5,8,6,3,7,2,4] Total time 0.020s cpu (0.020 setup+ 0.000 search) N = 8 Yes (0.02s cpu, solution 1, maybe more) </PRE>