networks: Add make-01-network.

This commit is contained in:
Sergiu Ivanov 2020-11-28 23:01:57 +01:00
parent ce2d10526a
commit c0ec7369fd
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,7 @@
[domains domain-mapping/c])])
;; Functions
(contract-out [make-boolean-network (-> (hash/c variable? procedure?) network?)]
[make-01-network (-> (hash/c variable? procedure?) network?)]
[update (-> network? state? (set/c variable? #:kind 'dont-care) state?)]
[make-state (-> (listof (cons/c symbol? any/c)) state?)]
[make-state-booleanize (-> (listof (cons/c symbol? (or/c 0 1))) state?)]
@ -190,6 +191,11 @@
(define (make-boolean-network funcs)
(network funcs (make-boolean-domains (hash-keys funcs))))
;;; Build a network from a given hash table assigning functions to
;;; variables by attributing the domain {0,1} to every variable.
(define (make-01-network funcs)
(network funcs (make-01-domains (hash-keys funcs))))
(module+ test
(test-case "make-boolean-network"
(define f1 (λ (s) (let ([x1 (hash-ref s 'x1)]