{"id":1571,"date":"2019-07-24T12:00:39","date_gmt":"2019-07-24T10:00:39","guid":{"rendered":"https:\/\/aerospaceresearch.net\/?p=1571"},"modified":"2019-07-24T12:00:39","modified_gmt":"2019-07-24T10:00:39","slug":"gsoc2019ksatthemistoklis-2nd-coding-period","status":"publish","type":"post","link":"https:\/\/aerospaceresearch.net\/?p=1571","title":{"rendered":"[GSoC2019|Ksat|Themistoklis] 2nd Coding Period"},"content":{"rendered":"\n<p>Hi there!<\/p>\n\n\n\n<p>This is the\nsecond in a series of blog posts, where I am documenting the progress of my\nproject and my experience working with aerospaceresearch.net for Google Summer\nof Code 2019. <\/p>\n\n\n\n<p>Last time I\nwent into details about the often synonymous concepts, in the engineering world,\nof designing and optimizing a system. The provided context served as a prerequisite\nfor explaining the purpose and the motivation behind both the KSat project, as\nwell as my contribution in the project, which is the development of an automated\nvisualization system to explore different design points, gain insights about\nthe optimization process and the genetic algorithm\u2019s performance, aid in\ndebugging and more. In case you missed it and you would like to have more\ninformation, you can find the first blog post here: <a href=\"https:\/\/aerospaceresearch.net\/?p=1542\">https:\/\/aerospaceresearch.net\/?p=1542<\/a>\n. In fact, I highly recommend that you have read the first blog post before\nmoving on with the second one.<\/p>\n\n\n\n<p>From this point on, this blog post will focus on the\nprogress during the second coding period. Before I get into technical topics,\nsince I am documenting the whole experience, I would like to write a couple of\nwords about the collaboration and the communication within aerospaceresearch.net.\nLike mentioned in the first blog post, everyone inside the organization has\nbeen extremely welcoming and helpful even from the pre-application stage. As it\nis to be expected during the second coding period, I was even more familiar\nwith my project as well as with the exact fit of my work in the bigger picture.\nThe communication with my main mentor, Manfred, continues to take place in an\nalmost daily base for anything related to my work and I would like to thank him\none more time for his valuable input and our great collaboration.<\/p>\n\n\n\n<p>Regarding the technical aspects of my project, attention was first given in making the visualizations more presentable and readable. For this purpose, the structure of the xml that serves as an input to the visualization system, was extended to accommodate the following functionality:<\/p>\n\n\n\n<p>-) Application of custom axes limits or limits that are\ncalculated from the optimization data.<\/p>\n\n\n\n<p>-) Definition of viewing angle for the 3d plot.<\/p>\n\n\n\n<p>-) Definition of plot title.<\/p>\n\n\n\n<p>-) Definition of axes labels that correspond to\ndegrees-of-freedom (DoFs) that are assigned in x-, y- and z- axis.<\/p>\n\n\n\n<p>-) Definition of legends that correspond to DoFs that are\nassigned in line style and line color as well as marker and marker color.<\/p>\n\n\n\n<p>Some additional options like defining the font size for the\ntitle, the labels and the legends are available. The above functionality is more\nor less self-explanatory, but in order to make things more tangible the\nfollowing visualizations from the first blog post are presented. The difference\nhere is, that the visualizations have been properly annotated by activating the\ncorresponding options through the xml file.<\/p>\n\n\n\n<p>The first visualization from the first blog post, would take the following form:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"900\" src=\"https:\/\/aerospaceresearch.net\/wp-content\/uploads\/2019\/07\/image_1.png\" alt=\"\" class=\"wp-image-1572\"\/><\/figure>\n\n\n\n<p>In the figure above, I have defined \u201cPropulsion Unit Optimization\u201d as the title to applied on the plot as well as \u201cEffective Exhaust Velocity \/ m\/s\u201d, \u201cThrust \/ N\u201d, and \u201cTotal Mass Fraction \/ -\u201c as the labels of the x-, y- and z- axis correspondingly. In addition, I have specified that the axes limits should be calculated from the optimization data and that the viewing angle should be [azimuth, elevation] = [30, 60]. I have also enabled the legend for the remaining of the activated DoFs, which in this case are propulsion type and propellant. As it can be seen on the legend, propulsion type (arc jet or grid ion thruster) has been assigned to line style (solid or dashed), while propellant (He, Xe or NH3) has been assigned to marker (crosshair, circle or star). The chosen font sizes in this example are 14 for the title, 12 for the labels and 9 for the legends. At this point it should be noted that some of the above options, concerning the appearance of the visualization, were also manually applied at the corresponding visualization of the first blog post. The difference here is, that their automatic application has now been implemented as a series of activatable options in the xml file.<\/p>\n\n\n\n<p>Now that we have an idea about the way in which the majority of a visualization\u2019s elements are annotated, lets also see how potential additional continuous DoFs that are assigned to line and marker color are presented. For this purpose, we are going to use the last visualization from the first blog post, which would take the following form: <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"900\" src=\"https:\/\/aerospaceresearch.net\/wp-content\/uploads\/2019\/07\/image_2.png\" alt=\"\" class=\"wp-image-1573\"\/><\/figure>\n\n\n\n<p>The difference in this visualization compared to the\nprevious one is, that two additional hypothetical continuous DoFs have been assigned\nto line and marker colour. To indicate this, the corresponding DoFs \u201cHypothetical Continuous DoF 1\u201d and \u201cHypothetical\nContinuous DoF 2\u201d are included in the legend with a colored line and mark. Notice\nthat are all other elements in the legend are black. The colored elements\nindicate that the value of these continuous dofs corresponds to the line and\nmarker color in the visualization.<\/p>\n\n\n\n<p>Now that we have covered the annotation of the visualizations, lets move to the remaining implemented functionality. A second type of visualization, a 2d visualization, was added in the visualization system. The motivation for the 2d plot is similar to the motivation for the 3d plot. Different system DoFs can be assigned to y-axis, line style and color as well as marker style and color. Notice that the x- and z-axis are no longer available to the user. At this point you may ask what the purpose of the 2d plot is then. In the 2d plot the x-axis corresponds to the generations of the system\u2019s evolution, thus the 2d plot can be used to acquire a clearer picture regarding the chronological order in which different lineages evolve through different design points.<\/p>\n\n\n\n<p>As usual I am going to give a practical example. I assign total mass fraction to y-axis, propulsion type to line style, propellant to marker, effective exhaust velocity to line color and thrust to marker color. I deactivate the visualization of failed mutations, I sort the lineages by total mass fraction and I keep only the 5 best lineages. I also activate the use of the implemented annotations. The plotting system returns the following figure:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"900\" src=\"https:\/\/aerospaceresearch.net\/wp-content\/uploads\/2019\/07\/image_3.png\" alt=\"\" class=\"wp-image-1574\"\/><\/figure>\n\n\n\n<p>As we can\nsee from the figure above, all lineages converge to almost identical final design\npoints. One lineage achieves this in just 3 generations, while another one need\nas much as 10 generations. In between of improved design points, we can also observe\nthe number of generations where failed mutations occurred. For the lineage that\nconverges on the 10<sup>th<\/sup> generation we can see that the successful mutations\ntake place at the 3<sup>rd<\/sup>, 6<sup>th<\/sup> and 10<sup>th<\/sup> generation.\nThis means that the mutations of the generations 2, 4-5 and 7-9 were failed\nmutations. <\/p>\n\n\n\n<p>Another\nimplemented feature is the ability to save the generated visualizations in a\ndesired file format. This is required in order to review the progress of the\noptimization process after the execution of an optimization cycle. For this purpose,\nthe following functionality was implemented as an activatable option through\nthe xml file.<\/p>\n\n\n\n<p>-) Saving\nof the visualization in one or more file formats. The available file formats\nare: *.ps, *.eps, *.jpg, *.png, *.emf, *.pdf<\/p>\n\n\n\n<p>-) Generating\nfilenames according to input case number, input\/mission parameters and plot\ncase number.<\/p>\n\n\n\n<p>In order to\navoid loss of any generated visualization it is important that the generated\nfilenames always remain different regardless of the number of visualizations or\nthe activated filename options. For this purpose, a hard-coded fail-safe check\nwas also included. A sample generated filename could be \u201cinput_case_1_totalimpulse_112670_deltav_686_plot_case_1\u201d.\nIn this case, the input case number, the mission parameters (total impulse and velocity\nincrement) along with their corresponding values and the plot case number, were\nall included in the title. For distinction purposes between different\nvisualizations the plot case number is always included in the title, while in\nthe absence of mission parameters the input case number is also automatically\nincluded.<\/p>\n\n\n\n<p>Finally, another way to reap more potential insights from the visualizations is to include the dimension of time in them. This was achieved to a certain extend with the use of the 2d plot where the x-axis corresponds to the generations. There is another way to do so, where the graphics objects that form the visualizations are animated through a series of frames that follow the evolution of the system that is being optimized. The output is a series of frames that form a gif animation, rather than a single snapshot. The graphics objects can be animated in two different ways.  <\/p>\n\n\n\n<p>According to the first approach, the graphics objects are animated separately for each lineage. The sequence of the design points that correspond to the best lineage are animated first, then those that correspond to the second best and so on. This animated version of the last visualization of the first post, is the following: <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"560\" height=\"417\" src=\"https:\/\/aerospaceresearch.net\/wp-content\/uploads\/2019\/07\/image_4.gif\" alt=\"\" class=\"wp-image-1575\"\/><\/figure>\n\n\n\n<p>In the\nanimation above, only the 10 best lineages have been included. The frame rate\nof the animation is defined at 2 fps through the xml file.<\/p>\n\n\n\n<p>The other\nway in which the graphics objects of a visualization can be animated, is for\nall lineages together. In this case, the sequence of the design points of all selected\nlineages is animated according to the progression of the generations.&nbsp; Design points that appear on the same frame\ncorrespond to mutations of different lineages that took place on the same\ngeneration during the optimization process. This animated version is the\nfollowing:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"560\" height=\"417\" src=\"https:\/\/aerospaceresearch.net\/wp-content\/uploads\/2019\/07\/image_5.gif\" alt=\"\" class=\"wp-image-1576\"\/><\/figure>\n\n\n\n<p>It should\nbe noted that the examples for which the animations were applied, are simplified,\nthus a certain visual overlap occurs between different lineages. This causes\nthe animations to appear stagnant at times, while what is really happening is\nthat some lineages follow an identical sequence of design points as others. These\ndesign points have already appeared in the visualization due to already\nvisualized lineages or due to lineages that have advanced through them at an\nearlier generation, giving the illusion that the animation remains stagnant at times,\nbut this is not the case.<\/p>\n\n\n\n<p>One final\nthing to mention is, that not only a 3d plot but also a 2d plot can be animated\nin a similar fashion.<\/p>\n\n\n\n<p>Summing up\nthis second blog post, we got a brief overview as well as a quick demonstration\nof the newly added features. We saw how these features build on top of the\nexisting ones and open the possibilities for further exploration of the\nevolution data. There are some cases where minor bug fixes are required, and potential\nimprovements and extensions have already been identified. Documentation is also\ngoing to be developed, but all that is work for the following weeks \u2026<\/p>\n\n\n\n<p>Congrats\nfor making it through the second blog post and many thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi there! This is the second in a series of blog posts, where I am documenting the progress of my project and my experience working with aerospaceresearch.net for Google Summer of Code 2019. Last time I went into details about the often synonymous concepts, in the engineering world, of designing and optimizing a system. The &hellip; <a href=\"https:\/\/aerospaceresearch.net\/?p=1571\" class=\"more-link\"><span class=\"screen-reader-text\">\u201e[GSoC2019|Ksat|Themistoklis] 2nd Coding Period\u201c<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=\/wp\/v2\/posts\/1571"}],"collection":[{"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1571"}],"version-history":[{"count":1,"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=\/wp\/v2\/posts\/1571\/revisions"}],"predecessor-version":[{"id":1577,"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=\/wp\/v2\/posts\/1571\/revisions\/1577"}],"wp:attachment":[{"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aerospaceresearch.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}