Re: Solving a set of boolean equations
- From: Ecirbaf <fabrice.marchant@xxxxxxxxx>
- Date: Wed, 31 Oct 2007 07:24:26 -0700
On Oct 30, 3:44 pm, "Neng-Fa Zhou" <nz...@xxxxxxx> wrote:
Try a CLP(FD) system (e.g., B-Prolog, Sicstus). Here is an encoding of your
example problem:
solve(Vars):-
Vars=[X,Y,Z],
Vars :: 0..1,
X #\ Y #\ Z #= 1, % the binary operator #\ is for xor
X #/\ (#\ Y) #= 0, % the unary operator #\ is for not
labeling(Vars).
Thanks a lot for your fine answer !
It's very kind you gave me exactly what I needed : the answer to my
example.
I installed B-Prolog ( I discover you worked on it ) to try the
above code :
B-Prolog Version 7.0, All rights reserved, (C) Afany Software
1994-2007.
Type 'help' for usage.
| ?- [ex0]
consulting::ex0.pl
yes
| ?- listing
solve(A) :-
A=[B,C,D],
A::0..1,
B#\C#\D#=1,
B#/\(#\C)#=0,
labeling(A).
yes
| ?- solve(Solution)
Solution = [1,1,1] ?
---------------------------------------------------------------
It seems to perfectly work.
A very beginner question : it seems to ask me if I want more
solutions, Please how to say it to express the remaining two ?
Regards,
Fabrice
-----------------------------------------------------------------
"What's a color of a chameleon put onto a mirror ?" Steward brand
.
- Follow-Ups:
- Re: Solving a set of boolean equations
- From: Ecirbaf
- Re: Solving a set of boolean equations
- References:
- Solving a set of boolean equations
- From: Ecirbaf
- Re: Solving a set of boolean equations
- From: Neng-Fa Zhou
- Solving a set of boolean equations
- Prev by Date: Re: Solving a set of boolean equations
- Next by Date: Re: Solving a set of boolean equations
- Previous by thread: Re: Solving a set of boolean equations
- Next by thread: Re: Solving a set of boolean equations
- Index(es):