{"id":2352,"date":"2014-01-29T17:56:58","date_gmt":"2014-01-29T17:56:58","guid":{"rendered":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/?post_type=portfolio&#038;p=2352"},"modified":"2016-08-25T16:41:43","modified_gmt":"2016-08-25T14:41:43","slug":"mona_lisa_parallel_genetic_algorithm","status":"publish","type":"portfolio","link":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/gfx\/mona_lisa_parallel_genetic_algorithm\/","title":{"rendered":"<strong>A parallel genetic algorithm for Roger Alsing&#8217;s EvoLisa problem<\/strong><br\/><em>In less than 400 effective lines of C++ code, mostly for educational purposes <\/em>"},"content":{"rendered":"\n<style type=\"text\/css\" data-created_by=\"avia_inline_auto\" id=\"style-css-av-av_heading-a684d70deca4bb629ba8fe11180836a4\">\n#top .av-special-heading.av-av_heading-a684d70deca4bb629ba8fe11180836a4{\npadding-bottom:10px;\n}\nbody .av-special-heading.av-av_heading-a684d70deca4bb629ba8fe11180836a4 .av-special-heading-tag .heading-char{\nfont-size:25px;\n}\n.av-special-heading.av-av_heading-a684d70deca4bb629ba8fe11180836a4 .av-subheading{\nfont-size:15px;\n}\n<\/style>\n<div  class='av-special-heading av-av_heading-a684d70deca4bb629ba8fe11180836a4 av-special-heading-h3 meta-heading  avia-builder-el-0  el_before_av_textblock  avia-builder-el-first '><h3 class='av-special-heading-tag '  itemprop=\"headline\"  >Repainting the Mona Lisa with a genetic algorithm<\/h3><div class=\"special-heading-border\"><div class=\"special-heading-inner-border\"><\/div><\/div><\/div>\n<section  class='av_textblock_section av-av_textblock-0366cc7376be6c9e82a3e9cc8987b64f '   itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock'  itemprop=\"text\" ><p style=\"text-align: justify;\">This is my take on Roger Alsing&#8217;s Mona Lisa problem, where the mentioned image has to be reproduced as faithfully as possible using only 50 triangles. My implementation is less than 400 lines of C++ and uses a parallel <a href=\"https:\/\/en.wikipedia.org\/wiki\/Genetic_algorithm\" target=\"_blank\">genetic algorithm<\/a> for optimization.\u00a0Genetic algorithms can solve a multitude of optimization problems by the digital modeling of natural selection, mutation and recombination. This algorithm attempts to draw a faithful representation of the Mona Lisa using only a few triangles. The\u00a0code for the implementation is available for download below.<\/p>\n<\/div><\/section>\n\n<style type=\"text\/css\" data-created_by=\"avia_inline_auto\" id=\"style-css-av-av_heading-f7bd182dee5ded90bcf7c71bd41847da\">\n#top .av-special-heading.av-av_heading-f7bd182dee5ded90bcf7c71bd41847da{\npadding-bottom:10px;\n}\nbody .av-special-heading.av-av_heading-f7bd182dee5ded90bcf7c71bd41847da .av-special-heading-tag .heading-char{\nfont-size:25px;\n}\n.av-special-heading.av-av_heading-f7bd182dee5ded90bcf7c71bd41847da .av-subheading{\nfont-size:15px;\n}\n<\/style>\n<div  class='av-special-heading av-av_heading-f7bd182dee5ded90bcf7c71bd41847da av-special-heading-h3 meta-heading  avia-builder-el-2  el_after_av_textblock  el_before_av_image '><h3 class='av-special-heading-tag '  itemprop=\"headline\"  >Result<\/h3><div class=\"special-heading-border\"><div class=\"special-heading-inner-border\"><\/div><\/div><\/div>\n\n<style type=\"text\/css\" data-created_by=\"avia_inline_auto\" id=\"style-css-av-av_image-a28614bf7858c1cff60a18f379938cc8\">\n.avia-image-container.av-av_image-a28614bf7858c1cff60a18f379938cc8 img.avia_image{\nbox-shadow:none;\n}\n.avia-image-container.av-av_image-a28614bf7858c1cff60a18f379938cc8 .av-caption-image-overlay-bg{\nopacity:0.4;\nbackground-color:#000000;\n}\n.avia-image-container.av-av_image-a28614bf7858c1cff60a18f379938cc8 .av-image-caption-overlay-center{\ncolor:#ffffff;\n}\n<\/style>\n<div  class='avia-image-container av-av_image-a28614bf7858c1cff60a18f379938cc8 av-styling- av-hover-grow avia-align-center  avia-builder-el-3  el_after_av_heading  el_before_av_heading  noHover av-overlay-on-hover'   itemprop=\"image\" itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/ImageObject\" ><div class=\"avia-image-container-inner\"><div class=\"avia-image-overlay-wrap\"><div class=\"av-image-caption-overlay\"><div class=\"av-caption-image-overlay-bg\"><\/div><div class=\"av-image-caption-overlay-position\"><div class=\"av-image-caption-overlay-center\"><p>The Mona Lisa drawn with a Genetic algorithm.<\/p>\n<\/div><\/div><\/div><img decoding=\"async\" fetchpriority=\"high\" class='wp-image-2325 avia-img-lazy-loading-not-2325 avia_image ' src=\"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/01\/mona_lisa_comparison.jpg\" alt='Genetic Algorithm' title='mona_lisa_comparison'  height=\"202\" width=\"402\"  itemprop=\"thumbnailUrl\" srcset=\"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/01\/mona_lisa_comparison.jpg 402w, https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/01\/mona_lisa_comparison-300x150.png 300w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><\/div><\/div><\/div>\n\n<style type=\"text\/css\" data-created_by=\"avia_inline_auto\" id=\"style-css-av-av_heading-19f2d3d90b03c5176ee5d6eea431329b\">\n#top .av-special-heading.av-av_heading-19f2d3d90b03c5176ee5d6eea431329b{\npadding-bottom:10px;\n}\nbody .av-special-heading.av-av_heading-19f2d3d90b03c5176ee5d6eea431329b .av-special-heading-tag .heading-char{\nfont-size:25px;\n}\n.av-special-heading.av-av_heading-19f2d3d90b03c5176ee5d6eea431329b .av-subheading{\nfont-size:15px;\n}\n<\/style>\n<div  class='av-special-heading av-av_heading-19f2d3d90b03c5176ee5d6eea431329b av-special-heading-h3 meta-heading  avia-builder-el-4  el_after_av_image  el_before_av_one_third '><h3 class='av-special-heading-tag '  itemprop=\"headline\"  >Resources<\/h3><div class=\"special-heading-border\"><div class=\"special-heading-inner-border\"><\/div><\/div><\/div>\n<div  class='flex_column av-av_one_third-2a9015ff38129c418a3f2eafba3e9512 av_one_third  avia-builder-el-5  el_after_av_heading  el_before_av_heading  first flex_column_div  '     ><p>\n<style type=\"text\/css\" data-created_by=\"avia_inline_auto\" id=\"style-css-av-av_image-c81871dd9a1dd007b45bee9a5aa2184f\">\n.avia-image-container.av-av_image-c81871dd9a1dd007b45bee9a5aa2184f img.avia_image{\nbox-shadow:none;\n}\n.avia-image-container.av-av_image-c81871dd9a1dd007b45bee9a5aa2184f .av-image-caption-overlay-center{\ncolor:#ffffff;\n}\n<\/style>\n<div  class='avia-image-container av-av_image-c81871dd9a1dd007b45bee9a5aa2184f av-styling- av-img-linked avia_animated_image av-animated-when-visible-95 left-to-right avia-align-center  avia-builder-el-6  el_before_av_textblock  avia-builder-el-first '   itemprop=\"image\" itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/ImageObject\" ><div class=\"avia-image-container-inner\"><div class=\"avia-image-overlay-wrap\"><a href=\"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/02\/genetic_mona.zip\" class='avia_image '  aria-label='code-icon'><img decoding=\"async\" fetchpriority=\"high\" class='wp-image-2653 avia-img-lazy-loading-not-2653 avia_image ' src=\"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/02\/code-icon-300x279.png\" alt='' title='code-icon'  height=\"279\" width=\"300\"  itemprop=\"thumbnailUrl\" srcset=\"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/02\/code-icon-300x279.png 300w, https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/02\/code-icon-705x656.png 705w, https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/02\/code-icon-450x419.png 450w, https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp\/wp-content\/uploads\/2014\/02\/code-icon.png 714w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/div><\/div><\/div><br \/>\n<section  class='av_textblock_section av-av_textblock-0366cc7376be6c9e82a3e9cc8987b64f '   itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock'  itemprop=\"text\" ><p style=\"text-align: center;\"><strong>Code<\/strong><\/p>\n<\/div><\/section><\/p><\/div>\n\n<style type=\"text\/css\" data-created_by=\"avia_inline_auto\" id=\"style-css-av-av_heading-e4fe8a6138fb3275c357c93697a61fc4\">\n#top .av-special-heading.av-av_heading-e4fe8a6138fb3275c357c93697a61fc4{\npadding-bottom:10px;\n}\nbody .av-special-heading.av-av_heading-e4fe8a6138fb3275c357c93697a61fc4 .av-special-heading-tag .heading-char{\nfont-size:25px;\n}\n.av-special-heading.av-av_heading-e4fe8a6138fb3275c357c93697a61fc4 .av-subheading{\nfont-size:15px;\n}\n<\/style>\n<div  class='av-special-heading av-av_heading-e4fe8a6138fb3275c357c93697a61fc4 av-special-heading-h3 meta-heading  avia-builder-el-8  el_after_av_one_third  el_before_av_video '><h3 class='av-special-heading-tag '  itemprop=\"headline\"  >How does it work?<\/h3><div class=\"special-heading-border\"><div class=\"special-heading-inner-border\"><\/div><\/div><\/div>\n<div  class='avia-video av-av_video-13a4c64e638cdc55127eeb0c63b75292 avia-video-16-9 av-no-preview-image avia-video-load-always av-lazyload-immediate av-lazyload-video-embed'  itemprop=\"video\" itemtype=\"https:\/\/schema.org\/VideoObject\"  data-original_url='https:\/\/www.youtube.com\/watch?v=ziMHaGQJuSI'><script type='text\/html' class='av-video-tmpl'><div class='avia-iframe-wrap'><iframe loading=\"lazy\" width=\"1500\" height=\"844\" src=\"https:\/\/www.youtube.com\/embed\/ziMHaGQJuSI?feature=oembed&autoplay=0&loop=0&controls=1&mute=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/div><\/script><div class='av-click-to-play-overlay'><div class=\"avia_playpause_icon\"><\/div><\/div><\/div>\n<div  class='avia-video av-av_video-c069e8be2d6cafc23b241525e92068f8 avia-video-16-9 av-no-preview-image avia-video-load-always av-lazyload-immediate av-lazyload-video-embed'  itemprop=\"video\" itemtype=\"https:\/\/schema.org\/VideoObject\"  data-original_url='https:\/\/www.youtube.com\/watch?v=27PYlj-qNb0'><script type='text\/html' class='av-video-tmpl'><div class='avia-iframe-wrap'><iframe loading=\"lazy\" width=\"1333\" height=\"1000\" src=\"https:\/\/www.youtube.com\/embed\/27PYlj-qNb0?feature=oembed&autoplay=0&loop=0&controls=1&mute=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/div><\/script><div class='av-click-to-play-overlay'><div class=\"avia_playpause_icon\"><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":2324,"template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"tags":[188,186,52,48,53,51,44],"portfolio_category":[],"portfolio_tag":[54,45,175,173,176,174,177],"portfolio_entries":[],"class_list":["post-2352","portfolio","type-portfolio","status-publish","has-post-thumbnail","hentry","tag-computer-science","tag-education","tag-evolisa","tag-genetic-algorithm","tag-mona-lisa","tag-parallel","tag-teaching","portfolio_tag-computer-science","portfolio_tag-education","portfolio_tag-evolisa","portfolio_tag-genetic-algorithm","portfolio_tag-genetic-programming","portfolio_tag-mona-lisa","portfolio_tag-roger-alsing"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio\/2352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio"}],"about":[{"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/types\/portfolio"}],"author":[{"embeddable":true,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":19,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio\/2352\/revisions"}],"predecessor-version":[{"id":4047,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio\/2352\/revisions\/4047"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/media\/2324"}],"wp:attachment":[{"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/media?parent=2352"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/tags?post=2352"},{"taxonomy":"portfolio_category","embeddable":true,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio_category?post=2352"},{"taxonomy":"portfolio_tag","embeddable":true,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio_tag?post=2352"},{"taxonomy":"portfolio_entries","embeddable":true,"href":"https:\/\/users.cg.tuwien.ac.at\/zsolnai\/wp-json\/wp\/v2\/portfolio_entries?post=2352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}