networks: Add and use domain-mapping/c.
This commit is contained in:
parent
bdbbae6eb6
commit
245b22316e
1 changed files with 9 additions and 5 deletions
14
networks.rkt
14
networks.rkt
|
@ -23,12 +23,12 @@
|
||||||
network?)]
|
network?)]
|
||||||
[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 (-> (hash/c variable? generic-set?) (listof state?))]
|
[build-all-states (-> domain-mapping/c (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-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? (hash/c variable? generic-set?) variable? variable? (or/c '+ '- '0))]
|
[get-interaction-sign (-> network-form? domain-mapping/c variable? variable? (or/c '+ '- '0))]
|
||||||
[build-signed-interaction-graph (-> network-form? (hash/c variable? generic-set?) graph?)])
|
[build-signed-interaction-graph (-> network-form? domain-mapping/c graph?)])
|
||||||
;; Predicates
|
;; Predicates
|
||||||
(contract-out [variable? (-> any/c boolean?)]
|
(contract-out [variable? (-> any/c boolean?)]
|
||||||
[state? (-> any/c boolean?)]
|
[state? (-> any/c boolean?)]
|
||||||
|
@ -37,7 +37,8 @@
|
||||||
;; Contracts
|
;; Contracts
|
||||||
(contract-out [state/c contract?]
|
(contract-out [state/c contract?]
|
||||||
[network/c contract?]
|
[network/c contract?]
|
||||||
[update-function/c contract?])
|
[update-function/c contract?]
|
||||||
|
[domain-mapping/c contract?])
|
||||||
;; Syntax
|
;; Syntax
|
||||||
st nn)
|
st nn)
|
||||||
|
|
||||||
|
@ -146,7 +147,10 @@
|
||||||
(unweighted-graph/adj
|
(unweighted-graph/adj
|
||||||
(for/list ([(var _) n]) (cons var (list-interactions n var))))))
|
(for/list ([(var _) n]) (cons var (list-interactions n var))))))
|
||||||
|
|
||||||
;;; Given a list of pairs mapping variables to generic sets of their
|
;;; A domain mapping is a hash set mapping variables to the lists of
|
||||||
|
;;; values in their domains.
|
||||||
|
(define domain-mapping/c (hash/c variable? list?))
|
||||||
|
|
||||||
;;; Given a hash-set mapping variables to generic sets of their
|
;;; Given a hash-set mapping variables to generic sets of their
|
||||||
;;; possible values, constructs the list of all possible states.
|
;;; possible values, constructs the list of all possible states.
|
||||||
(define (build-all-states vars-domains)
|
(define (build-all-states vars-domains)
|
||||||
|
|
Loading…
Reference in a new issue