Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

matching variables multiple solutions 1

Status
Not open for further replies.

synhedionn

Programmer
Oct 22, 2008
9
FR
Hi,
In swiprolog, when
[library(clpfd)].
X in 0..10 , Y in 0..10 , X mod Y #= 0 , X / Y #=2 .

It gives
X in 2..10,
X/Y#=2,
X mod Y#=0,
Y in 1..10.

But it's not very useful if I don't have couples of solutions, i.e. for X=2 -> Y=1 etc...
So how can I have the different couples?
 
X in 0..10 , Y in 0..10 , X mod Y #= 0 , X / Y #=2, label([X,Y]).
 
thanks, almost! ... but it gives

X = 2,
Y = 1

but why doesn't it give the other solutions too (ie X = 4,
Y = 2 ; X = 6,
Y = 3 ; 8,4 ; 10,5)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top