networks: Add make-tbf/state.

This commit is contained in:
Sergiu Ivanov 2020-07-23 00:19:25 +02:00
parent 91c45ada06
commit 0b41cf54fc
1 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,7 @@
[random-boolean-network/vars (number? . -> . network?)]
[tbf/state-w (-> tbf/state? (hash/c variable? number?))]
[tbf/state-θ (-> tbf/state? number?)]
[make-tbf/state (-> (listof (cons/c variable? number?)) number? tbf/state?)]
[apply-tbf-to-state (-> tbf? state? (or/c 0 1))])
;; Predicates
(contract-out [variable? (-> any/c boolean?)]
@ -950,5 +951,9 @@
(define tbf/state-w tbf/state-weights)
(define tbf/state-θ tbf/state-threshold)
;;; Makes a state/tbf from a list of pairs of names of variables and
;;; weights, as well as a threshold.
(define (make-tbf/state pairs threshold)
(tbf/state (make-immutable-hash pairs) threshold))
;;; A TBN is a network form mapping TBFs to variables.
(define tbn? (hash/c variable? tbf?))