OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-generate commits / 9ecce50

Tweak the explanations a bit more
9ecce5095e47da6e210fec89751cad880ffd3bde
by Linas Vepstas <linasvepstas@gmail.com> · 2020-04-21T18:31:59.000Z

Changed files (1) +19 -15

demo/seir.scm +19 -15
……@@ -247,10 +247,10 @@
247247; node-type.
248248(define node-weight (Predicate "node likelihood"))
249249
250; This is the anchor-point to which the grammar will be attached.
251; The grammar consists of a number of prototype individuals, having
252; different numbers of friend and stranger encounters, occurring with
253; different probability in the network.
250; The anchor-point to which the grammar will be attached. The grammar
251; consists of a number of prototype individuals, having different
252; numbers of friend and stranger encounters, occurring with different
253; probability in the network.
254254(define prototypes (Concept "Prototype Individual Anchor Point"))
255255
256256; Define a simple function that will create a "person prototype".
……@@ -286,8 +286,8 @@
286286 ; The probability that an individual, with this number of
287287 ; friend and stranger relationships, will appear in some
288288 ; typical random network. This is just a cheesy hack, for
289 ; now. Its not even the expectation,value, not really, its
290 ; just a weighting controlling the likelihood of such
289 ; now. Its not even the expectation value, not really, its
290 ; just a weight controlling the likelihood of such a
291291 ; prototype being selected, during network generation. The
292292 ; weighting chosen here punishes prototypes with many
293293 ; relationships. At this time, this is needed to force the
……@@ -309,7 +309,7 @@
309309 (iota 6 1))
310310
311311; Both friendships and stranger relationships are symmetrical,
312; any-to-any.
312; mutually reciprocal.
313313(define pole-set (Concept "any to any"))
314314(Member (Set (ConnectorDir "*") (ConnectorDir "*")) pole-set)
315315
……@@ -330,13 +330,13 @@
330330; Nahh. Make that just one.
331331(State (Member max-solutions params) (Number 1))
332332
333; Always try to close off new unconnected connectors.
333; Always try to close off new, unconnected connectors.
334334(State (Member close-fraction params) (Number 1.0))
335335
336336; Avoid infinite recursion by quitting after some number of steps.
337; iteration stops if the number of desired nets is found, or this
337; Iteration stops if the number of desired nets is found, or this
338338; number of steps is taken, whichever comes first.
339; In the current implementation (this is subjecct to change!)
339; In the current implementation (this is subject to change!)
340340; either a solution is found within about 300 steps, or not at all.
341341; Thus, limit the search to just a bit more than 300, and try again,
342342; if no solution is found. (About half of all attempts succeed.
……@@ -347,7 +347,7 @@
347347(State (Member max-depth params) (Number 100))
348348(State (Member max-network-size params) (Number 2000))
349349
350; Record all the individials that are created. This will be handy to
350; Record all the individuals that are created. This will be handy to
351351; have around, later.
352352(define anchor (Anchor "Covid Sim Individuals"))
353353(State (Member point-set-anchor params) anchor)
……@@ -437,7 +437,7 @@
437437 all-relations))
438438
439439(define friend-relations (get-relations-of-type (Concept "friend")))
440(format #t "The social network consists of ~D freind-pairs\n"
440(format #t "The social network consists of ~D friend-pairs\n"
441441 (length friend-relations))
442442
443443(define stranger-relations (get-relations-of-type (Concept "stranger")))
……@@ -446,6 +446,7 @@
446446
447447; ---------------------------------------------------------------------
448448; Start applying state transition rules to the network.
449;
449450; This will be done "by hand" for the first few rounds, just to show how
450451; it works. Several differnt styles will be shown. One is by directly
451452; running scheme code. A second, better way is by applying Atomese
……@@ -471,7 +472,7 @@
471472; Atomspace.
472473(define (run-one-transmission-step)
473474
474 ; The transmission rule is directed, from first to second individual.
475 ; The transmission rule is directed, from second to first individual.
475476 ; But the relation-pairs are undirected, so we have to run the rule
476477 ; twice, swapping the individuals the second time.
477478 (for-each
……@@ -509,7 +510,7 @@
509510 *unspecified*)
510511
511512; A function that rolls the dice, and updates state: looping over
512; all individuals, to see if they got infected, recovered, or died.
513; all individuals, to see if they got infected, or recovered, or died.
513514; As before, this uses a `for-each` loop in scheme to loop over all
514515; individuals.
515516(define (run-one-state-transition)
……@@ -533,7 +534,10 @@
533534; ---------------------------------------------------------------------
534535; State transitions, applied as rewrite rules, run over the AtomSpace.
535536; Instead of iterating over scheme lists of relations and individuals,
536; this searches the AtomSpace for the relevant relations/individuals.
537; the code below searches the AtomSpace directly for the relevant
538; relations and individuals. This is more elegant than monkeying around
539; with scheme code. It operates by applying graph rewrite rules directly
540; to the AtomSpace, where the data actually lives.
537541
538542; Search for all pairs, and apply the transmission rule.
539543(define (do-transmission)