Of Linda Alvord
Sent: Saturday, November 17, 2012 10:27 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Hi Michal, I keep working on your code and I hit a snag? Maybe someone can
explain the domain error that I encounter.
n=: 5
X=:(?(2#n)$2)*(i.n)/i.n
adj
@: and capped fork.
Linda
-Original Message-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
Sent: Sunday, November 11, 2012 1:56 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
@**forums.jsoftware.com
programming-boun...@forums.jsoftware.com]
On Behalf Of km
Sent: Wednesday, November 14, 2012 4:29 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Responding to Mike's query about @
Mathematical composition f o g means do g first
:
programming-bounces@**forums.jsoftware.com
programming-boun...@forums.jsoftware.com]
On Behalf Of km
Sent: Wednesday, November 14, 2012 4:29 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Responding to Mike's query about @
Mathematical composition f
Sent: Saturday, November 17, 2012 10:27 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Hi Michal, I keep working on your code and I hit a snag? Maybe someone can
explain the domain error that I encounter.
n=: 5
X=:(?(2#n)$2)*(i.n)/i.n
adj=: 13 :'(0y
: Linda Alvord lindaalv...@verizon.net
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Message-ID: 01cdc6f8$3b5c34a0$b2149de0$@net
Content-Type: text/plain; charset=utf-8
Here?s a simpler version of the domain error that I can?t correct.
A=:4
B
.**jsoftware.comprogramming-boun...@forums.jsoftware.com[mailto:
programming-bounces@**forums.jsoftware.comprogramming-bounces@forums
.jsoftware.com]
On Behalf Of km
Sent: Wednesday, November 14, 2012 4:29 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
...@forums.jsoftware.com[mailto:
programming-bounces@**forums.jsoftware.comprogramming-boun...@forums.jsoftware.com]
On Behalf Of km
Sent: Wednesday, November 14, 2012 4:29 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Responding to Mike's query about
...@forums.jsoftware.com[mailto:
programming-bounces@**forums.jsoftware.comprogramming-boun...@forums.jsoftware.com]
On Behalf Of km
Sent: Wednesday, November 14, 2012 4:29 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Responding to Mike's query about
:40 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
But what's wrong with @ that's preferable with [: ?(I think
Th is has been asked before.)
Aren't they both devices to represent what ordinary mathematicians
just write as f g h ... for the composition
...@forums.jsoftware.com] On Behalf Of Mike Day
Sent: Sunday, November 11, 2012 7:15 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
I don't think you can remove the @, although you may use the cap, [: ,
instead, but then you need to force the rank:
([:(#0 1 2 3@(0)))1
...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Saturday, November 10, 2012 12:44 PM To:programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
On Sat, Nov 10, 2012 at 12:16 PM, Michal D.michal.dobrog...@gmail.com
wrote:
Here X
-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
Sent: Saturday, November 10, 2012 2:35 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Kip suggested doing some testing. Over time you will develop all kinds
3$3
3 3 3
3#3
3 3 3
(3#3)-:3$3
1
3$3 4
3 4 3
3#3 4
3 3 3 4 4 4
On Fri, Nov 9, 2012 at 10:21 PM, Michal D. michal.dobrog...@gmail.comwrote:
Some nice things learned: ?~ instead of (?]).
Bo: is it true that (3$3) is not a list of integers but (3#3) is?
Fascinating discussion on
I have been struggling with understanding this program, and I have an
issue that I need clarified:
D
1 0 0 1
0 1 0 1
1 0 1 0
1 1 0 0
c1
1 0 1 0
1 1 1 0
1 1 1 0
1 0 0 0
X
0 0 0 0
0 0 0 1
0 0 0 0
0 2 0 0
Here, I am thinking that an arc consistent result can only have 1
values in half of
On Sat, Nov 10, 2012 at 12:16 PM, Michal D. michal.dobrog...@gmail.com wrote:
Here X is telling us to use the constraint c1 (presumably b/c C is not
shown) between the variables 1 and 3 (0 based). Likewise, use the
transpose going the other direction (3,1).
Ouch, you are correct, I did not
...@forums.jsoftware.com] On Behalf Of Peter B.
Kessler
Sent: Thursday, November 08, 2012 9:24 PM
To: programm...@jsoftware.comn
Subject: Re: [Jprogramming] Arc consistency in J
The shape of the arguments to the verb that's being inserted is 3x4, so
when
that verb returns an atom, as dyadic + does
Of Peter B.
Kessler
Sent: Thursday, November 08, 2012 9:24 PM
To: programm...@jsoftware.comn
Subject: Re: [Jprogramming] Arc consistency in J
The shape of the arguments to the verb that's being inserted is 3x4,
so when that verb returns an atom, as dyadic + does, the shape of the
result is 3x4
] On Behalf Of Devon
McCormick
Sent: Wednesday, November 07, 2012 12:56 PM
To: J-programming forum
Subject: Re: [Jprogramming] Arc consistency in J
At first glance, I thought the right tine of this fork
(2 %~ ]) [: (? ]) $
could be replaced by an idiom I frequently use
(?@$)
but then realized
: Re: [Jprogramming] Arc consistency in J
ee=:(]%2) ?~@$
ee
0.5 ?~@$
ff=: 13 :'0.5 ?~x$y'
ff
0.5 [: ?~ $
5 ff 8
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 1 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
J is so smart, it eliminate the need for *
hh=: 13 :' ?~x$y'
hh
. november 2012
Emne: Re: [Jprogramming] Arc consistency in J
ee=:(]%2) ?~@$
ee
0.5 ?~@$
ff=: 13 :'0.5 ?~x$y'
ff
0.5 [: ?~ $
5 ff 8
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 1 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
J is so smart, it eliminate the need for *
hh=: 13 :' ?~x$y'
hh
Subject: Re: [Jprogramming] Arc consistency in J
The shape of the arguments to the verb that's being inserted is 3x4, so when
that verb returns an atom, as dyadic + does, the shape of the result is 3x4.
But dyadic ? (Deal[1]) doesn't return an atom: it returns a list of the
number of items of its left
...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Peter B.
Kessler
Sent: Thursday, November 08, 2012 9:24 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
The shape of the arguments to the verb that's being inserted is 3x4, so when
At first glance, I thought the right tine of this fork
(2 %~ ]) [: (? ]) $
could be replaced by an idiom I frequently use
(?@$)
but then realized that what we need is
(?~@$)
so dd can be written as
(]%2) ?~@$
On Wed, Nov 7, 2012 at 1:31 AM, Michal D.
-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Roger Hui
Sent: Tuesday, November 06, 2012 11:54 AM
To: Programming forum
Subject: Re: [Jprogramming] Arc consistency in J
'noun verb verb' is a fork and is interpreted as 'noun_ verb
, 2012 11:54 AM
To: Programming forum
Subject: Re: [Jprogramming] Arc consistency in J
'noun verb verb' is a fork and is interpreted as 'noun_ verb verb' (noun_
is a constant verb whose result is noun). http://keiapl.org/anec/#nvv
'verb verb noun' can not be made into a fork because 'verb noun
...@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
Thanks Roger, that makes sense now. The history of J is one of it`s
intriguing aspects for sure.
Re: Linda: I would call it a v(erb) as opposed to a N(oun). But what do I
know? ;-)
Mike
On Tue, Nov 6, 2012 at 8:53 AM, Roger Hui rogerhui.can...@gmail.com wrote:
'noun verb verb' is a fork and
-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
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
Ok... so this implies some kind of ordering constraint on the use of
non-commutative relationships.
I am going to guess that this constraint has something to do with the
ordering of your D -- for example that lower-valued row indexes into D
must always appear on the left side of the
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
-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
: 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
...@forums.jsoftware.com] On Behalf Of Michal D.
Sent: Monday, November 05, 2012 10:19 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
Actually, this is a bug in the original code. Thanks Linda! It should be:
(d%2) (?]) n$d
The idea being that each row (domain) has half
Michal, Once you have what you want, you can use some tools to study it:
Change from a Noun to a verb, view its tacit version and apply it to data:
dd=: 13 :'(y%2) (?]) x$y'
dd
(2 %~ ]) [: (? ]) $
7 dd 3
1 1 0
1 0 1
0 1 1
0 1 1
0 1 1
0 1 1
0 1 1
Both the boxed version
Michal D. michal.dobrog...@gmail.com wrote: I'm not sure why to prefer
doubling an entire array as opposed to dividing a single scalar?
Doubling an integer provides an integer, while division transcends the realm of
integers. That's why. - Bo
In
A=. 0= ? (2$n)$2 NB. generate random matrix of [0,1]
The 0= is unnecessary, and probably reflects a habit based on the
false idea that boolean algebra is does not have an integer domain.
Boolean rings have (subset of) integer domains, and [even after
redefinition] boolean algebra is a
Actually...
ac is a wrapper for revise, which supplies a value for ys (which is
the same thing as xs) which initially takes the value i.#D which is
i.n but this changes over time... I need to think about this pattern.
But for the moment, since the right argument to revise is a pair, and
it's
In revise, you are using a pair for your right argument.
It looks to me like this might be unnecessary -- that you could use
ys=. I.+./1 D
But this does not exactly reproduce your algorithm. So if this change
breaks your algorithm, could you find an example situation which
illustrates this
The adjacency matrix A is important because it tells us which constraint to
look up in C. This also explains why the lower diagonal is doubled.
For example, take the less than constraint:
c =: |: (i.n) / (i.n)
2 2 $ '' ; 'Dx' ; 'Dy' ; c
+--+---+
| |Dx |
+--+---+
|Dy|0 0 0 0|
I think I am having a problem envisioning how a sudoku-style puzzle
can work with a relationship which is not commutative, and I am also
having a problem having to do with the transitive character of the
relationship.
As you have put it:
(note: constraints are not symmetric, for example xy)
The solver can solve sudoku puzzles (hopefully =)) but it should also be
able to handle more general csp instances where the constraints are not
symmetric. In the case of a sudoku puzzle, I think a single symmetric
not-equal constraint would suffice.
n=: 81
d=: 9
] C=: a: , (i.d) ~:/
On Sun, Nov 4, 2012 at 4:47 PM, Michal D. michal.dobrog...@gmail.com wrote:
The solver can solve sudoku puzzles (hopefully =)) but it should also be
able to handle more general csp instances where the constraints are not
symmetric. In the case of a sudoku puzzle, I think a single symmetric
On Sun, Nov 4, 2012 at 5:17 PM, I wrote:
Here's a brute force implementation of A for sudoku:
C=: |: R=: ,9#,:i.9 NB. identity within columns (C) and rows (R)
B=: ,3#3#1 i.3 3 NB. identity within boxes
A=: ((2*/~i.81)+/~i.81) * (+. |:) (C =/ R) +. (C =/B ) +. (R =/ B)
That was
Here's a brute force implementation of A for sudoku:
C=: |: R=: ,9#,:i.9 NB. identity within columns (C) and rows (R)
B=: ,3#3#1 i.3 3 NB. identity within boxes
A=: ((2*/~i.81)+/~i.81) * (+. |:) (C =/ R) +. (C =/B ) +. (R =/ B)
I left the extraneous right-most set of parenthesis in
As far as I can understand the revise verb, you don't need the
adjacency matrix a, although it does help to have a 2-column matrix of
index pairs.
I think Raul has overlooked your use of the right argument ys within that
verb, though he's right about selecting with it. Here's a derivation
: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] Namens Mike Day
Verzonden: zondag 4 november 2012 18:53
Aan: programm...@jsoftware.com
Onderwerp: Re: [Jprogramming] Arc consistency in J
As far as I can understand the revise verb, you don't need the
adjacency
Hello, Michal D - Mike Day here!
Sorry, I meant your lower case a, the boxed array of to-nodes,
derived from upper case A which IS the adjacency matrix, which is of
course essential. revise need not be provided with a as well as A,
and can make do with the 2-column matrix of node-pairs
On Sun, Nov 4, 2012 at 6:29 PM, Michal D. michal.dobrog...@gmail.com wrote:
for all w in Dy there exists a v in Dx such that the relationship v
compare w is true.
Does this sound right?
Yes, that sounds right so long as compare implies looking up the values in
the correct constraint table.
Haha, hello Mike D!
I figured you were talking about a. I think I followed the 2-column
matrix of node-pairs conversation for the most part, except for RE Boss's
contribution which I didn't appreciate until just now. The -: initially
threw me off so I thought the whole expression was replaced
On Sun, Nov 4, 2012 at 9:46 PM, Michal D. michal.dobrog...@gmail.com wrote:
to J, it would be nice to use more primitive operations. Why the dislike
for a? I'm guessing it's a stab at removing some of the code?
Passing the same data, multiple ways, to J function is something of a
bad code
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.
a happy ending.
Linda
-Original Message-
From: programming-bounces@forums.jsoftware.commailto:programming-bo
un...@forums.jsoftware.com] On Behalf Of Raul Miller
Sent: Friday, November 02, 2012 1:04 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Arc consistency in J
On Fri
Thank you everyone for the comments and encouragement.
I think Bo's (?]) and accompanying code was an interesting illustration of
a nice use of the hook. I'm not sure why to prefer doubling an entire
array as opposed to dividing a single scalar? I think that inlining getx
and gety is anti-style
Hi Mike
You request comments regarding style. Style is a matter of taste, so don't take
my comments as criticism.
Your very first expression
(n%2)(]?]) n$d
can be written without division:
n+:(?])n#dThe value depends on two variable, n and d, and so you may create
a dyadic verb,
If your program works I'd say you aren't doing something wrong.
Raul Miller proposed a naming convention which I've found useful. In
short:
NOUN Conjunction Adverb verb
I think you'd do well to next learn the ~ adverb, reflex/passive.
And someday you'll run across the special code page:
57 matches
Mail list logo