network: Add make-sbf/state.
This commit is contained in:
parent
74a3bb9e69
commit
943fd322c4
1 changed files with 11 additions and 0 deletions
11
networks.rkt
11
networks.rkt
|
@ -83,6 +83,7 @@
|
|||
[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?)]
|
||||
[make-sbf/state (-> (listof (cons/c variable? number?)) sbf/state?)]
|
||||
[apply-tbf/state (-> tbf/state? (hash/c variable? (or/c 0 1)) (or/c 0 1))]
|
||||
[lists->tbfs/state (->* ((listof (listof (or/c number? symbol?))))
|
||||
(#:headers boolean?)
|
||||
|
@ -982,6 +983,16 @@
|
|||
(test-case "sbf/state?"
|
||||
(check-true (sbf/state? (tbf/state #hash((a . -1) (b . 1)) 0)))))
|
||||
|
||||
;;; Makes a state/tbf which is an SBF from a list of pairs of names of
|
||||
;;; variables and weights.
|
||||
(define (make-sbf/state pairs)
|
||||
(make-tbf/state pairs 0))
|
||||
|
||||
(module+ test
|
||||
(test-case "make-sbf/state"
|
||||
(check-equal? (make-sbf/state '((a . -1) (b . 1)))
|
||||
(make-tbf/state '((a . -1) (b . 1)) 0))))
|
||||
|
||||
;;; Applies a state TBF to its inputs.
|
||||
;;;
|
||||
;;; Applying a TBF consists in multiplying the weights by the
|
||||
|
|
Loading…
Reference in a new issue