This sequence has a few problems:

A=. ? (2$n)$2          NB. generate random matrix of [0,1]
A=. A *. (i.n) </ i.n  NB. make it upper diagonal, zeros on diagonal
] A=. A + |: 2*A       NB. make it symmetrix referencing transpose in C.

All the ideas you used are correct. Maybe something like this is simpler:

    f=: 13 :'(i.y)</i.y'
   (f n)+|:2*f n=:4
0 1 1 1
2 0 1 1
2 2 0 1
2 2 2 0

Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Michal D.
Sent: Monday, November 05, 2012 10:29 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J

Hi Linda, you are a bug finding machine!  c11 is simpler than the original
and is more correct than the latest version I put up on pastebin.  I
introduced a bug by removing the 0= from this although I shouldn't have.

Cheers,

Mike

On Mon, Nov 5, 2012 at 3:06 AM, Linda Alvord <lindaalv...@verizon.net>wrote:

> Next, isn't c1 the same as c11?
>
> I make silly little scripts like this and I run them in a new Jconsole 
> and then do T '' lots of times until I'm pretty sure they agree.
>
> T=: 3 : 0
> n=:1+?6
> d=:1+?6
> ]D=:(n%2) > (?]) n$d
> ]E=:?(n,d)$2
> ]c1=:0= ? A=:(2$d)$(>. d%2)
> ]c11=:?(d,d)$2
> F=:($D)-:$E
> G=:($c1)-:$c11
> F,G
> )
>
> T ''
>
>
> Linda
>
> -----Original Mesesageh
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftrware.com] On Behalf Of Linda 
> Alvord
> Sent: Monday, November 05, 2012 5:12 AM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Arc consistency in J
>
> I just began to ponder this thread. Do you think E is the same as D?
> th
> D=. (n%2) > (?]) n$d
> E=. ?(n,d)$2
>
> Linda
>
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Michal D.
> Sent: Sunday, November 04, 2012 11:26 PM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Arc consistency in J
>
> > >> variables.  In other words, if we specify the constraint x < y it 
> > >> looks like either x1 < x2 or x2 < x1 is sufficient to satisfy arc 
> > >> consistency.  In other words, i think we should always use the 
> > >> symmetric closure of the constraint.
> > >
> > >> Does this sound valid to you?
> > >
> > > Unfortunately not.  There are no values that can satisfy x1<x2 and
> x2<x1.
> > > If this was the case all csps would have no solutions
> >
> > I meant x1<x2 OR x2<x1
> >
> > So symmetric closure was the wrong term for me to use.
> >
> > But I think we want to be using intersection of the relationship 
> > with its inverse.
> >
> > Does that sound right to you?
> >
>
> Sorry I missed the or.  Unfortunately not, I mean you can have a 
> constraint like that if you want but you don't have to have to in 
> general.  I think we're dwelling on an implementation detail.  They 
> (wikipedia) must just have the < constraint propagating both ways.
>
> My brain is fried but I did hack together an ugly search procedure.  
> You can try it out on a sudoku puzzle if you want.  For some reason I 
> couldn't generate it using the code you gave me.  
> http://pastebin.com/2zPB4DBA
>
> Maybe we can update the printf docs to say:
> load 'format/printf'
> http://www.jsoftware.com/help/jforc/input_and_output.htm
>
> Cheers,
>
> Mike
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to