network: Bug fix in get-interaction-sign.

This commit is contained in:
Sergiu Ivanov 2020-11-18 00:46:55 +01:00
parent 195d71ed4e
commit c55113f27e

View File

@ -473,11 +473,11 @@
[(and (member '> impacts) (not (member '< impacts))) '>] [(and (member '> impacts) (not (member '< impacts))) '>]
[(equal? impacts '(=)) '=] [(equal? impacts '(=)) '=]
[else 0])))) [else 0]))))
(match interactions (cond
[(list '<) 1] [(and (member '< interactions) (not (member '> interactions))) 1]
[(list '>) -1] [(and (member '> interactions) (not (member '< interactions))) -1]
[(list '=) #f] [(equal? interactions '(=)) #f]
[_ 0])) [else 0]))
(module+ test (module+ test
(test-case "get-interaction-sign" (test-case "get-interaction-sign"
@ -491,6 +491,7 @@
(check-equal? (get-interaction-sign n-bool bool-doms 'x 'y) 1) (check-equal? (get-interaction-sign n-bool bool-doms 'x 'y) 1)
(check-equal? (get-interaction-sign n-bool bool-doms 'y 'x) -1) (check-equal? (get-interaction-sign n-bool bool-doms 'y 'x) -1)
(check-false (get-interaction-sign n-bool bool-doms 'x 'z)) (check-false (get-interaction-sign n-bool bool-doms 'x 'z))
(check-equal? (get-interaction-sign n-bool bool-doms 'y 'z) 1)
(check-equal? (get-interaction-sign n-bool bool-doms 'x 't) 0) (check-equal? (get-interaction-sign n-bool bool-doms 'x 't) 0)
(define n-multi (network-form->network (define n-multi (network-form->network
(hash 'x '(min (+ y 1) 2) (hash 'x '(min (+ y 1) 2)