networks: Add build-all-01-states.

This commit is contained in:
Sergiu Ivanov 2020-10-18 22:52:45 +02:00
parent 85feab230f
commit afa84d00b5

View file

@ -34,6 +34,7 @@
[make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))] [make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))]
[make-01-domains (-> (listof variable?) (hash/c variable? (list/c 0 1)))] [make-01-domains (-> (listof variable?) (hash/c variable? (list/c 0 1)))]
[build-all-boolean-states (-> (listof variable?) (listof state?))] [build-all-boolean-states (-> (listof variable?) (listof state?))]
[build-all-01-states (-> (listof variable?) (listof state?))]
[get-interaction-sign (-> network? domain-mapping/c variable? variable? (or/c '+ '- '0))] [get-interaction-sign (-> network? domain-mapping/c variable? variable? (or/c '+ '- '0))]
[build-signed-interaction-graph/form (-> network-form? domain-mapping/c graph?)] [build-signed-interaction-graph/form (-> network-form? domain-mapping/c graph?)]
[build-boolean-signed-interaction-graph/form (-> network-form? graph?)] [build-boolean-signed-interaction-graph/form (-> network-form? graph?)]
@ -358,6 +359,19 @@
#hash((a . #t) (b . #f)) #hash((a . #t) (b . #f))
#hash((a . #t) (b . #t)))))) #hash((a . #t) (b . #t))))))
;;; Builds all Boolean states over a given set of variables, but with
;;; 0 and 1 for Boolean values.
(define build-all-01-states
(compose build-all-states make-01-domains))
(module+ test
(test-case "build-all-01-states"
(check-equal? (build-all-01-states '(a b))
'(#hash((a . 0) (b . 0))
#hash((a . 0) (b . 1))
#hash((a . 1) (b . 0))
#hash((a . 1) (b . 1))))))
;;; Given two interacting variables of a network and the domains ;;; Given two interacting variables of a network and the domains
;;; of the variables, returns '+ if the interaction is monotonously ;;; of the variables, returns '+ if the interaction is monotonously
;;; increasing, '- if it is monotonously decreasing, and '0 otherwise. ;;; increasing, '- if it is monotonously decreasing, and '0 otherwise.