networks: Remove build-all-states-same-domain.

This is function is not really necessary, since I have
make-same-domains.
This commit is contained in:
Sergiu Ivanov 2020-02-23 09:13:03 +01:00
parent 245b22316e
commit 1492c33e1a
2 changed files with 4 additions and 11 deletions

View file

@ -67,11 +67,6 @@
((a . #f) (b . 1)) ((a . #f) (b . 1))
((a . #f) (b . 2)) ((a . #f) (b . 2))
((a . #f) (b . 3)))) ((a . #f) (b . 3))))
(check-equal? (map hash->list (build-all-states-same-domain '(a b) '(#t #f)))
'(((a . #t) (b . #t))
((a . #t) (b . #f))
((a . #f) (b . #t))
((a . #f) (b . #f))))
(check-equal? (hash->list (make-boolean-domains '(a b))) (check-equal? (hash->list (make-boolean-domains '(a b)))
'((a . (#f #t)) (b . (#f #t)))) '((a . (#f #t)) (b . (#f #t))))

View file

@ -24,7 +24,6 @@
[list-interactions (-> network-form? variable? (listof variable?))] [list-interactions (-> network-form? variable? (listof variable?))]
[build-interaction-graph (-> network-form? graph?)] [build-interaction-graph (-> network-form? graph?)]
[build-all-states (-> domain-mapping/c (listof state?))] [build-all-states (-> domain-mapping/c (listof state?))]
[build-all-states-same-domain (-> (listof variable?) generic-set? (listof state?))]
[make-same-domains (-> (listof variable?) generic-set? (hash/c variable? generic-set?))] [make-same-domains (-> (listof variable?) generic-set? (hash/c variable? generic-set?))]
[make-boolean-domains (-> (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? domain-mapping/c variable? variable? (or/c '+ '- '0))] [get-interaction-sign (-> network-form? domain-mapping/c variable? variable? (or/c '+ '- '0))]
@ -161,11 +160,6 @@
(make-state (for/list ([var vars] [val s]) (make-state (for/list ([var vars] [val s])
(cons var val)))))) (cons var val))))))
;;; Given a list of variables and a domain common to all of them,
;;; builds the list of all possible states.
(define (build-all-states-same-domain vars domain)
(build-all-states (for/hash ([v vars]) (values 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-domains vars domain) (define (make-same-domains vars domain)
(for/hash ([var vars]) (values var domain))) (for/hash ([var vars]) (values var domain)))
@ -236,3 +230,7 @@
(list (match (get-interaction-sign network-form doms x y) (list (match (get-interaction-sign network-form doms x y)
['+ 1] ['- -1] ['0 0]) ['+ 1] ['- -1] ['0 0])
x y)))))) x y))))))
;1. Define the contract/predicate for domain mapping
;1. Remove build-all-states-same-domain.
;2. Add a short test to example.org