| … | … | @@ -247,10 +247,10 @@ |
| 247 | 247 | ; node-type. |
| 248 | 248 | (define node-weight (Predicate "node likelihood")) |
| 249 | 249 | |
| 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. |
| 254 | 254 | (define prototypes (Concept "Prototype Individual Anchor Point")) |
| 255 | 255 | |
| 256 | 256 | ; Define a simple function that will create a "person prototype". |
| … | … | @@ -286,8 +286,8 @@ |
| 286 | 286 | ; The probability that an individual, with this number of |
| 287 | 287 | ; friend and stranger relationships, will appear in some |
| 288 | 288 | ; 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 |
| 291 | 291 | ; prototype being selected, during network generation. The |
| 292 | 292 | ; weighting chosen here punishes prototypes with many |
| 293 | 293 | ; relationships. At this time, this is needed to force the |
| … | … | @@ -309,7 +309,7 @@ |
| 309 | 309 | (iota 6 1)) |
| 310 | 310 | |
| 311 | 311 | ; Both friendships and stranger relationships are symmetrical, |
| 312 | | ; any-to-any. |
| 312 | ; mutually reciprocal. |
| 313 | 313 | (define pole-set (Concept "any to any")) |
| 314 | 314 | (Member (Set (ConnectorDir "*") (ConnectorDir "*")) pole-set) |
| 315 | 315 | |
| … | … | @@ -330,13 +330,13 @@ |
| 330 | 330 | ; Nahh. Make that just one. |
| 331 | 331 | (State (Member max-solutions params) (Number 1)) |
| 332 | 332 | |
| 333 | | ; Always try to close off new unconnected connectors. |
| 333 | ; Always try to close off new, unconnected connectors. |
| 334 | 334 | (State (Member close-fraction params) (Number 1.0)) |
| 335 | 335 | |
| 336 | 336 | ; 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 |
| 338 | 338 | ; 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!) |
| 340 | 340 | ; either a solution is found within about 300 steps, or not at all. |
| 341 | 341 | ; Thus, limit the search to just a bit more than 300, and try again, |
| 342 | 342 | ; if no solution is found. (About half of all attempts succeed. |
| … | … | @@ -347,7 +347,7 @@ |
| 347 | 347 | (State (Member max-depth params) (Number 100)) |
| 348 | 348 | (State (Member max-network-size params) (Number 2000)) |
| 349 | 349 | |
| 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 |
| 351 | 351 | ; have around, later. |
| 352 | 352 | (define anchor (Anchor "Covid Sim Individuals")) |
| 353 | 353 | (State (Member point-set-anchor params) anchor) |
| … | … | @@ -437,7 +437,7 @@ |
| 437 | 437 | all-relations)) |
| 438 | 438 | |
| 439 | 439 | (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" |
| 441 | 441 | (length friend-relations)) |
| 442 | 442 | |
| 443 | 443 | (define stranger-relations (get-relations-of-type (Concept "stranger"))) |
| … | … | @@ -446,6 +446,7 @@ |
| 446 | 446 | |
| 447 | 447 | ; --------------------------------------------------------------------- |
| 448 | 448 | ; Start applying state transition rules to the network. |
| 449 | ; |
| 449 | 450 | ; This will be done "by hand" for the first few rounds, just to show how |
| 450 | 451 | ; it works. Several differnt styles will be shown. One is by directly |
| 451 | 452 | ; running scheme code. A second, better way is by applying Atomese |
| … | … | @@ -471,7 +472,7 @@ |
| 471 | 472 | ; Atomspace. |
| 472 | 473 | (define (run-one-transmission-step) |
| 473 | 474 | |
| 474 | | ; The transmission rule is directed, from first to second individual. |
| 475 | ; The transmission rule is directed, from second to first individual. |
| 475 | 476 | ; But the relation-pairs are undirected, so we have to run the rule |
| 476 | 477 | ; twice, swapping the individuals the second time. |
| 477 | 478 | (for-each |
| … | … | @@ -509,7 +510,7 @@ |
| 509 | 510 | *unspecified*) |
| 510 | 511 | |
| 511 | 512 | ; 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. |
| 513 | 514 | ; As before, this uses a `for-each` loop in scheme to loop over all |
| 514 | 515 | ; individuals. |
| 515 | 516 | (define (run-one-state-transition) |
| … | … | @@ -533,7 +534,10 @@ |
| 533 | 534 | ; --------------------------------------------------------------------- |
| 534 | 535 | ; State transitions, applied as rewrite rules, run over the AtomSpace. |
| 535 | 536 | ; 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. |
| 537 | 541 | |
| 538 | 542 | ; Search for all pairs, and apply the transmission rule. |
| 539 | 543 | (define (do-transmission) |