networks: Remove nn.
This commit is contained in:
parent
dfb882d891
commit
e8e3a71d87
3 changed files with 15 additions and 18 deletions
|
@ -369,7 +369,7 @@ tab
|
||||||
dynamics:
|
dynamics:
|
||||||
#+NAME: simple-bn-sg
|
#+NAME: simple-bn-sg
|
||||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||||
(let* ([bn (nn (unorgv simple-bn))]
|
(let* ([bn (network-form->network (unorgv simple-bn))]
|
||||||
[bn-asyn (make-asyn-dynamics bn)])
|
[bn-asyn (make-asyn-dynamics bn)])
|
||||||
(dotit (ppsg (build-full-boolean-state-graph bn-asyn))))
|
(dotit (ppsg (build-full-boolean-state-graph bn-asyn))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -388,7 +388,7 @@ tab
|
||||||
of Boolean values as 0 and 1:
|
of Boolean values as 0 and 1:
|
||||||
#+NAME: simple-bn-sg-bool
|
#+NAME: simple-bn-sg-bool
|
||||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||||
(let* ([bn (nn (unorgv simple-bn))]
|
(let* ([bn (network-form->network (unorgv simple-bn))]
|
||||||
[bn-asyn (make-asyn-dynamics bn)])
|
[bn-asyn (make-asyn-dynamics bn)])
|
||||||
(dotit (ppsgb (build-full-boolean-state-graph bn-asyn))))
|
(dotit (ppsgb (build-full-boolean-state-graph bn-asyn))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -416,7 +416,7 @@ tab
|
||||||
#+HEADER: :var simple-bn=munch-sexp(simple-bn)
|
#+HEADER: :var simple-bn=munch-sexp(simple-bn)
|
||||||
#+HEADER: :var some-state=munch-sexp(some-state)
|
#+HEADER: :var some-state=munch-sexp(some-state)
|
||||||
#+BEGIN_SRC racket :results silent
|
#+BEGIN_SRC racket :results silent
|
||||||
(let* ([bn (nn (unorgv simple-bn))]
|
(let* ([bn (network-form->network (unorgv simple-bn))]
|
||||||
[bn-asyn (make-asyn-dynamics bn)]
|
[bn-asyn (make-asyn-dynamics bn)]
|
||||||
[s0 (stb (unorgv some-state))])
|
[s0 (stb (unorgv some-state))])
|
||||||
(dotit (ppsgb (dds-build-n-step-state-graph bn-asyn (set s0) 2))))
|
(dotit (ppsgb (dds-build-n-step-state-graph bn-asyn (set s0) 2))))
|
||||||
|
@ -435,7 +435,7 @@ tab
|
||||||
modality leading to the update.
|
modality leading to the update.
|
||||||
#+NAME: simple-bn-sg-bool-ann
|
#+NAME: simple-bn-sg-bool-ann
|
||||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||||
(let* ([bn (nn (unorgv simple-bn))]
|
(let* ([bn (network-form->network (unorgv simple-bn))]
|
||||||
[bn-asyn (make-asyn-dynamics bn)])
|
[bn-asyn (make-asyn-dynamics bn)])
|
||||||
(dotit (ppsgb (build-full-boolean-state-graph-annotated bn-asyn))))
|
(dotit (ppsgb (build-full-boolean-state-graph-annotated bn-asyn))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -457,7 +457,7 @@ tab
|
||||||
|
|
||||||
#+NAME: bn2-sgr
|
#+NAME: bn2-sgr
|
||||||
#+BEGIN_SRC racket :results silent :var input-bn=munch-sexp(bn2)
|
#+BEGIN_SRC racket :results silent :var input-bn=munch-sexp(bn2)
|
||||||
(let* ([bn (nn (unorgv input-bn))]
|
(let* ([bn (network-form->network (unorgv input-bn))]
|
||||||
[bn-asyn (make-asyn-dynamics bn)])
|
[bn-asyn (make-asyn-dynamics bn)])
|
||||||
(dotit (ppsgb (build-full-boolean-state-graph-annotated bn-asyn))))
|
(dotit (ppsgb (build-full-boolean-state-graph-annotated bn-asyn))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -507,7 +507,7 @@ tab
|
||||||
Here's how to tabulate the network =simple-bn=, defined at the top
|
Here's how to tabulate the network =simple-bn=, defined at the top
|
||||||
of this section:
|
of this section:
|
||||||
#+BEGIN_SRC racket :results table drawer :var in-bn=munch-sexp(simple-bn)
|
#+BEGIN_SRC racket :results table drawer :var in-bn=munch-sexp(simple-bn)
|
||||||
(tabulate-boolean-network (nn (unorgv in-bn)))
|
(tabulate-boolean-network (network-form->network (unorgv in-bn)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
(let ([bn1 (network-form->network (make-hash '((a . (and a b)) (b . (not b)))))]
|
(let ([bn1 (network-form->network (make-hash '((a . (and a b)) (b . (not b)))))]
|
||||||
[bn2 (make-network-from-forms '((a . (and a b))
|
[bn2 (make-network-from-forms '((a . (and a b))
|
||||||
(b . (not b))))]
|
(b . (not b))))]
|
||||||
[bn3 (nn #hash((a . (and a b))
|
[bn3 (network-form->network #hash((a . (and a b))
|
||||||
(b . (not b))))]
|
(b . (not b))))]
|
||||||
[s (make-state '((a . #t) (b . #t)))])
|
[s (make-state '((a . #t) (b . #t)))])
|
||||||
(check-equal? ((hash-ref bn1 'a) s) #t)
|
(check-equal? ((hash-ref bn1 'a) s) #t)
|
||||||
|
@ -83,9 +83,9 @@
|
||||||
[doms (make-boolean-domains '(a b))]
|
[doms (make-boolean-domains '(a b))]
|
||||||
[sig1 (build-signed-interaction-graph/form n doms)]
|
[sig1 (build-signed-interaction-graph/form n doms)]
|
||||||
[sig2 (build-boolean-signed-interaction-graph/form n)]
|
[sig2 (build-boolean-signed-interaction-graph/form n)]
|
||||||
[sig3 (build-boolean-signed-interaction-graph (nn n))])
|
[sig3 (build-boolean-signed-interaction-graph (network-form->network n))])
|
||||||
(check-equal? (get-interaction-sign (nn n) doms 'a 'b) '+)
|
(check-equal? (get-interaction-sign (network-form->network n) doms 'a 'b) '+)
|
||||||
(check-equal? (get-interaction-sign (nn n) doms 'b 'a) '-)
|
(check-equal? (get-interaction-sign (network-form->network n) doms 'b 'a) '-)
|
||||||
|
|
||||||
(check-true (has-vertex? sig1 'a))
|
(check-true (has-vertex? sig1 'a))
|
||||||
(check-true (has-vertex? sig1 'b))
|
(check-true (has-vertex? sig1 'b))
|
||||||
|
@ -122,14 +122,14 @@
|
||||||
(let ([vars '(a b c)])
|
(let ([vars '(a b c)])
|
||||||
(check-equal? (make-asyn vars) (set (set 'a) (set 'b) (set 'c)))
|
(check-equal? (make-asyn vars) (set (set 'a) (set 'b) (set 'c)))
|
||||||
(check-equal? (make-syn vars) (set (set 'a 'b 'c))))
|
(check-equal? (make-syn vars) (set (set 'a 'b 'c))))
|
||||||
(let* ([n (nn #hash((a . (not a)) (b . b)))]
|
(let* ([n (network-form->network #hash((a . (not a)) (b . b)))]
|
||||||
[asyn (make-asyn-dynamics n)]
|
[asyn (make-asyn-dynamics n)]
|
||||||
[syn (make-syn-dynamics n)])
|
[syn (make-syn-dynamics n)])
|
||||||
(check-equal? (dynamics-network asyn) n)
|
(check-equal? (dynamics-network asyn) n)
|
||||||
(check-equal? (dynamics-mode asyn) (set (set 'a) (set 'b)))
|
(check-equal? (dynamics-mode asyn) (set (set 'a) (set 'b)))
|
||||||
(check-equal? (dynamics-network syn) n)
|
(check-equal? (dynamics-network syn) n)
|
||||||
(check-equal? (dynamics-mode syn) (set (set 'a 'b))))
|
(check-equal? (dynamics-mode syn) (set (set 'a 'b))))
|
||||||
(let* ([n (nn #hash((a . (not a)) (b . b)))]
|
(let* ([n (network-form->network #hash((a . (not a)) (b . b)))]
|
||||||
[asyn (make-asyn-dynamics n)]
|
[asyn (make-asyn-dynamics n)]
|
||||||
[syn (make-syn-dynamics n)]
|
[syn (make-syn-dynamics n)]
|
||||||
[s (make-state '((a . #t) (b . #f)))]
|
[s (make-state '((a . #t) (b . #f)))]
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
'((#f #f #f) (#f #t #f) (#t #f #f) (#t #t #t)))
|
'((#f #f #f) (#f #t #f) (#t #f #f) (#t #t #t)))
|
||||||
(let ([func (λ (st) (not (hash-ref st 'a)))])
|
(let ([func (λ (st) (not (hash-ref st 'a)))])
|
||||||
(check-equal? (tabulate-state/boolean func '(a)) '((a f) (#f #t) (#t #f))))
|
(check-equal? (tabulate-state/boolean func '(a)) '((a f) (#f #t) (#t #f))))
|
||||||
(let ([bn (nn #hash((a . (not a)) (b . b)))])
|
(let ([bn (network-form->network #hash((a . (not a)) (b . b)))])
|
||||||
(check-equal? (tabulate-boolean-network bn)
|
(check-equal? (tabulate-boolean-network bn)
|
||||||
'((a b f-a f-b) (#f #f #t #f) (#f #t #t #t) (#t #f #f #f) (#t #t #f #t)))
|
'((a b f-a f-b) (#f #f #t #f) (#f #t #t #t) (#t #f #f #f) (#t #t #f #t)))
|
||||||
(check-equal? (tabulate-boolean-network bn #:headers #f)
|
(check-equal? (tabulate-boolean-network bn #:headers #f)
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
[update-function/c contract?]
|
[update-function/c contract?]
|
||||||
[domain-mapping/c contract?])
|
[domain-mapping/c contract?])
|
||||||
;; Syntax
|
;; Syntax
|
||||||
nn ppsg ppsgb unorg-syn unorg-asyn)
|
ppsg ppsgb unorg-syn unorg-asyn)
|
||||||
|
|
||||||
|
|
||||||
;;; =================
|
;;; =================
|
||||||
|
@ -172,9 +172,6 @@
|
||||||
(define (make-network-from-forms forms)
|
(define (make-network-from-forms forms)
|
||||||
(network-form->network (make-immutable-hash forms)))
|
(network-form->network (make-immutable-hash forms)))
|
||||||
|
|
||||||
;;; A shortcut for network-form->network.
|
|
||||||
(define-syntax-rule (nn forms) (network-form->network forms))
|
|
||||||
|
|
||||||
|
|
||||||
;;; ============================
|
;;; ============================
|
||||||
;;; Inferring interaction graphs
|
;;; Inferring interaction graphs
|
||||||
|
|
Loading…
Reference in a new issue