{"id":22895801,"url":"https://github.com/fractal-solutions/genetic-algorithm","last_synced_at":"2025-03-31T23:38:35.476Z","repository":{"id":218930974,"uuid":"747718515","full_name":"fractal-solutions/genetic-algorithm","owner":"fractal-solutions","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-24T18:52:32.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T01:45:34.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/fractal-solutions.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":"2024-01-24T14:02:36.000Z","updated_at":"2024-01-24T14:02:45.000Z","dependencies_parsed_at":"2024-12-13T23:32:18.585Z","dependency_job_id":null,"html_url":"https://github.com/fractal-solutions/genetic-algorithm","commit_stats":null,"previous_names":["fractal-solutions/genetic-algorithm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractal-solutions%2Fgenetic-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractal-solutions%2Fgenetic-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractal-solutions%2Fgenetic-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractal-solutions%2Fgenetic-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fractal-solutions","download_url":"https://codeload.github.com/fractal-solutions/genetic-algorithm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246558117,"owners_count":20796696,"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":[],"created_at":"2024-12-13T23:32:08.716Z","updated_at":"2025-03-31T23:38:35.456Z","avatar_url":"https://github.com/fractal-solutions.png","language":"JavaScript","readme":"# Use\nrun 'node index' from the directory\nThe code will run a standard Genetic Algorithm that fills out \"Hello World\" then\nit will run a Binary Algorithm that fills out binary from expected value in the BinaryGeneticAlgorithm class definition. \n\n# Genetic Algorithm Report\n## Introduction\nThe Genetic Algorithm (GA) is a versatile optimization algorithm inspired by the process of natural selection. It is widely used for solving optimization problems in various domains. The purpose of this report is to document the design, implementation, and application of a genetic algorithm developed for the AI Programming assignment.\n\n## Implementation\nThe genetic algorithm is implemented in JavaScript and follows a modular structure for easy adaptation to different optimization problems. The core components include:\n\n### Chromosome Representation\nThe chromosomes are represented as strings, with each character corresponding to a gene. The generateRandomChromosome function generates random chromosomes for the initial population.\n\n### Population Initialization\nThe initial population is generated using the initializePopulation function, which creates a set number of random chromosomes.\n\n### Fitness Function\nThe fitnessFunction evaluates the fitness of a chromosome by comparing it to a target string. The higher the fitness, the more similar the chromosome is to the target.\n\n### Selection\nA tournament selection mechanism is employed in the selection function to choose parents for crossover. The function randomly selects individuals from the population and chooses the one with the highest fitness.\n\n### Crossover\nThe crossover function combines the genetic material of two parent chromosomes to create one or more offspring. The crossover point is randomly determined.\n\n### Mutation\nThe mutation function introduces small random changes to a chromosome by altering a single gene.\n\n### Evolution\nThe evolve function orchestrates the evolution of the population for one generation by selecting parents, performing crossover, and applying mutation.\n\n## Running the Algorithm\nThe run function runs the genetic algorithm for a specified number of generations. It prints the best individual in each generation along with its fitness.\n\n## Example Usage\nAn example application of the genetic algorithm is demonstrated in finding a string that matches a target string. The algorithm evolves a population of strings over multiple generations to approximate the target string.\n\n\n## Adapting the Algorithm\nThe flexibility of the genetic algorithm allows it to be adapted to various optimization problems. Three examples are provided in the report: Numeric Optimization, Binary Optimization, and Combinatorial Optimization. These adaptations involve customizing the fitnessFunction and generateRandomChromosome methods to suit the specific problem characteristics.\n\n## Conclusion\nThe genetic algorithm presented in this report provides a robust framework for solving optimization problems. Its adaptability makes it a valuable tool in AI programming, allowing developers to tackle a wide range of problems by customizing specific components of the algorithm.\n\nThe same genetic algorithm structure can be applied to different types of optimization problems with minimal modifications. This flexibility is a key strength, and developers can experiment with additional problem domains by further customizing the algorithm.\n\nOverall, the genetic algorithm serves as a powerful optimization tool, offering a balance between exploration and exploitation in the search for optimal solutions.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffractal-solutions%2Fgenetic-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffractal-solutions%2Fgenetic-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffractal-solutions%2Fgenetic-algorithm/lists"}