diff --git a/networks.rkt b/networks.rkt index cbd3e15..3ad8a9d 100644 --- a/networks.rkt +++ b/networks.rkt @@ -20,6 +20,7 @@ update-function-form->update-function/boolean update-function-form->update-function/01 network-form->network/any network-form->network/boolean + network-form->network/01 ) (define-type (State a) (VariableMapping a)) @@ -193,6 +194,24 @@ 'b '(#f #t))))) (define s (hash 'a #t 'b #t)) (check-equal? ((hash-ref (network-functions bn) 'a) s) #t))) + + (: network-form->network/01 (-> (NetworkForm (U Zero One)) (Network (U Zero One)))) + (define (network-form->network/01 nf) + (network + (for/hash ([(x form) (in-hash (network-form-forms nf))]) + : (VariableMapping (UpdateFunction (U Zero One))) + (values x (update-function-form->update-function/01 form))) + (network-form-domains nf))) + + (module+ test + (test-case "network-form->network/01" + (define bn (network-form->network/01 + (network-form (hash 'a '(min a b) + 'b '(- 1 b)) + (hash 'a '(0 1) + 'b '(0 1))))) + (define s (hash 'a 1 'b 1)) + (check-equal? ((hash-ref (network-functions bn) 'a) s) 1))) ) (require 'typed) diff --git a/scribblings/networks.scrbl b/scribblings/networks.scrbl index 1743e50..1c68671 100644 --- a/scribblings/networks.scrbl +++ b/scribblings/networks.scrbl @@ -297,6 +297,19 @@ Like @racket[network-form->network/any], but builds a Boolean network. 'b '(#f #t)))) ]} +@defproc[(network-form->network/01 [nf (NetworkForm (U Zero One))]) (Network (U Zero One))]{ + +Like @racket[network-form->network/any], but builds a Boolean network, whose +domains are expressed as @tt{{0,1}}. + +@ex[ +(network-form->network/01 + (network-form (hash 'a '(min a b) + 'b '(- 1 b)) + (hash 'a '(0 1) + 'b '(0 1)))) +]} + @section{Inferring interaction graphs} This section provides inference of both unsigned and signed interaction graphs.