Type random-boolean-network.
This commit is contained in:
parent
5e155d0a61
commit
861665e205
2 changed files with 28 additions and 0 deletions
19
networks.rkt
19
networks.rkt
|
@ -51,6 +51,7 @@
|
||||||
table+vars->network table->network table+headers->network
|
table+vars->network table->network table+headers->network
|
||||||
|
|
||||||
random-function/state random-boolean-function/state random-network
|
random-function/state random-boolean-function/state random-network
|
||||||
|
random-boolean-network
|
||||||
)
|
)
|
||||||
|
|
||||||
(define-type (State a) (VariableMapping a))
|
(define-type (State a) (VariableMapping a))
|
||||||
|
@ -1090,6 +1091,24 @@
|
||||||
(check-equal?
|
(check-equal?
|
||||||
(tabulate-network+headers (random-network (hash 'a '(1 2) 'b '(#f #t))))
|
(tabulate-network+headers (random-network (hash 'a '(1 2) 'b '(#f #t))))
|
||||||
'((a b f-a f-b) (1 #f 1 #f) (1 #t 1 #f) (2 #f 2 #t) (2 #t 2 #f)))))
|
'((a b f-a f-b) (1 #f 1 #f) (1 #t 1 #f) (2 #f 2 #t) (2 #t 2 #f)))))
|
||||||
|
|
||||||
|
(: random-boolean-network (-> (Listof Variable) (Network Boolean)))
|
||||||
|
(define (random-boolean-network vars)
|
||||||
|
(random-network (make-boolean-domains vars)))
|
||||||
|
|
||||||
|
(module+ test
|
||||||
|
(test-case "random-boolean-network"
|
||||||
|
(check-equal?
|
||||||
|
(tabulate-network+headers (random-boolean-network '(x y z)))
|
||||||
|
'((x y z f-x f-y f-z)
|
||||||
|
(#f #f #f #t #t #t)
|
||||||
|
(#f #f #t #f #f #f)
|
||||||
|
(#f #t #f #t #t #t)
|
||||||
|
(#f #t #t #f #t #f)
|
||||||
|
(#t #f #f #t #t #t)
|
||||||
|
(#t #f #t #f #t #f)
|
||||||
|
(#t #t #f #f #f #t)
|
||||||
|
(#t #t #t #t #t #f)))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(require 'typed)
|
(require 'typed)
|
||||||
|
|
|
@ -925,6 +925,15 @@ Generates a random network from the given domain mapping.
|
||||||
(tabulate-network+headers (random-network (hash 'a '(1 2) 'b '(#f #t))))
|
(tabulate-network+headers (random-network (hash 'a '(1 2) 'b '(#f #t))))
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@defproc[(random-boolean-network [vars (Listof Variable)])
|
||||||
|
(Network Boolean)]{
|
||||||
|
|
||||||
|
Generates a random Boolean network with the given variables.
|
||||||
|
|
||||||
|
@ex[
|
||||||
|
(tabulate-network+headers (random-boolean-network '(x y z)))
|
||||||
|
]}
|
||||||
|
|
||||||
@section{TBF/TBN and SBF/SBN}
|
@section{TBF/TBN and SBF/SBN}
|
||||||
|
|
||||||
This section defines threshold Boolean functions (TBF) and networks (TBN), as
|
This section defines threshold Boolean functions (TBF) and networks (TBN), as
|
||||||
|
|
Loading…
Reference in a new issue