Add network-form->network/01.
This commit is contained in:
parent
007baa5e41
commit
7a3cbaa1af
2 changed files with 32 additions and 0 deletions
19
networks.rkt
19
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)
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue