<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Personalized Genetic Algorithm Initialization in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171638#M1661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are two ways to do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Since you only want to specify ONE initial member, you could just use the fitness subroutine. If you look at the chapter in the SAS/IML User's Guide on "Genetic Algorithms," there is a section on &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_geneticalgs_sect004.htm"&gt;"Setting the Objective Function." &lt;/A&gt;That doc says, "The solution parameter passed into the routine is also written back out to the solution population when the module exits....It is permissible and may prove very effective to add logic to the module to improve the solution through some heuristic technique or local optimization, and deliberately pass that improved solution back to the solution population by updating the parameter before returning."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This suggests the following technique for a "warm start" initialization of the solution vector. I'll modify &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_langref_sect140.htm"&gt;the example from the GASETUP doc:&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstTime = 1;&amp;nbsp; /* flag ON */&lt;/P&gt;&lt;P&gt;start EvalFitness( pop ) global ( dist, FirstTime );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if FirstTime then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pop[1,] = {6 4 12 7 13 15 8 9 11 5 2 14 10 3 1}; /* initially "fit" member */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstTime = 0;&amp;nbsp; /* flag OFF */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) If you prefer to use a module to intialize the entire initial population, the structure of the module is documented &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_langref_sect133.htm"&gt;at the end of the doc for the GAINIT call.&lt;/A&gt; Basically, you return the special member when the module is called the first time, and a random member for subsequent calls. For example, the example from the GASETUP doc would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstTime = 1;&amp;nbsp; /* flag ON */&lt;/P&gt;&lt;P&gt;start FirstPop(member) global(FirstTime, NumCities);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if FirstTime then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; member = {6 4 12 7 13 15 8 9 11 5 2 14 10 3 1};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstTime = 0;&amp;nbsp; /* flag OFF */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; member = ranperm(NumCities);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;call gainit(id, popSize, ,"FirstPop"); &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Dec 2013 17:48:21 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2013-12-13T17:48:21Z</dc:date>
    <item>
      <title>Personalized Genetic Algorithm Initialization</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171637#M1660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello again everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a question regarding the Genetic Algorithm routines available in SAS/IML&lt;BR /&gt;One of the features of those routines is that the initial population is randomised within an interval of possible solutions given by the user: the syntax of the initialisation routine is the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call gainit ( problem_id, pop_size, bounds, &amp;lt;modname&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: how can I specify SAS that I want 1 individual, whose coordinate I know, to belong to the initiale population ? Namely, I would like my first generation of individuals to contain one specific individual, whose fitness value is already high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The documentation mentions the optional parameter &amp;lt;modname&amp;gt;, which is a user-written module to be called from Gainit to generate the initial population.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that I have no idea how to write such a module. What is the expected output from it ? A matrix ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 16:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171637#M1660</guid>
      <dc:creator>GabACM</dc:creator>
      <dc:date>2013-12-12T16:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Personalized Genetic Algorithm Initialization</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171638#M1661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are two ways to do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Since you only want to specify ONE initial member, you could just use the fitness subroutine. If you look at the chapter in the SAS/IML User's Guide on "Genetic Algorithms," there is a section on &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_geneticalgs_sect004.htm"&gt;"Setting the Objective Function." &lt;/A&gt;That doc says, "The solution parameter passed into the routine is also written back out to the solution population when the module exits....It is permissible and may prove very effective to add logic to the module to improve the solution through some heuristic technique or local optimization, and deliberately pass that improved solution back to the solution population by updating the parameter before returning."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This suggests the following technique for a "warm start" initialization of the solution vector. I'll modify &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_langref_sect140.htm"&gt;the example from the GASETUP doc:&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstTime = 1;&amp;nbsp; /* flag ON */&lt;/P&gt;&lt;P&gt;start EvalFitness( pop ) global ( dist, FirstTime );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if FirstTime then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pop[1,] = {6 4 12 7 13 15 8 9 11 5 2 14 10 3 1}; /* initially "fit" member */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstTime = 0;&amp;nbsp; /* flag OFF */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) If you prefer to use a module to intialize the entire initial population, the structure of the module is documented &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_langref_sect133.htm"&gt;at the end of the doc for the GAINIT call.&lt;/A&gt; Basically, you return the special member when the module is called the first time, and a random member for subsequent calls. For example, the example from the GASETUP doc would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstTime = 1;&amp;nbsp; /* flag ON */&lt;/P&gt;&lt;P&gt;start FirstPop(member) global(FirstTime, NumCities);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if FirstTime then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; member = {6 4 12 7 13 15 8 9 11 5 2 14 10 3 1};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstTime = 0;&amp;nbsp; /* flag OFF */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; member = ranperm(NumCities);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;call gainit(id, popSize, ,"FirstPop"); &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 17:48:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171638#M1661</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-12-13T17:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Personalized Genetic Algorithm Initialization</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171639#M1662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first solution you gave works indeed, thank you Rick Wicklin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 12:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Personalized-Genetic-Algorithm-Initialization/m-p/171639#M1662</guid>
      <dc:creator>GabACM</dc:creator>
      <dc:date>2013-12-16T12:45:18Z</dc:date>
    </item>
  </channel>
</rss>

