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 . #f) (b . #t))
((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))))
(let ([n #hash((a . (not b)) (b . a))]

View File

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