networks: Include domains into the network.
This change is breaking. The following commits will progressively fix the whole network module.
This commit is contained in:
parent
f1a1123cc4
commit
a3ac1c7fcd
1 changed files with 7 additions and 8 deletions
15
networks.rkt
15
networks.rkt
|
@ -18,7 +18,9 @@
|
||||||
(contract-out [struct tbf/state ([weights (hash/c variable? number?)]
|
(contract-out [struct tbf/state ([weights (hash/c variable? number?)]
|
||||||
[threshold number?])]
|
[threshold number?])]
|
||||||
[struct dynamics ([network network?]
|
[struct dynamics ([network network?]
|
||||||
[mode mode?])])
|
[mode mode?])]
|
||||||
|
[struct network ([functions (hash/c variable? procedure?)]
|
||||||
|
[domains domain-mapping/c])])
|
||||||
;; Functions
|
;; Functions
|
||||||
(contract-out [update (-> network? state? (set/c variable? #:kind 'dont-care) state?)]
|
(contract-out [update (-> network? state? (set/c variable? #:kind 'dont-care) state?)]
|
||||||
[make-state (-> (listof (cons/c symbol? any/c)) state?)]
|
[make-state (-> (listof (cons/c symbol? any/c)) state?)]
|
||||||
|
@ -173,13 +175,10 @@
|
||||||
;;; state.
|
;;; state.
|
||||||
(define update-function/c (-> state? any/c))
|
(define update-function/c (-> state? any/c))
|
||||||
|
|
||||||
;;; A network is a mapping from its variables to its update functions.
|
;;; A network consists of a mapping from its variables to its update
|
||||||
;;;
|
;;; variables, as a well as of a mapping from its variables to
|
||||||
;;; Note that the domains of the variables of the network are not part
|
;;; their domains.
|
||||||
;;; of the network definition. This is because the variables of some
|
(struct network (functions domains))
|
||||||
;;; networks may have infinite domains, which can be restricted in
|
|
||||||
;;; multiple different ways.
|
|
||||||
(define network? (hash/c variable? procedure?))
|
|
||||||
|
|
||||||
;;; Given a state s updates all the variables from xs.
|
;;; Given a state s updates all the variables from xs.
|
||||||
(define (update network s xs)
|
(define (update network s xs)
|
||||||
|
|
Loading…
Reference in a new issue