networks: Slightly optimize interaction?.
This commit is contained in:
parent
8a1f4c682e
commit
bfc48ff453
1 changed files with 4 additions and 3 deletions
|
@ -404,14 +404,15 @@
|
|||
;;; state f(s') in which the value for y is different from f(s).
|
||||
(define (interaction? network doms x y)
|
||||
(define states-not-x (build-all-states (hash-remove doms x)))
|
||||
(define dom-x (hash-ref doms x))
|
||||
(define y-func (hash-ref network y))
|
||||
(define (different-ys-exist? st)
|
||||
(define x-states (for/list ([x-val (in-list (hash-ref doms x))])
|
||||
(define x-states (for/list ([x-val (in-list dom-x)])
|
||||
(hash-set st x x-val)))
|
||||
(for*/first ([st1 x-states]
|
||||
[st2 x-states]
|
||||
#:unless (equal? (hash-ref st1 x) (hash-ref st2 x))
|
||||
#:unless (equal? ((hash-ref network y) st1)
|
||||
((hash-ref network y) st2)))
|
||||
#:unless (equal? (y-func st1) (y-func st2)))
|
||||
#t))
|
||||
(for*/first ([st (in-list states-not-x)]
|
||||
#:when (different-ys-exist? st))
|
||||
|
|
Loading…
Reference in a new issue