Re: [eclipse-users] Dual Enconding CSP

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Mon, 29 Oct 2007 10:12:27 +0100
Christian Riquelme wrote:
> Thanks Marco this help me a lot, but i have a doubt when i tried with V1 and
> V4 it didn't work. I did something wrong?....
> 
> [V1]::[(0,0,1),(0,1,0),(1,0,0)],
> [V4]::[(0,0,0),(0,1,1),(1,0,1)],
> dual_ac(V1,2,V4,1),
> labeling([V1,V4]).
> 
> ?- [V1]::[(0, 0, 1), (0, 1, 0), (1, 0, 0)], [V4]::[(0, 0, 0), (0, 1, 1), (1,
> 0, 1)], dual_ac(V1, 2, V4, 1), labeling([V1, V4]).
> No (0.00s cpu)

Yes, you are right, I forgot to mention that the code I sent you 
actually requires the domain elements to be "flat" terms, only at one 
level. E.g., p(0,0,1) is ok, while (0,0,1) is not, because ECLiPSe 
expands it to (0,(0,1)), so it is not flat.

So you should write:

[eclipse 9]: [V1]::[p(0,0,1),p(0,1,0),p(1,0,0)],
	[V4]::[p(0,0,0),p(0,1,1),p(1,0,1)],
	dual_ac(V1,2,V4,1),labeling([V1,V4]).

V1 = p(0, 0, 1)
V4 = p(0, 0, 0)
Yes (0.00s cpu, solution 1, maybe more) ? ;

V1 = p(0, 0, 1)
V4 = p(0, 1, 1)
Yes (0.00s cpu, solution 2, maybe more) ? ;

V1 = p(0, 1, 0)
V4 = p(1, 0, 1)
Yes (0.00s cpu, solution 3, maybe more) ? ;

V1 = p(1, 0, 0)
V4 = p(0, 0, 0)
Yes (0.00s cpu, solution 4, maybe more) ? ;

V1 = p(1, 0, 0)
V4 = p(0, 1, 1)
Yes (0.00s cpu, solution 5)

>  The other doubt is if i can do something like:
> 
> [V1]::[(0,0,1),(0,1,0),(1,0,0)],
> [V2]::[(0,0,1),(1,0,0),(1,1,1)],
> [V3]::[(0,1,0),(1,0,0),(1,1,0),(1,1,1)],
> [V4]::[(0,0,0),(0,1,1),(1,0,1)],
> 
> dual_ac(V1,2,V4,1),
> dual_ac(V1,1,V2,1),
> dual_ac(V1,3,V4,3),
> dual_ac(V1,3,V3,3),
> dual_ac(V2,3,V3,1),
> dual_ac(V4,2,V3,2),
> dual_ac(V1,3,V2,3),
> 
> labeling([V1,V2,V3,V4,V5]).
> 
> ........ i trying to put all together...

Indeed:

[eclipse 11]: [V1]::[p(0,0,1),p(0,1,0),p(1,0,0)],
	[V2]::[p(0,0,1),p(1,0,0),p(1,1,1)],
	[V3]::[p(0,1,0),p(1,0,0),p(1,1,0),p(1,1,1)],
	[V4]::[p(0,0,0),p(0,1,1),p(1,0,1)],
	dual_ac(V1,2,V4,1),
	dual_ac(V1,1,V2,1),
	dual_ac(V1,3,V4,3),
	dual_ac(V1,3,V3,3),
	dual_ac(V2,3,V3,1),
	dual_ac(V4,2,V3,2),
	dual_ac(V1,3,V2,3),
	labeling([V1,V2,V3,V4]).

V1 = p(0, 0, 1)
V2 = p(0, 0, 1)
V3 = p(1, 1, 1)
V4 = p(0, 1, 1)
Yes (0.00s cpu, solution 1, maybe more) ? ;

No (0.00s cpu)

Cheers,
Marco

> in any case thank for your help..
> 
> Cheers.
> 
> Christian.

-- 
Marco Gavanelli, Ph.D.
Computer Science Division
Dipartimento di Ingegneria
University of Ferrara
Via Saragat 1 - 44100 Ferrara (Italy)
Tel  +39-0532-97-4833
Fax  +39-0532-97-4870
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Mon Oct 29 2007 - 09:12:35 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST