{"id":1758,"date":"2023-09-07T14:53:07","date_gmt":"2023-09-07T14:53:07","guid":{"rendered":"https:\/\/mlinsightscentral.com\/?page_id=1758"},"modified":"2023-09-18T15:17:33","modified_gmt":"2023-09-18T15:17:33","slug":"genetic-algorithms","status":"publish","type":"page","link":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/","title":{"rendered":"Genetic Algorithms"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1758\" class=\"elementor elementor-1758\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-af0c78b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"af0c78b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5b01995\" data-id=\"5b01995\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-362e7f9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"362e7f9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-71cc01c\" data-id=\"71cc01c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-628591f elementor-widget elementor-widget-heading\" data-id=\"628591f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.13.3 - 28-05-2023 *\/\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style><h4 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Genetic_Algorithms\"><\/span>Genetic Algorithms<span class=\"ez-toc-section-end\"><\/span><\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8a036d9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8a036d9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8e6c497\" data-id=\"8e6c497\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cdd93c3 elementor-widget elementor-widget-text-editor\" data-id=\"cdd93c3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.13.3 - 28-05-2023 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_53 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\" role=\"button\"><label for=\"item-6a0579ec9426c\" ><span class=\"\"><span style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input aria-label=\"Toggle\" aria-label=\"item-6a0579ec9426c\"  type=\"checkbox\" id=\"item-6a0579ec9426c\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Genetic_Algorithms\" title=\"Genetic Algorithms\">Genetic Algorithms<\/a><ul class='ez-toc-list-level-5'><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Components_of_a_genetic_algorithm\" title=\"Components of a genetic algorithm\">Components of a genetic algorithm<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Shortest_route_search_problem_%E2%80%93_Python_implementation\" title=\"Shortest route search problem &#8211; Python implementation\">Shortest route search problem &#8211; Python implementation<\/a><ul class='ez-toc-list-level-5'><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Genetic_code_formation\" title=\"Genetic code formation\">Genetic code formation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Fitness_function\" title=\"Fitness function\">Fitness function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Crossover_operator\" title=\"Crossover operator\">Crossover operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Mutation_operator\" title=\"Mutation operator\">Mutation operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Initialisation_and_settings\" title=\"Initialisation and settings\">Initialisation and settings<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3c189ef elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3c189ef\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-598128c\" data-id=\"598128c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-869cbc9 elementor-widget elementor-widget-text-editor\" data-id=\"869cbc9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Genetic algorithms are complex search algorithms inspired by the theory of evolution. It is a population-based algorithm in which candidate optimisation agents possess genetic information and evolve over time generation after generation through three main evolutionary life processes: elitism, mutation and crossover.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5eebf4b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5eebf4b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e00810b\" data-id=\"e00810b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5881af1 elementor-widget elementor-widget-image\" data-id=\"5881af1\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.13.3 - 28-05-2023 *\/\n.elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=\".svg\"]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block}<\/style>\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/elementor\/thumbs\/genetic_algorithm_illutsration-qc3zh22vc4y0pkh8jcvddkbcgypi4y6wqup10hqolc.png\" title=\"genetic_algorithm_illutsration\" alt=\"Genetic Algorithm\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-bf7cf21 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"bf7cf21\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-704039c\" data-id=\"704039c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-245045b elementor-widget elementor-widget-heading\" data-id=\"245045b\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Components_of_a_genetic_algorithm\"><\/span>Components of a genetic algorithm<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d9ef580 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d9ef580\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4ace04f\" data-id=\"4ace04f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bbcf411 elementor-icon-list--layout-traditional elementor-list-item-link-full_width elementor-widget elementor-widget-icon-list\" data-id=\"bbcf411\" data-element_type=\"widget\" data-widget_type=\"icon-list.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<link rel=\"stylesheet\" href=\"https:\/\/mlinsightscentral.com\/wp-content\/plugins\/elementor\/assets\/css\/widget-icon-list.min.css\">\t\t<ul class=\"elementor-icon-list-items\">\n\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-check\"><\/i>\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Genetic Code Formation<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-check\"><\/i>\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Fitness\/Cost Function<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-check\"><\/i>\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Population Initialisation<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-check\"><\/i>\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Elitism<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-check\"><\/i>\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Crossover<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t\t\t<li class=\"elementor-icon-list-item\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-icon\">\n\t\t\t\t\t\t\t<i aria-hidden=\"true\" class=\"fas fa-check\"><\/i>\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">Mutation<\/span>\n\t\t\t\t\t\t\t\t\t<\/li>\n\t\t\t\t\t\t<\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-cf7628b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cf7628b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-07d201f\" data-id=\"07d201f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-88d892a elementor-widget elementor-widget-text-editor\" data-id=\"88d892a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>When solving a search problem using a genetic algorithm, the genetic code must be defined. The <strong>genetic code<\/strong> refers to the nature or profile of the candidate solution. For instance, a search problem of finding the <a href=\"https:\/\/mlinsightscentral.com\/index.php\/gradient-descent-algorithm\/\">lowest point<\/a> in a multivariate function will have as genetic code the <strong>coordinate vector<\/strong> (i.e. x = [x1,x2,&#8230;xn]) of a potential solution. For a search problem of finding the shortest route to navigate a maze, the genetic code will refer to the <strong>segment set<\/strong> to exit the maze (x = {s1,s2,s3,&#8230;sn}) which forms the genetic profile of every population individual.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c64c262 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c64c262\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5cf140f\" data-id=\"5cf140f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9c69245 elementor-widget elementor-widget-text-editor\" data-id=\"9c69245\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Upon determining the genetic profile of population individuals, a cost or fitness function (i.e. f(x))\u00a0 must be defined that will quantify the performance of any given candidate solution. It completes the mathematical formulation of the problem (i.e. min or max f(x)) to be solved leading to the start of the search process. A population of N individuals randomly profiled based on the genetic code is initialised forming the first population generation. An ep portion of the fittest individuals in the population as per the cost function gains immediate access to the next generation. This process is referred to as &#8220;<strong>elitism<\/strong>&#8221; where the fittest individuals survive.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e71d9ef elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e71d9ef\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cb0dd74\" data-id=\"cb0dd74\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-216341f elementor-widget elementor-widget-text-editor\" data-id=\"216341f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The remaining (N-epN) individuals for the next generation are obtained through crossover and mutation. During crossover, individuals are allowed to mate, exchanging genetic information, with the hope of generating better-suited offspring. Mating is typically performed between elites or between elites and other individuals in the population. A <strong>crossover operator<\/strong> must thus be defined that will specify the mating process&#8217;s inherent rules. During mutation, individuals independently modify their own genetic information leading to newer species in a bid to diversity in the search process which may prevent premature convergence to information that is already known. A <strong>mutation operator<\/strong> must equally be defined.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-176c77e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"176c77e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-956c43b\" data-id=\"956c43b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2c0fae9 elementor-widget elementor-widget-image\" data-id=\"2c0fae9\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"686\" height=\"315\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/crossover.png\" class=\"attachment-large size-large wp-image-1819\" alt=\"crossover\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/crossover.png 686w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/crossover-300x138.png 300w\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Typical crossover operator<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-6be6936\" data-id=\"6be6936\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5945250 elementor-widget elementor-widget-image\" data-id=\"5945250\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"217\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/mutation.png\" class=\"attachment-large size-large wp-image-1823\" alt=\"mutation\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/mutation.png 434w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/mutation-300x150.png 300w\" sizes=\"auto, (max-width: 434px) 100vw, 434px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Typical mutation operator<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-db82e0e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"db82e0e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-fdb8e0b\" data-id=\"fdb8e0b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a3b76da elementor-widget elementor-widget-text-editor\" data-id=\"a3b76da\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>This process continues generation after generation until a stop criterion is defined. Most typically, a maximum generation count is used to stop the search process or the search process is heuristically halted when the quality of the solution does not significantly improve over time.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-044e3d1 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"044e3d1\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-036fd25\" data-id=\"036fd25\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d6b19f9 elementor-widget elementor-widget-image\" data-id=\"d6b19f9\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"479\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_algo.png\" class=\"attachment-large size-large wp-image-1904\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_algo.png 735w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_algo-300x196.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Pseudo code of typical GA implementation<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a132af2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a132af2\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8927c63\" data-id=\"8927c63\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-12966e5 elementor-widget elementor-widget-heading\" data-id=\"12966e5\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\">Shortest route search problem - Python implementation<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a05792d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a05792d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-03e4215\" data-id=\"03e4215\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0a82e17 elementor-widget elementor-widget-text-editor\" data-id=\"0a82e17\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Let&#8217;s look at the logistic problem of delivering packages from a main warehouse to several branches across a given region. A genetic algorithm search will be devised to find a good enough navigation path that will minimise transportation costs and time. We assume that all branches have existing physical routes that can interconnect them.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-22c6cc0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"22c6cc0\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ecf76fd\" data-id=\"ecf76fd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-41a4089 elementor-widget elementor-widget-image\" data-id=\"41a4089\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"289\" height=\"229\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/shortest_route.png\" class=\"attachment-large size-large wp-image-1845\" alt=\"shortest route\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-92b8537 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"92b8537\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-73dfa43\" data-id=\"73dfa43\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-27bd192 elementor-widget elementor-widget-heading\" data-id=\"27bd192\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Genetic_code_formation\"><\/span>Genetic code formation<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-18e0ef5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"18e0ef5\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a1202ed\" data-id=\"a1202ed\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e0db529 elementor-widget elementor-widget-text-editor\" data-id=\"e0db529\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The problem consists of finding the best permutation of 15 stores. Thus, the genetic code of a population individual consists of a given permutation of the 15 stores.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e915973 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e915973\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8cf3964\" data-id=\"8cf3964\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e3cc091 elementor-widget elementor-widget-image\" data-id=\"e3cc091\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"187\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/genetic_code-1.png\" class=\"attachment-large size-large wp-image-1874\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/genetic_code-1.png 723w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/genetic_code-1-300x78.png 300w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-09ff566 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"09ff566\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-11692be\" data-id=\"11692be\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9c77a1e elementor-widget elementor-widget-heading\" data-id=\"9c77a1e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Fitness_function\"><\/span>Fitness function<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-81c2880 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"81c2880\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cd3c938\" data-id=\"cd3c938\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-de8f901 elementor-widget elementor-widget-text-editor\" data-id=\"de8f901\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The fitness function to solve the problem is the total distance from the supply point through town to town:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c0c9821 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c0c9821\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8b83d72\" data-id=\"8b83d72\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-04ad11f elementor-widget elementor-widget-image\" data-id=\"04ad11f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"63\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/fitness.png\" class=\"attachment-large size-large wp-image-1875\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/fitness.png 533w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/fitness-300x35.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6d4a174 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6d4a174\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e661ce3\" data-id=\"e661ce3\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cdc3fde elementor-widget elementor-widget-text-editor\" data-id=\"cdc3fde\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The search problem, thus consist of finding the best permutation will yield the smallest covered distance.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-70bfc8f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"70bfc8f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-555085d\" data-id=\"555085d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-32deb81 elementor-widget elementor-widget-heading\" data-id=\"32deb81\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Crossover_operator\"><\/span>Crossover operator<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e97f702 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e97f702\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0f462f9\" data-id=\"0f462f9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0e744fd elementor-widget elementor-widget-text-editor\" data-id=\"0e744fd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Crossover is performed by inbreeding two parents to get a better individual of the -two. There could be several inbreeding approaches to the problem, nevertheless, an <strong>ordered crossover<\/strong> approach is used in the current implementation. A portion of the genes of one parent is selected and appended <strong>in order<\/strong> and <strong>no repetition <\/strong>with the remaining genes of the other parent (This process can be used to generate at least two children, parent 2 can be used as parent 1 to generate another child).<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-0f961e8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"0f961e8\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9506aac\" data-id=\"9506aac\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ab463dd elementor-widget elementor-widget-image\" data-id=\"ab463dd\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"686\" height=\"315\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/crossover.png\" class=\"attachment-large size-large wp-image-1819\" alt=\"crossover\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/crossover.png 686w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/crossover-300x138.png 300w\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a2f01b7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a2f01b7\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e41cbbe\" data-id=\"e41cbbe\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-462304d elementor-widget elementor-widget-heading\" data-id=\"462304d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Mutation_operator\"><\/span>Mutation operator<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-531026b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"531026b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-35c50d4\" data-id=\"35c50d4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-83c54e1 elementor-widget elementor-widget-text-editor\" data-id=\"83c54e1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>In the mutation process, a portion of the sequence is selected and reshuffled to create a new individual as described below<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9471910 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9471910\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f841cbd\" data-id=\"f841cbd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e19c7f1 elementor-widget elementor-widget-image\" data-id=\"e19c7f1\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"210\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/mutation_operaotor.png\" class=\"attachment-large size-large wp-image-1882\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/mutation_operaotor.png 690w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/mutation_operaotor-300x91.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4ef1c6a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4ef1c6a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-99cd4fa\" data-id=\"99cd4fa\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1b889c1 elementor-widget elementor-widget-heading\" data-id=\"1b889c1\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Initialisation_and_settings\"><\/span>Initialisation and settings<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d2cdf1d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d2cdf1d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ca41a62\" data-id=\"ca41a62\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f0b8e3d elementor-widget elementor-widget-text-editor\" data-id=\"f0b8e3d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>For the current implementation, the location of the main branch and the 15 stores have been loaded from the <a href=\"https:\/\/raw.githubusercontent.com\/mlinsights\/freemium\/main\/datasets\/metaheuristics\/ga\/ga_data.csv\">datasets<\/a>. A population of 50 search individuals is used for the genetic algorithm and the search runs for up to 50 generations. Upon each generation, the fittest individual through the search is dynamically updated as the best solution thus far until the search process stops. The performance of the algorithm is plotted on a 2D plot over time to visualise how genetic algorithm solutions improve the longer the search runs.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1b03d49 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1b03d49\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1072d70\" data-id=\"1072d70\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d76a2e5 elementor-widget elementor-widget-elementor-syntax-highlighter\" data-id=\"d76a2e5\" data-element_type=\"widget\" data-widget_type=\"elementor-syntax-highlighter.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code class='language-python'>#Import packages\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport copy \n\n#Model stations as objects\nclass Station: \n    num_station = 0 #number of stations\n    def __init__(self,x,y,name):        \n        self.id = Station.num_station\n        self.x = x\n        self.y = y\n        self.name = name\n        Station.num_station = Station.num_station + 1\n\ndef getStationPerId(Stations,id):#return station based on id\n    numS = len(Stations)\n    for i in range(0,numS):\n        mStation = Stations[i]\n        if(mStation.id == id):\n            return mStation\n\n#Create plot function for stations        \ndef plotStations(Stations,rootStation,seq,title=''):\n    node_size = 80\n    numS = len(Stations)\n    plt.figure(1)\n    plt.scatter(rootStation.x,rootStation.y,s=int(3*node_size),c=&quot;r&quot;)\n    \n    Station1 = getStationPerId(Stations,seq[0])#link root with first station\n    X = np.array([Station1.x,rootStation.x])#X array\n    Y = np.array([Station1.y,rootStation.y])#Y array\n    plt.plot(X,Y,'r-')#plot line between two stations\n    plt.scatter(Station1.x,Station1.y,s=node_size,c=&quot;b&quot;)#plot station 1\n    \n    for i in range(0,numS-1):\n        Station1 = getStationPerId(Stations,seq[i])\n        Station2 = getStationPerId(Stations,seq[i+1])\n        X = np.array([Station1.x,Station2.x])#X array\n        Y = np.array([Station1.y,Station2.y])#Y array\n        plt.plot(X,Y,'r-')#plot line between two stations\n        plt.scatter(Station1.x,Station1.y,s=node_size,c=&quot;b&quot;)#plot station 1\n    \n    Station1 = getStationPerId(Stations,seq[numS-1])\n    plt.scatter(Station1.x,Station1.y,s=node_size,c=&quot;b&quot;)#plot station 1\n    plt.title(title)\n    plt.show()\n\n#Create objective functions\ndef dist(x1,y1,x2,y2):\n    d = np.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) )\n    return d\n\ndef objFunc(Stations,rootStation,seq):#find the accumulated distance between town\n    numS = len(Stations)\n    Station1 = getStationPerId(Stations,seq[0])\n    d = dist(rootStation.x,rootStation.y,Station1.x,Station1.y)\n    \n    for i in range(0,numS-1):\n        Station1 = getStationPerId(Stations,seq[i])\n        Station2 = getStationPerId(Stations,seq[i+1])\n        d =  d+dist(Station2.x,Station2.y,Station1.x,Station1.y)\n    return d\n\n#Create Crossover Operator\ndef xover_func(seq1,seq2,ch):#mate the sequence\n    Ns = len(seq1)    \n    #separate sequence in twos\n    mi = np.math.floor(Ns\/2) #middle index\n    \n    seq11 = seq1[0:mi]\n    \n    seq21 = seq2[0:mi]  \n    \n    if ch==1: #get first child\n        child = seq11\n        for k in range(0,Ns):\n            v = np.where(child == seq2[k])\n            if(len(v[0]) == 0):#element not in sequence\n                child = np.concatenate((child,[seq2[k]]))\n    else:\n        child = seq21\n        for k in range(0,Ns):\n            v = np.where(child == seq1[k])\n            if(len(v[0]) == 0):#element not in sequence\n                child = np.concatenate((child,[seq1[k]]))\n    return child\n\n#Create Muation Operator\ndef mutate_func(seq1,mr):\n    Ns = len(seq1)#lenght of sequence\n    Mn = np.math.floor(Ns*mr)#mutation number\n    dice = np.arange(0,10)\n    np.random.shuffle(dice)\n    \n    if dice[0] &lt; 5:            \n        startr = np.arange(0,Ns-Mn)        \n        for i in range(1,10):\n            np.random.shuffle(startr)           \n        start = startr[0]        \n        seg = copy.deepcopy(seq1[start:(start+Mn)])\n        np.random.shuffle(seg)        \n        child0 = copy.deepcopy(seq1[0:start])\n        childn = copy.deepcopy(seq1[(start+Mn):Ns])               \n        child = np.concatenate((child0,seg,childn))#mutated\n    else:        \n        endr = np.arange(Mn-1,Ns)       \n        for i in range(1,10):\n            np.random.shuffle(endr)\n        end = endr[0]\n        #print(&quot;end:&quot;+str(end))\n        seg = copy.deepcopy(seq1[(end-Mn+1):(end+1)])\n        np.random.shuffle(seg)\n        child0 = copy.deepcopy(seq1[0:(end-Mn+1)])\n        childn = copy.deepcopy(seq1[(end+1):Ns])\n        child = np.concatenate((child0,seg,childn))#mutated\n        \n    return child\n\n\n#Define the genetic process\nclass Sequence:#class for sequence   \ndef __init__(self,seq):\n    self.seq = seq\n    self.obj_val = np.Inf \n\ndef ga_operation(gen_limit,n,max_gen):    \nseq = np.arange(1,n)\nBestChild = Sequence(seq)#BestChild\nBestChild.obj_val = objFunc(Stations,rootStation,BestChild.seq)\n\nPop = []\nNewGenPop = []\n\nfor g in range(0,gen_limit):\n    print(&quot;Generation &quot;+str(g)+&quot;....&quot;)\n    #population generation    \n    if g == 0: #first generation            \n        for i in range(0,max_gen):                \n            np.random.shuffle(seq)\n            pop = copy.deepcopy(Sequence(seq))                \n            pop.obj_val = objFunc(Stations,rootStation,pop.seq)\n            Pop.append(pop)#create an initial population    \n            #print(&quot;Po_seq: &quot;+str(Pop[i].seq))    \n    else:\n        Pop = NewGenPop\n        for i in range(0,max_gen):#evaluate fitness\n            Pop[i].obj_val = objFunc(Stations,rootStation,Pop[i].seq)\n            #print(&quot;Po_seq: &quot;+str(Pop[i].seq))\n    \n    #sort population based on objective value\n    for i in range(0,max_gen):\n        for j in range(0,MaxGen-1):\n            if Pop[j].obj_val &gt; Pop[j+1].obj_val:#ascending order\n                temp = Pop[j]\n                Pop[j] = Pop[j+1]\n                Pop[j+1] = temp\n      \n    \n    #pick the current best\n    if BestChild.obj_val &gt; Pop[0].obj_val: #the best of the elite is the optimum\n        BestChild = copy.deepcopy(Pop[0])\n    \n    print(&quot;Sequence: &quot;+str(BestChild.seq))\n    print(&quot;Obj func: &quot;+str(BestChild.obj_val)+&quot;\\n&quot;)\n    \n    #plot current status\n    title = 'GA - generation %d - best_fitness:%.3f'%(g,BestChild.obj_val)\n    plotStations(Stations,rootStation,BestChild.seq,title)#plot all stations\n    \n    if (g+1) == gen_limit:\n        return BestChild #break the loop\n              \n    #pick parents: elite        \n    bestN = int(max_gen*er)\n    xoverN = int(max_gen*xr)\n    \n  \n    ElitePop = Pop[0:bestN] #Pick elite children\n    NewGenPop = ElitePop #passed to new generation already\n     \n    \n    #crossover\n    xrNum = 0\n    eRng = np.arange(0,bestN)#elite range\n    \n    while xrNum &lt; xoverN:\n        #crossovering\n        np.random.shuffle(eRng)\n        Pr = eRng[0:2]\n        #print(&quot;crosswover parent id:&quot; + str(Pr))\n        #print(&quot;seqs: &quot;+str(ElitePop[0].seq))\n        #print(&quot;seqs: &quot;+str(ElitePop[1].seq))            \n        \n        Parent1 = ElitePop[Pr[0]] #Parent 1\n        Parent2 = ElitePop[Pr[1]] #Parent 2\n        \n        seq1 = Parent1.seq\n        seq2 = Parent2.seq            \n        #print('Elite parent sequence1: '+str(seq1))\n        #print('Elite parent sequence2: '+str(seq2))                     \n        \n        #two children created\n        Child1 = copy.deepcopy(Sequence(xover_func(seq1,seq2,1)))\n        Child2 = copy.deepcopy(Sequence(xover_func(seq1,seq2,2)))\n        \n        #print('Child1:'+str(Child1.seq))\n        #print('Child2:'+str(Child2.seq))\n    \n        NewGenPop.append(Child1)\n        NewGenPop.append(Child2)\n        xrNum = xrNum + 2\n\n    #mutation\n    mutN = max_gen - bestN - xoverN\n    mN = 0\n   \n    while mN &lt; mutN:\n        #mutation process\n        coin = np.arange(1,11)\n        np.random.shuffle(coin)\n        \n        Child = Sequence([])\n        \n        if coin[0] &lt; np.math.floor(mf*10): #elite parent mutation\n            np.random.shuffle(eRng)                \n            Parent = ElitePop[eRng[0]] #Parent under mutation process\n            seqt = Parent.seq #pick sequence                \n            #print('Parent seq: '+str(Parent.seq))\n        else:\n            rng = np.arange(bestN,max_gen)#other elementts    \n            np.random.shuffle(rng)\n            Parent = Pop[rng[0]]\n            seqt = Parent.seq #pick sequence\n            #print('Parent seq: '+str(Parent.seq))\n        #mutation      \n        Child.seq = mutate_func(seqt,mr) #mutation sequence          \n        NewGenPop.append(Child)#new child\n        mN = mN + 1#add to mutation      \n\n\n#load stattions locations\nimport pandas as pd\ndf = pd.read_csv('https:\/\/raw.githubusercontent.com\/mlinsights\/freemium\/main\/datasets\/metaheuristics\/ga\/ga_data.csv')\nnum_stations = len(df)-1\n\n\nStations = [] #load stations location\nfor i in range(0,num_stations):\n    name = str(df.iloc[i,0])\n    x = df.iloc[i,1]\n    y = df.iloc[i,2]\n    if i==0:\n        name = &quot;root&quot;\n        mStation = Station(x,y,name)\n        rootStation = mStation\n    else:     \n        mStation = Station(x,y,name)\n        Stations.append(mStation)\n    \ndf.head()\n\n#Run Getting Algorithm\n#settings-----------------------------\n\nMaxGen = 1000#generate a thousand elements\nbr = 0.6#pick the best parents proportion\ner = 0.3#30% of population are elite\nxr = 0.3#30% of population are cross-over\n\nmf = 0.4 #70% of mutations comes from elite\nmr = 0.6#mutation ratio\n\ngen_limit = 100\n\nbest_individual = ga_operation(gen_limit,num_stations,MaxGen)\nprint('Problem solution:',best_individual)\n\n <\/code><\/pre><script>\nif (!document.getElementById('syntaxed-prism')) {\n\tvar my_awesome_script = document.createElement('script');\n\tmy_awesome_script.setAttribute('src','https:\/\/mlinsightscentral.com\/wp-content\/plugins\/syntax-highlighter-for-elementor\/assets\/prism2.js');\n\tmy_awesome_script.setAttribute('id','syntaxed-prism');\n\tdocument.body.appendChild(my_awesome_script);\n} else {\n\twindow.Prism && Prism.highlightAll();\n}\n<\/script>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8dc987b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8dc987b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-f131004\" data-id=\"f131004\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-920bf2d elementor-widget elementor-widget-image\" data-id=\"920bf2d\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"433\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_0-1.png\" class=\"attachment-large size-large wp-image-1861\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_0-1.png 559w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_0-1-300x232.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-41d7378\" data-id=\"41d7378\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2f85329 elementor-widget elementor-widget-image\" data-id=\"2f85329\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"433\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_5.png\" class=\"attachment-large size-large wp-image-1862\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_5.png 559w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_5-300x232.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-3b4fb6a\" data-id=\"3b4fb6a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f779ad2 elementor-widget elementor-widget-image\" data-id=\"f779ad2\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"433\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_69.png\" class=\"attachment-large size-large wp-image-1863\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_69.png 559w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/09\/ga_69-300x232.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7dfab2d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7dfab2d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cb6dd49\" data-id=\"cb6dd49\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e0fcb9f elementor-widget elementor-widget-heading\" data-id=\"e0fcb9f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-3a6b632 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3a6b632\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7e3c396\" data-id=\"7e3c396\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b73ce48 elementor-widget elementor-widget-text-editor\" data-id=\"b73ce48\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Genetic algorithms are powerful complex search algorithms that can be used for discrete value solutions and continuous value solutions with lots of applications in logistics and several self-learning AI.\u00a0 The proper choice of the crossover operator and mutation operator must be investigated on a problem-to-problem basis. The proper balance\u00a0<span dir=\"ltr\" role=\"presentation\">of<\/span> <span dir=\"ltr\" role=\"presentation\">mutation and crossover<\/span> <span dir=\"ltr\" role=\"presentation\">is required as an incline towards crossover <\/span><span dir=\"ltr\" role=\"presentation\">favours exploitation, while an incline towards mutation favours exploration. The degree <\/span><span dir=\"ltr\" role=\"presentation\">of usage of these operators affects the performance of GA. GA is commonly used in machine learning for wrapper-based feature selection whereby it helps the search for the optimal feature subset that can lead to the best regression or classification performance.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-55b7db8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"55b7db8\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c2e9e5a\" data-id=\"c2e9e5a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5b7d4e7 elementor-widget elementor-widget-heading\" data-id=\"5b7d4e7\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<div class=\"elementor-heading-title elementor-size-default\">Yves Matanga, PhD<\/div>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1436b662 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1436b662\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-446a7a\" data-id=\"446a7a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5c6bd507 elementor-widget elementor-widget-heading\" data-id=\"5c6bd507\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Be the first to receive notification, when new content is available!<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5e77a2d2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5e77a2d2\" data-element_type=\"section\">\n\t\t\t\t\t\t\t<div class=\"elementor-background-overlay\"><\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4623e8ed\" data-id=\"4623e8ed\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-22e802a0 elementor-widget elementor-widget-wpforms\" data-id=\"22e802a0\" data-element_type=\"widget\" data-widget_type=\"wpforms.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<div class=\"wpforms-container inline-fields\" id=\"wpforms-10\"><form id=\"wpforms-form-10\" class=\"wpforms-validate wpforms-form\" data-formid=\"10\" method=\"post\" enctype=\"multipart\/form-data\" action=\"\/index.php\/wp-json\/wp\/v2\/pages\/1758\" data-token=\"913d9bd6743a6000f642b6cb8d525328\"><noscript class=\"wpforms-error-noscript\">Please enable JavaScript in your browser to complete this form.<\/noscript><div class=\"wpforms-field-container\"><div id=\"wpforms-10-field_1-container\" class=\"wpforms-field wpforms-field-email wpforms-mobile-full\" data-field-id=\"1\"><label class=\"wpforms-field-label wpforms-label-hide\" for=\"wpforms-10-field_1\">Email <span class=\"wpforms-required-label\">*<\/span><\/label><input type=\"email\" id=\"wpforms-10-field_1\" class=\"wpforms-field-large wpforms-field-required\" name=\"wpforms[fields][1]\" placeholder=\"Email address\" spellcheck=\"false\" required><\/div><\/div><!-- .wpforms-field-container --><div class=\"wpforms-submit-container\" ><input type=\"hidden\" name=\"wpforms[id]\" value=\"10\"><input type=\"hidden\" name=\"wpforms[author]\" value=\"1\"><button type=\"submit\" name=\"wpforms[submit]\" id=\"wpforms-submit-10\" class=\"wpforms-submit\" data-alt-text=\"Sending...\" data-submit-text=\"Subscribe\" aria-live=\"assertive\" value=\"wpforms-submit\">Subscribe<\/button><\/div><\/form><\/div>  <!-- .wpforms-container -->\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Genetic Algorithms Genetic algorithms are complex search algorithms inspired by the theory of evolution. It is a population-based algorithm in which candidate optimisation agents possess genetic information and evolve over time generation after generation through three main evolutionary life processes: elitism, mutation and crossover. Components of a genetic algorithm Genetic Code Formation Fitness\/Cost Function Population &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/\"> <span class=\"screen-reader-text\">Genetic Algorithms<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"wf_page_folders":[25],"class_list":["post-1758","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.11 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Genetic Algorithms - MLInsightsCentral<\/title>\n<meta name=\"description\" content=\"Genetic algorithms are inspired from the theory of evolution to generate and control optimisation agents in search for the best solution to a complex problem.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Genetic Algorithms - MLInsightsCentral\" \/>\n<meta property=\"og:description\" content=\"Genetic algorithms are inspired from the theory of evolution to generate and control optimisation agents in search for the best solution to a complex problem.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/\" \/>\n<meta property=\"og:site_name\" content=\"MLInsightsCentral\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-18T15:17:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/elementor\/thumbs\/genetic_algorithm_illutsration-qc3zh22vc4y0pkh8jcvddkbcgypi4y6wqup10hqolc.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/\",\"url\":\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/\",\"name\":\"Genetic Algorithms - MLInsightsCentral\",\"isPartOf\":{\"@id\":\"https:\/\/mlinsightscentral.com\/#website\"},\"datePublished\":\"2023-09-07T14:53:07+00:00\",\"dateModified\":\"2023-09-18T15:17:33+00:00\",\"description\":\"Genetic algorithms are inspired from the theory of evolution to generate and control optimisation agents in search for the best solution to a complex problem.\",\"breadcrumb\":{\"@id\":\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mlinsightscentral.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Genetic Algorithms\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mlinsightscentral.com\/#website\",\"url\":\"https:\/\/mlinsightscentral.com\/\",\"name\":\"MLInsightsCentral\",\"description\":\"Learn Machine Learning and AI for engineers, data scientists and AI practionners.\",\"publisher\":{\"@id\":\"https:\/\/mlinsightscentral.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mlinsightscentral.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/mlinsightscentral.com\/#organization\",\"name\":\"MLInsightsCentral\",\"url\":\"https:\/\/mlinsightscentral.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png\",\"contentUrl\":\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png\",\"width\":200,\"height\":110,\"caption\":\"MLInsightsCentral\"},\"image\":{\"@id\":\"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Genetic Algorithms - MLInsightsCentral","description":"Genetic algorithms are inspired from the theory of evolution to generate and control optimisation agents in search for the best solution to a complex problem.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/","og_locale":"en_US","og_type":"article","og_title":"Genetic Algorithms - MLInsightsCentral","og_description":"Genetic algorithms are inspired from the theory of evolution to generate and control optimisation agents in search for the best solution to a complex problem.","og_url":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/","og_site_name":"MLInsightsCentral","article_modified_time":"2023-09-18T15:17:33+00:00","og_image":[{"url":"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/elementor\/thumbs\/genetic_algorithm_illutsration-qc3zh22vc4y0pkh8jcvddkbcgypi4y6wqup10hqolc.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/","url":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/","name":"Genetic Algorithms - MLInsightsCentral","isPartOf":{"@id":"https:\/\/mlinsightscentral.com\/#website"},"datePublished":"2023-09-07T14:53:07+00:00","dateModified":"2023-09-18T15:17:33+00:00","description":"Genetic algorithms are inspired from the theory of evolution to generate and control optimisation agents in search for the best solution to a complex problem.","breadcrumb":{"@id":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mlinsightscentral.com\/index.php\/genetic-algorithms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mlinsightscentral.com\/"},{"@type":"ListItem","position":2,"name":"Genetic Algorithms"}]},{"@type":"WebSite","@id":"https:\/\/mlinsightscentral.com\/#website","url":"https:\/\/mlinsightscentral.com\/","name":"MLInsightsCentral","description":"Learn Machine Learning and AI for engineers, data scientists and AI practionners.","publisher":{"@id":"https:\/\/mlinsightscentral.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mlinsightscentral.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mlinsightscentral.com\/#organization","name":"MLInsightsCentral","url":"https:\/\/mlinsightscentral.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/","url":"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png","contentUrl":"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png","width":200,"height":110,"caption":"MLInsightsCentral"},"image":{"@id":"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/mlinsightscentral.com\/index.php\/author\/yvesm\/"},"uagb_comment_info":15,"uagb_excerpt":"Genetic Algorithms Genetic algorithms are complex search algorithms inspired by the theory of evolution. It is a population-based algorithm in which candidate optimisation agents possess genetic information and evolve over time generation after generation through three main evolutionary life processes: elitism, mutation and crossover. Components of a genetic algorithm Genetic Code Formation Fitness\/Cost Function Population&hellip;","_links":{"self":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages\/1758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/comments?post=1758"}],"version-history":[{"count":131,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages\/1758\/revisions"}],"predecessor-version":[{"id":2109,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages\/1758\/revisions\/2109"}],"wp:attachment":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/media?parent=1758"}],"wp:term":[{"taxonomy":"wf_page_folders","embeddable":true,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/wf_page_folders?post=1758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}