{"id":22568347,"url":"https://github.com/vanstrouble/cga-from-scratch","last_synced_at":"2025-03-28T13:43:50.703Z","repository":{"id":155457079,"uuid":"616238317","full_name":"vanstrouble/cga-from-scratch","owner":"vanstrouble","description":"CGA algorithm from scratch using Python.","archived":false,"fork":false,"pushed_at":"2024-06-25T03:04:32.000Z","size":1008,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T14:14:01.666Z","etag":null,"topics":["cga","compact-genetic-algorithm","from-scratch","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanstrouble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-03-20T01:23:59.000Z","updated_at":"2024-06-25T03:04:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"9cea2240-3142-457d-b20b-e318a4ee6d80","html_url":"https://github.com/vanstrouble/cga-from-scratch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanstrouble%2Fcga-from-scratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanstrouble%2Fcga-from-scratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanstrouble%2Fcga-from-scratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanstrouble%2Fcga-from-scratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanstrouble","download_url":"https://codeload.github.com/vanstrouble/cga-from-scratch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246041443,"owners_count":20714138,"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","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":["cga","compact-genetic-algorithm","from-scratch","python"],"created_at":"2024-12-08T00:12:51.510Z","updated_at":"2025-03-28T13:43:50.680Z","avatar_url":"https://github.com/vanstrouble.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compact Genetic Algorithm (CGA)\n\nThe Compact Genetic Algorithm (CGA) is a variant of the genetic algorithm used for optimization and solution search in complex problems. Unlike conventional genetic algorithms, the CGA uses a compact representation of chromosomes, which means it employs a reduced number of genes compared to other approaches.\n\nIn the CGA, instead of representing every possible value in a chromosome, probability tables are used for each gene. These tables contain probability values that indicate the likelihood of a gene taking a particular value. By using these probabilities instead of binary or integer representations, the CGA can significantly reduce the size of chromosomes and the search space.\n\n## Algorithm Steps\n\nThe basic operation of the CGA involves the following steps:\n\n\u003cimg src=\"img/pseudocode.jpg\" alt=\"Pseudocode\" width=\"400\"\u003e\n\n1. **Initialization**: An initial population of chromosomes with random probability tables is created.\n2. **Evaluation**: The fitness of each chromosome is evaluated based on the quality of the solution it represents.\n3. **Selection**: The fittest chromosomes are selected for reproduction and to form the next generation.\n4. **Update of Probability Tables**: The probability tables of the genes are updated based on the performance of the selected chromosomes.\n5. **Convergence**: The evaluation, selection, and probability table update steps are repeated until a convergence criterion is met, such as a maximum number of generations or a desired solution quality.\n\nThe CGA offers advantages in terms of memory usage and runtime efficiency, as the reduced chromosome size and compact representation enable more efficient exploration of the search space.\n\n## Advantages\n\n- **Memory Efficiency**: Reduced chromosome size leads to lower memory usage.\n- **Runtime Efficiency**: Compact representation allows faster processing.\n- **Effective Search Space Exploration**: Probability tables provide a flexible mechanism for navigating the search space.\n\n## CGA Board Example\n\n\u003cimg src=\"img/board_example_test.jpg\" alt=\"CGA board example\" width=\"100%\"\u003e\n\n## References\n\n- Goldberg, D. E., \u0026 Harik, G. (1998). \"The Compact Genetic Algorithm.\" Proceedings of the IEEE International Conference on Evolutionary Computation.\n- Pelikan, M., Goldberg, D. E., \u0026 Lobo, F. G. (1999). \"A Survey of Optimization by Building and Using Probabilistic Models.\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanstrouble%2Fcga-from-scratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanstrouble%2Fcga-from-scratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanstrouble%2Fcga-from-scratch/lists"}