* Bug #8414 fixed - Some genetic algorithms functions had no examples. 34/9834/2
Sylvestre Ledru [Wed, 28 Nov 2012 13:13:57 +0000 (14:13 +0100)]
Change-Id: I301d2906fd7d2952cbc0e4d9c59b622e3e87cd20

scilab/CHANGES_5.4.X
scilab/modules/genetic_algorithms/help/en_US/algorithms/optim_moga.xml
scilab/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga.xml
scilab/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga2.xml

index a3c4897..5b59ba1 100644 (file)
@@ -69,6 +69,8 @@ Bug fixes
 * Bug #3313 fixed - In the documentation, the title of a link was using the
                     id instead of the title of the page.
 
+* Bug #8414 fixed - Some genetic algorithms functions had no examples.
+
 * Bug #8883 fixed - In some cases, Scilab build from sources was looking for
                    libraries at the wrong place.
 
index e95c369..b2c63a3 100644 (file)
@@ -163,6 +163,38 @@ y = list(f,p1,p2,...)
             </listitem>
         </itemizedlist>
     </refsection>
+    
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example"><![CDATA[ 
+function f = deb_1(x)
+   f1_x1 = x(1);
+   g_x2  = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1);
+   h     = 1 - sqrt(f1_x1 / g_x2);
+
+   f(1,1) = f1_x1;
+   f(1,2) = g_x2 * h;
+endfunction
+
+PopSize     = 100;
+Proba_cross = 0.5;
+Proba_mut   = 0.3;
+NbGen       = 4;
+NbCouples   = 110;
+Log         = %T;
+nb_disp     = 10; // Nb point to display from the optimal population
+pressure    = 0.1;
+
+ga_params = init_param();
+ga_params = add_param(ga_params,'dimension',2);
+ga_params = add_param(ga_params,'minbound',zeros(2,1));
+ga_params = add_param(ga_params,'maxbound',ones(2,1));
+
+[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_moga(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params)
+
+ ]]></programlisting>
+    </refsection>
+    
     <refsection role="see also">
         <title>See Also</title>
         <simplelist type="inline">
index 2ad3f32..15b12aa 100644 (file)
             <listitem>
                 <para>This function implements the classical "Niched Sharing Genetic
                     Algorithm". For a demonstration, see
-                    SCI/modules/genetic_algorithms/examples/NSGAdemo.sce.
+                    SCI/modules/genetic_algorithms/demos/NSGAdemo.sce
                 </para>
             </listitem>
         </itemizedlist>
     </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example"><![CDATA[ 
+function f = deb_1(x)
+   f1_x1 = x(1);
+   g_x2  = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1);
+   h     = 1 - sqrt(f1_x1 / g_x2);
+
+   f(1,1) = f1_x1;
+   f(1,2) = g_x2 * h;
+endfunction
+
+PopSize     = 100;
+Proba_cross = 0.5;
+Proba_mut   = 0.3;
+NbGen       = 4;
+NbCouples   = 110;
+Log         = %T;
+nb_disp     = 10; // Nb point to display from the optimal population
+pressure    = 0.1;
+
+ga_params = init_param();
+ga_params = add_param(ga_params,'dimension',2);
+ga_params = add_param(ga_params,'minbound',zeros(2,1));
+ga_params = add_param(ga_params,'maxbound',ones(2,1));
+
+[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params)
+
+ ]]></programlisting>
+    </refsection>
+    
     <refsection role="see also">
         <title>See Also</title>
         <simplelist type="inline">
             <member>
-                <link linkend="optim_moga"> optim_moga </link>
+                <link linkend="optim_moga">optim_moga</link>
             </member>
             <member>
-                <link linkend="optim_ga"> optim_ga </link>
+                <link linkend="optim_ga">optim_ga</link>
             </member>
             <member>
-                <link linkend="optim_nsga2"> optim_nsga2 </link>
+                <link linkend="optim_nsga2">optim_nsga2</link>
             </member>
         </simplelist>
     </refsection>
index cebafa2..ecda9ab 100644 (file)
             </listitem>
         </itemizedlist>
     </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example"><![CDATA[ 
+function f = deb_1(x)
+   f1_x1 = x(1);
+   g_x2  = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1);
+   h     = 1 - sqrt(f1_x1 / g_x2);
+
+   f(1,1) = f1_x1;
+   f(1,2) = g_x2 * h;
+endfunction
+
+PopSize     = 100;
+Proba_cross = 0.5;
+Proba_mut   = 0.3;
+NbGen       = 4;
+NbCouples   = 110;
+Log         = %T;
+nb_disp     = 10; // Nb point to display from the optimal population
+pressure    = 0.1;
+
+ga_params = init_param();
+ga_params = add_param(ga_params,'dimension',2);
+ga_params = add_param(ga_params,'minbound',zeros(2,1));
+ga_params = add_param(ga_params,'maxbound',ones(2,1));
+
+[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga2(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params)
+
+ ]]></programlisting>
+    </refsection>
+    
     <refsection role="see also">
         <title>See Also</title>
         <simplelist type="inline">