diff --git a/networks.rkt b/networks.rkt index 38d72f3..8139303 100644 --- a/networks.rkt +++ b/networks.rkt @@ -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?))