networks: make-same-domain-mapping -> make-same-domains, make-boolean-domain-mapping -> make-boolean-domains

This commit is contained in:
Sergiu Ivanov 2020-02-23 00:15:18 +01:00
parent 183160da6f
commit 251a7dcf23
2 changed files with 6 additions and 6 deletions

View file

@ -72,7 +72,7 @@
((a . #t) (b . #f)) ((a . #t) (b . #f))
((a . #f) (b . #t)) ((a . #f) (b . #t))
((a . #f) (b . #f)))) ((a . #f) (b . #f))))
(check-equal? (hash->list (make-boolean-domain-mapping '(a b))) (check-equal? (hash->list (make-boolean-domains '(a b)))
'((a . (#f #t)) (b . (#f #t)))) '((a . (#f #t)) (b . (#f #t))))
(let ([n #hash((a . (not b)) (b . a))] (let ([n #hash((a . (not b)) (b . a))]

View file

@ -25,8 +25,8 @@
[build-interaction-graph (-> network-form? graph?)] [build-interaction-graph (-> network-form? graph?)]
[build-all-states (-> (listof (cons/c variable? generic-set?)) (listof state?))] [build-all-states (-> (listof (cons/c variable? generic-set?)) (listof state?))]
[build-all-states-same-domain (-> (listof variable?) generic-set? (listof state?))] [build-all-states-same-domain (-> (listof variable?) generic-set? (listof state?))]
[make-same-domain-mapping (-> (listof variable?) generic-set? (hash/c variable? generic-set?))] [make-same-domains (-> (listof variable?) generic-set? (hash/c variable? generic-set?))]
[make-boolean-domain-mapping (-> (listof variable?) (hash/c variable? (list/c #f #t)))] [make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))]
[get-interaction-sign (-> network-form? (hash/c variable? generic-set?) variable? variable? (or/c '+ '- '0))]) [get-interaction-sign (-> network-form? (hash/c variable? generic-set?) variable? variable? (or/c '+ '- '0))])
;; Predicates ;; Predicates
(contract-out [variable? (-> any/c boolean?)] (contract-out [variable? (-> any/c boolean?)]
@ -162,12 +162,12 @@
(build-all-states (for/list ([v vars]) (cons v domain)))) (build-all-states (for/list ([v vars]) (cons v domain))))
;;; Makes a hash set mapping all variables to a single domain. ;;; Makes a hash set mapping all variables to a single domain.
(define (make-same-domain-mapping vars domain) (define (make-same-domains vars domain)
(make-immutable-hash (for/list ([var vars]) (cons var domain)))) (make-immutable-hash (for/list ([var vars]) (cons var domain))))
;;; Makes a hash set mapping all variables to the Boolean domain. ;;; Makes a hash set mapping all variables to the Boolean domain.
(define (make-boolean-domain-mapping vars) (define (make-boolean-domains vars)
(make-same-domain-mapping vars '(#f #t))) (make-same-domains vars '(#f #t)))
;;; Given two interacting variables of a network form and the domains ;;; Given two interacting variables of a network form and the domains
;;; of the variables, returns '+ if the interaction is monotonously ;;; of the variables, returns '+ if the interaction is monotonously