Skip to content

Commit

Permalink
deploy: 12e3761
Browse files Browse the repository at this point in the history
  • Loading branch information
SevgiAkten committed Dec 10, 2024
1 parent 56b8f61 commit 3f5e3b7
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 310 deletions.
17 changes: 11 additions & 6 deletions _modules/pycellga/example/example_alpha_cga.html
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,15 @@ <h1>Source code for pycellga.example.example_alpha_cga</h1><div class="highlight
<span class="kn">import</span> <span class="nn">os</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">),</span> <span class="s1">&#39;..&#39;</span><span class="p">)))</span>

<span class="kn">import</span> <span class="nn">optimizer</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">power</span> <span class="k">as</span> <span class="n">pw</span>

<span class="kn">from</span> <span class="nn">optimizer</span> <span class="kn">import</span> <span class="n">alpha_cga</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>
<span class="kn">from</span> <span class="nn">recombination</span> <span class="kn">import</span> <span class="n">BlxalphaCrossover</span>
<span class="kn">from</span> <span class="nn">mutation</span> <span class="kn">import</span> <span class="n">FloatUniformMutation</span>
<span class="kn">from</span> <span class="nn">selection</span> <span class="kn">import</span> <span class="n">TournamentSelection</span>


<div class="viewcode-block" id="ExampleProblem">
<a class="viewcode-back" href="../../../pycellga.example.html#pycellga.example.example_alpha_cga.ExampleProblem">[docs]</a>
<span class="k">class</span> <span class="nc">ExampleProblem</span><span class="p">:</span>
Expand Down Expand Up @@ -398,7 +403,7 @@ <h1>Source code for pycellga.example.example_alpha_cga</h1><div class="highlight
<span class="n">problem_instance</span> <span class="o">=</span> <span class="n">ExampleProblem</span><span class="p">()</span>

<span class="c1"># Run the optimizer and get the result</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">optimizer</span><span class="o">.</span><span class="n">alpha_cga</span><span class="p">(</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">alpha_cga</span><span class="p">(</span>
<span class="n">n_cols</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_rows</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_gen</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span>
Expand All @@ -407,9 +412,9 @@ <h1>Source code for pycellga.example.example_alpha_cga</h1><div class="highlight
<span class="n">p_crossover</span><span class="o">=</span><span class="mf">0.9</span><span class="p">,</span>
<span class="n">p_mutation</span><span class="o">=</span><span class="mf">0.2</span><span class="p">,</span>
<span class="n">problem</span><span class="o">=</span><span class="n">problem_instance</span><span class="p">,</span> <span class="c1"># Pass the ExampleProblem instance</span>
<span class="n">selection</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">recombination</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">BlxalphaCrossover</span><span class="p">,</span>
<span class="n">mutation</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">FloatUniformMutation</span><span class="p">,</span>
<span class="n">selection</span><span class="o">=</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">recombination</span><span class="o">=</span><span class="n">BlxalphaCrossover</span><span class="p">,</span>
<span class="n">mutation</span><span class="o">=</span><span class="n">FloatUniformMutation</span><span class="p">,</span>
<span class="n">mins</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="mf">32.768</span><span class="p">]</span> <span class="o">*</span> <span class="mi">10</span><span class="p">,</span> <span class="c1"># Minimum values for each gene</span>
<span class="n">maxs</span><span class="o">=</span><span class="p">[</span><span class="mf">32.768</span><span class="p">]</span> <span class="o">*</span> <span class="mi">10</span><span class="p">,</span> <span class="c1"># Maximum values for each gene</span>
<span class="n">seed_par</span><span class="o">=</span><span class="mi">100</span>
Expand Down
8 changes: 5 additions & 3 deletions _modules/pycellga/example/example_ccga.html
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ <h1>Source code for pycellga.example.example_ccga</h1><div class="highlight"><pr
<span class="kn">import</span> <span class="nn">os</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">),</span> <span class="s1">&#39;..&#39;</span><span class="p">)))</span>

<span class="kn">import</span> <span class="nn">optimizer</span>
<span class="kn">from</span> <span class="nn">optimizer</span> <span class="kn">import</span> <span class="n">ccga</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>
<span class="kn">from</span> <span class="nn">selection</span> <span class="kn">import</span> <span class="n">TournamentSelection</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>

<div class="viewcode-block" id="ExampleProblem">
Expand Down Expand Up @@ -396,14 +398,14 @@ <h1>Source code for pycellga.example.example_ccga</h1><div class="highlight"><pr
<span class="n">problem_instance</span> <span class="o">=</span> <span class="n">ExampleProblem</span><span class="p">()</span>

<span class="c1"># Run the optimizer and get the result</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">optimizer</span><span class="o">.</span><span class="n">ccga</span><span class="p">(</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">ccga</span><span class="p">(</span>
<span class="n">n_cols</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_rows</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_gen</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span>
<span class="n">ch_size</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span>
<span class="n">gen_type</span><span class="o">=</span><span class="n">GeneType</span><span class="o">.</span><span class="n">BINARY</span><span class="p">,</span>
<span class="n">problem</span><span class="o">=</span><span class="n">problem_instance</span><span class="p">,</span> <span class="c1"># Pass the ExampleProblem instance</span>
<span class="n">selection</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">selection</span><span class="o">=</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">mins</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="mi">10</span><span class="p">,</span> <span class="c1"># Minimum values for each gene (binary)</span>
<span class="n">maxs</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">*</span> <span class="mi">10</span> <span class="c1"># Maximum values for each gene (binary)</span>
<span class="p">)</span>
Expand Down
17 changes: 11 additions & 6 deletions _modules/pycellga/example/example_cga.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,15 @@ <h1>Source code for pycellga.example.example_cga</h1><div class="highlight"><pre
<span></span><span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">),</span> <span class="s1">&#39;..&#39;</span><span class="p">)))</span>
<span class="kn">import</span> <span class="nn">optimizer</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">power</span> <span class="k">as</span> <span class="n">pw</span>

<span class="kn">from</span> <span class="nn">optimizer</span> <span class="kn">import</span> <span class="n">cga</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>
<span class="kn">from</span> <span class="nn">recombination</span> <span class="kn">import</span> <span class="n">ByteOnePointCrossover</span>
<span class="kn">from</span> <span class="nn">mutation</span> <span class="kn">import</span> <span class="n">ByteMutationRandom</span>
<span class="kn">from</span> <span class="nn">selection</span> <span class="kn">import</span> <span class="n">TournamentSelection</span>


<div class="viewcode-block" id="ExampleProblem">
<a class="viewcode-back" href="../../../pycellga.example.html#pycellga.example.example_cga.ExampleProblem">[docs]</a>
<span class="k">class</span> <span class="nc">ExampleProblem</span><span class="p">:</span>
Expand Down Expand Up @@ -396,7 +401,7 @@ <h1>Source code for pycellga.example.example_cga</h1><div class="highlight"><pre
<span class="c1"># Create an instance of the problem</span>
<span class="n">problem_instance</span> <span class="o">=</span> <span class="n">ExampleProblem</span><span class="p">()</span>

<span class="n">result</span> <span class="o">=</span> <span class="n">optimizer</span><span class="o">.</span><span class="n">cga</span><span class="p">(</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">cga</span><span class="p">(</span>
<span class="n">n_cols</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_rows</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_gen</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span>
Expand All @@ -405,9 +410,9 @@ <h1>Source code for pycellga.example.example_cga</h1><div class="highlight"><pre
<span class="n">p_crossover</span><span class="o">=</span><span class="mf">0.9</span><span class="p">,</span>
<span class="n">p_mutation</span><span class="o">=</span><span class="mf">0.2</span><span class="p">,</span>
<span class="n">problem</span><span class="o">=</span><span class="n">problem_instance</span><span class="p">,</span> <span class="c1"># Pass the ExampleProblem instance</span>
<span class="n">selection</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">recombination</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">ByteOnePointCrossover</span><span class="p">,</span>
<span class="n">mutation</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">ByteMutationRandom</span><span class="p">,</span>
<span class="n">selection</span><span class="o">=</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">recombination</span><span class="o">=</span><span class="n">ByteOnePointCrossover</span><span class="p">,</span>
<span class="n">mutation</span><span class="o">=</span><span class="n">ByteMutationRandom</span><span class="p">,</span>
<span class="n">mins</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="mf">32.768</span><span class="p">]</span> <span class="o">*</span> <span class="mi">5</span><span class="p">,</span> <span class="c1"># Minimum values for each gene</span>
<span class="n">maxs</span><span class="o">=</span><span class="p">[</span><span class="mf">32.768</span><span class="p">]</span> <span class="o">*</span> <span class="mi">5</span><span class="p">,</span> <span class="c1"># Maximum values for each gene</span>
<span class="n">seed_par</span><span class="o">=</span><span class="mi">100</span>
Expand Down
8 changes: 5 additions & 3 deletions _modules/pycellga/example/example_mcccga.html
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,11 @@ <h1>Source code for pycellga.example.example_mcccga</h1><div class="highlight"><
<span class="kn">import</span> <span class="nn">os</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="vm">__file__</span><span class="p">),</span> <span class="s1">&#39;..&#39;</span><span class="p">)))</span>

<span class="kn">import</span> <span class="nn">optimizer</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

<span class="kn">from</span> <span class="nn">optimizer</span> <span class="kn">import</span> <span class="n">mcccga</span>
<span class="kn">from</span> <span class="nn">individual</span> <span class="kn">import</span> <span class="n">GeneType</span>
<span class="kn">from</span> <span class="nn">selection</span> <span class="kn">import</span> <span class="n">TournamentSelection</span>

<div class="viewcode-block" id="RealProblem">
<a class="viewcode-back" href="../../../pycellga.example.html#pycellga.example.example_mcccga.RealProblem">[docs]</a>
Expand Down Expand Up @@ -398,14 +400,14 @@ <h1>Source code for pycellga.example.example_mcccga</h1><div class="highlight"><
<span class="c1"># Create an instance of the problem</span>
<span class="n">problem_instance</span> <span class="o">=</span> <span class="n">RealProblem</span><span class="p">()</span>

<span class="n">result</span> <span class="o">=</span> <span class="n">optimizer</span><span class="o">.</span><span class="n">mcccga</span><span class="p">(</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">mcccga</span><span class="p">(</span>
<span class="n">n_cols</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_rows</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">n_gen</span><span class="o">=</span><span class="mi">500</span><span class="p">,</span>
<span class="n">ch_size</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
<span class="n">gen_type</span><span class="o">=</span><span class="n">GeneType</span><span class="o">.</span><span class="n">REAL</span><span class="p">,</span>
<span class="n">problem</span><span class="o">=</span><span class="n">problem_instance</span><span class="p">,</span> <span class="c1"># Pass the RealProblem instance</span>
<span class="n">selection</span><span class="o">=</span><span class="n">optimizer</span><span class="o">.</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">selection</span><span class="o">=</span><span class="n">TournamentSelection</span><span class="p">,</span>
<span class="n">mins</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="mf">3.768</span><span class="p">]</span> <span class="o">*</span> <span class="mi">5</span><span class="p">,</span>
<span class="n">maxs</span><span class="o">=</span><span class="p">[</span><span class="mf">3.768</span><span class="p">]</span> <span class="o">*</span> <span class="mi">5</span>
<span class="p">)</span>
Expand Down
Loading

0 comments on commit 3f5e3b7

Please sign in to comment.