diff --git a/networks.rkt b/networks.rkt index 66bbd9b..111e350 100644 --- a/networks.rkt +++ b/networks.rkt @@ -34,6 +34,7 @@ [make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))] [make-01-domains (-> (listof variable?) (hash/c variable? (list/c 0 1)))] [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))] [build-signed-interaction-graph/form (-> network-form? domain-mapping/c graph?)] [build-boolean-signed-interaction-graph/form (-> network-form? graph?)] @@ -358,6 +359,19 @@ #hash((a . #t) (b . #f)) #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 ;;; of the variables, returns '+ if the interaction is monotonously ;;; increasing, '- if it is monotonously decreasing, and '0 otherwise.