Mike, I think this will work as an alternative to  adj

    A
0 0 1 0
0 0 0 0
2 0 0 1 
0 0 2 0
   adj
<@#&0 1 2 3@(0&<)
   adj A
--TT---T-┐
│2││0 3│2│
L-++---+--
   h
0 1 2 3 <@#~ 0 < ]
   h A
--TT---T-┐
│2││0 3│2│
L-++---+--
    
 Can anyone remove the final  @  from  h  ?

Linda
 

-----Original Message-----
From: programming-boun...@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 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 specify C.  On retesting, though, it looks
like my results stay the same when I use:

arccon=:3 :0
   'D c1 X'=: y
   'n d'=: $D
   adj =: ((<@#)&(i.n)) @ (0&<)
   A =: adj X
   C=: a: , c1 ; (|:c1)
   ac =: > @ (1&{) @ (revise^:_) @ ((i.n)&;)
   ac D
)

For longer scripts like this, I really need to get into the habit of
restarting J for every test.  So that probably means I should be using jhs.

> Given the structure of X, only variables 1 and 3 can possibly change. 
> So if they are all changing something is definitely wrong.

This line of thinking does not make sense to me.  I thought that the
requirement was that a 1 in D exists only when there is a valid relationship
along a relevant arc.  If a 1 in D can also exist in the absence of any
relevant arc, I am back to needing a description of the algorithm.

> Unfortunately I've run out of time to read the rest of your response 
> but hopefully I can get through it soon.  I've also wanted to write a 
> simpler version of the algorithm where the right argument of ac is 
> only D and it runs through all the arcs in the problem instead of 
> trying to be smart about which ones could have changed.

Yes... I am currently suspicious of the "AC-3 algorithm".

In the case of symmetric consistency, I think that it's unnecessary
complexity, because the system converges on the initial iteration.

In the case of asymmetric consistency, I think that the work involved in
maintaining the data structures needed for correctness will almost always
exceed the work saved.

But I could be wrong.  I am not sure yet if I understand the underlying
algorithm!

--
Raul
----------------------------------------------------------------------
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