Re: CLP(FD) animation: N-queens
- From: "Carlo Capelli" <carlo.capelli@xxxxxxxx>
- Date: Tue, 12 Feb 2008 11:28:55 +0100
"Carlo Capelli" <carlo.capelli@xxxxxxxx> ha scritto nel messaggio
news:hXdsj.27540$Xg7.23200@xxxxxxxxxxxxxxxxxxxxxxxx
I changed the final part of the program...
"Markus Triska" <triska@xxxxxxxx> ha scritto nel messaggio
news:m1wspf83c9.fsf@xxxxxxxxxxx
Here's how one can go about visualising the constraint solving process
for N-queens in a quite portable and straight-forward way:
http://www.logic.at/prolog/queens/queens.html
The code is tested with SWI-Prolog. Any Prolog that supports reification
of CLP(FD) constraints will do though (possibly with a few changes).
If there's sufficient interest, I will upload some other CLP(FD)
visualisations that I found useful. Sometimes, they can give valuable
hints on which other strategies to try. In any case, I hope you like it!
I'd like so much to see, but i'm using (alas) windows, and i get the
error:
1 ?- show([],4,Qs).
ERROR: open/4: source_sink `pipe(gs -dNOPAUSE -g680x680 -q -)' does not
exist (No such file or directory)
Exception: (8) open(pipe('gs -dNOPAUSE -g680x680 -q -'), write, _L136,
[buffer(false), alias(gs)]) ?
Of course i have GhostScript/GhostView installed, but open(pipe('gs...'))
doesn't seems to work...
I had never seen this kind of presentation (gs based). It's very
interesting, given the level of ps.
I was mumbling about using CLP(FD) to handle this problem:
the layout of some (large) user interface resulting from data driven
iterative processes (sort of reporting RDF based).
Of course the target will be some .NET component. Using AJAX could be a
portable way to tackle the problem.
Bye Carlo
show(Options, N, Qs) :-
tell('c:\\temp\\x.ps'),
integer(N), N > 0,
format("2 2 scale\n"),
postscript(Ps),
format(Ps),
format("~w init\n", [N]),
n_queens(N, Qs),
animate(Qs),
labeling(Options, Qs),
told,
shell('cmd /C c:\\temp\\x.ps').
Bye Carlo.
.
- References:
- CLP(FD) animation: N-queens
- From: Markus Triska
- Re: CLP(FD) animation: N-queens
- From: Carlo Capelli
- CLP(FD) animation: N-queens
- Prev by Date: Re: CLP(FD) animation: N-queens
- Next by Date: Re: CLP(FD) animation: N-queens
- Previous by thread: Re: CLP(FD) animation: N-queens
- Next by thread: Re: CLP(FD) animation: N-queens
- Index(es):
Relevant Pages
|
|