{"id":23666511,"url":"https://github.com/hugcis/evolving-structures-in-complex-systems","last_synced_at":"2025-07-23T03:04:20.409Z","repository":{"id":109704962,"uuid":"213423920","full_name":"hugcis/evolving-structures-in-complex-systems","owner":"hugcis","description":"Dataset and code to reproduce the results of the paper \"Evolving Structures in Complex Systems\"","archived":false,"fork":false,"pushed_at":"2019-12-16T09:22:41.000Z","size":2180,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T00:41:13.650Z","etag":null,"topics":["artificial-life","automata","cellular-automata","complex-systems","evolving-structures","neural-network","neural-networks"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hugcis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-07T15:46:32.000Z","updated_at":"2024-01-10T11:43:54.000Z","dependencies_parsed_at":"2023-04-22T03:39:30.594Z","dependency_job_id":null,"html_url":"https://github.com/hugcis/evolving-structures-in-complex-systems","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hugcis/evolving-structures-in-complex-systems","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Fevolving-structures-in-complex-systems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Fevolving-structures-in-complex-systems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Fevolving-structures-in-complex-systems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Fevolving-structures-in-complex-systems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugcis","download_url":"https://codeload.github.com/hugcis/evolving-structures-in-complex-systems/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugcis%2Fevolving-structures-in-complex-systems/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266608969,"owners_count":23955545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-life","automata","cellular-automata","complex-systems","evolving-structures","neural-network","neural-networks"],"created_at":"2024-12-29T07:32:39.264Z","updated_at":"2025-07-23T03:04:20.394Z","avatar_url":"https://github.com/hugcis.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Evolving structures in complex systems\n\nThis repository contains the code to reproduce the Figures and numerical results\nfrom the paper: _Evolving structures in complex systems_ by Hugo Cisneros, Josef\nSivic and Tomas Mikolov.\n\n[Project Slides](https://docs.google.com/presentation/d/1KmJvyKHKAeZvPPUGPVRdSEgyD8vUOoKhJtLZUCVxf7A/edit?usp=sharing)\n\n## Build the C library\n\nThe provided C library implements a general cellular automaton simulator and all\nthe steps for computing the metrics we discuss in the paper.\n\nThe library can be built with\n```\nmake all\n```\n\nwhich will create a binary in `bin/automaton`. So far, this has only been tested\non OSX.\n\n### Generate automata\n\n#### Rule file format\n\nAutomata rules are encoded in mapping files with the following format: \n\nPossible transitions are enumerated for a 3x3 neighborhood and `N + 1` (0 to\n`N`) states in the way described below, starting from the top-left cell and\nincrementing in a row-first manner a __base-N counter__ with __8 cells__.\n\n![Incrementing](./figures/increment.png)\n\nMapping files just enumerate the resulting state of the middle cell for the\ncorresponding neighborhood state. There are \u003cimg\nsrc=\"figures/eq1.png\" height=20px\u003e possible 3x3 neighborhoods rules.\n\n#### Obtaining the rule files from the paper\n\nMapping files with the 3-states rules reported in the paper can be obtained at\nthe following\n[link](https://drive.google.com/uc?id=1fymRRN-Yeig560CkXrLTfpl879YLP_UF\u0026export=download).\nThe unzipped `maps` directory contains the subdirectories `train` and `test`\nthat correspond to the training and testing sets used in the paper.\n\n#### Simulating automata\n\nOnce the `maps` directory is placed at the root of this directory, running \n\n```\n./scripts/generate_results_from_maps.sh\n```\n\nwill simulate all automata from the maps and compute the various metrics we\ndiscuss in the paper (this might take a while to complete). The script calls the\nexecutable `bin/automaton` with some options for each `.map` file.\n\n### Compute metrics\n\nAfter simulating the automata, the metrics are automatically computed. We\ncompute:\n\n- The compressed length of the automaton state at step 1000.\n- The lookup table based metric.\n- The neural network based metric.\n\nAll metrics are then stored in files for further processing\n\n### Wrapping all this in a script\n\nAll the steps described above are also wrapped in a single script that you can\nrun with the command `./scripts/run_all.sh`.\n\n## Reproduce results from the paper\n\nThe results in the paper and values computed to produce those results are in\n`data/`, they were computed with a script that you can run with:\n\n```\npython3 scripts/compute_results.py\n```\n\nAnother script extracts results from files generated by the `run_all.sh` script.\nYou can run it with \n```\npython3 scripts/extract_results.py\n```\n\n## Visualization tools\n\nAutomata evolution can be visualized by generating a GIF image with the script\n`generate_frames.sh` in `tools/viz/`. It assigns a set of colors based on the\nnumber of states\n\nFor more information about the command, execute \n```\ntools/viz/generate_frames.sh -h\n```\n\n## Playing with initialization patterns\n\nThe library supports specifying a initial pattern for a simulation. Several\nexample patterns are in `example_patterns/`. \n\nPatterns can be defined with a specific file format, of which an example is\ngiven below.\n\n```\nN=4\nR=1685000103177278144\nBG=1\n#\n13231\n11111\n01110\n13231\n11111\n22022\n#\n```\n\nThe quantity after `N` is the number of states, the one after `R` is the rule\nID. `BG` is an optional value to set all cells not specified in the pattern to a\ngiven state. The pattern itself is delimited by `#` characters, and is just a\nrectangle with, for each cell of the pattern, the corresponding state.\n\nWhen simulating a pattern, one can still choose the size of the automaton, the\nnumber of steps, etc. The patterns will be centered in the middle of the\nautomaton for easier visualization.\n\nAs an example, the following command that uses the spaceship pattern above, with\nthe four states rule `1685000103177278144`\n```bash\ntools/viz/generate_frames.sh -n 4 \\\n                             -t 300 \\\n                             -g 1 \\\n                             -d 5 \\\n                             -j example_patterns/spaceships_4.pat \\\n                             -s 32 \\\n                             1685000103177278144\n```\nproduces the following GIF at `./rule_gif/temp.gif`:\n\n![Spaceship](figures/ex_spaceship.gif)\n\nAnother example:\n```bash\ntools/viz/generate_frames.sh -n 3 -g 10 -t 2000 -d 10 -s 128 \\\n                               -j example_patterns/exploding_3.pat \\\n                               16855021099980290151\n```\nIt produces\n\n![Explosion](figures/ex_explosion.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugcis%2Fevolving-structures-in-complex-systems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugcis%2Fevolving-structures-in-complex-systems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugcis%2Fevolving-structures-in-complex-systems/lists"}