networks: Add sbf/state?.
This commit is contained in:
parent
848d53f97a
commit
c8e7d3733c
1 changed files with 9 additions and 1 deletions
10
networks.rkt
10
networks.rkt
|
@ -100,7 +100,8 @@
|
||||||
[update-function-form? (-> any/c boolean?)]
|
[update-function-form? (-> any/c boolean?)]
|
||||||
[network-form? (-> any/c boolean?)]
|
[network-form? (-> any/c boolean?)]
|
||||||
[modality? (-> any/c boolean?)]
|
[modality? (-> any/c boolean?)]
|
||||||
[mode? (-> any/c boolean?)])
|
[mode? (-> any/c boolean?)]
|
||||||
|
[sbf/state? (-> any/c boolean?)])
|
||||||
;; Contracts
|
;; Contracts
|
||||||
(contract-out [state/c contract?]
|
(contract-out [state/c contract?]
|
||||||
[update-function/c contract?]
|
[update-function/c contract?]
|
||||||
|
@ -959,6 +960,13 @@
|
||||||
;;; applied to states in an unambiguous ways.
|
;;; applied to states in an unambiguous ways.
|
||||||
(struct tbf/state (weights threshold) #:transparent)
|
(struct tbf/state (weights threshold) #:transparent)
|
||||||
|
|
||||||
|
;;; A sign Boolean function (SBF) is a TBF whose threshold is 0.
|
||||||
|
(define sbf/state? (and/c tbf/state? (λ (tbf) (zero? (tbf/state-θ tbf)))))
|
||||||
|
|
||||||
|
(module+ test
|
||||||
|
(test-case "sbf/state?"
|
||||||
|
(check-true (sbf/state? (tbf/state #hash((a . -1) (b . 1)) 0)))))
|
||||||
|
|
||||||
;;; Shortcuts for acessing fields of a state/tbf.
|
;;; Shortcuts for acessing fields of a state/tbf.
|
||||||
(define tbf/state-w tbf/state-weights)
|
(define tbf/state-w tbf/state-weights)
|
||||||
(define tbf/state-θ tbf/state-threshold)
|
(define tbf/state-θ tbf/state-threshold)
|
||||||
|
|
Loading…
Reference in a new issue