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))) '>]
[(equal? impacts '(=)) '=]
[else 0]))))
(match interactions
[(list '<) 1]
[(list '>) -1]
[(list '=) #f]
[_ 0]))
(cond
[(and (member '< interactions) (not (member '> interactions))) 1]
[(and (member '> interactions) (not (member '< interactions))) -1]
[(equal? interactions '(=)) #f]
[else 0]))
(module+ test
(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 'y 'x) -1)
(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)
(define n-multi (network-form->network
(hash 'x '(min (+ y 1) 2)