|
@@ -156,18 +156,18 @@
|
|
|
|
|
|
|
|
|
<span class="c1"># evaluator example</span>
|
|
|
-<div class="viewcode-block" id="evaluatorExample"><a class="viewcode-back" href="../../../macop/macop.evaluators.EvaluatorExample.html#macop.evaluators.EvaluatorExample.evaluatorExample">[docs]</a><span class="k">def</span> <span class="nf">evaluatorExample</span><span class="p">(</span><span class="n">solution</span><span class="p">):</span>
|
|
|
+<div class="viewcode-block" id="evaluatorExample"><a class="viewcode-back" href="../../../macop/macop.evaluators.EvaluatorExample.html#macop.evaluators.EvaluatorExample.evaluatorExample">[docs]</a><span class="k">def</span> <span class="nf">evaluatorExample</span><span class="p">(</span><span class="n">_solution</span><span class="p">):</span>
|
|
|
<span class="sd">"""</span>
|
|
|
<span class="sd"> Evaluator's example of solution to compute fitness</span>
|
|
|
|
|
|
<span class="sd"> Args:</span>
|
|
|
-<span class="sd"> solution ([type]): [description]</span>
|
|
|
+<span class="sd"> _solution: {Solution} -- solution to evaluate</span>
|
|
|
|
|
|
<span class="sd"> Returns:</span>
|
|
|
-<span class="sd"> [type]: [description]</span>
|
|
|
+<span class="sd"> {float} -- fitness score of solution</span>
|
|
|
<span class="sd"> """</span>
|
|
|
<span class="n">fitness</span> <span class="o">=</span> <span class="mi">0</span>
|
|
|
- <span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">elem</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">solution</span><span class="o">.</span><span class="n">data</span><span class="p">):</span>
|
|
|
+ <span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">elem</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">_solution</span><span class="o">.</span><span class="n">data</span><span class="p">):</span>
|
|
|
<span class="n">fitness</span> <span class="o">=</span> <span class="n">fitness</span> <span class="o">+</span> <span class="p">(</span><span class="n">elem</span> <span class="o">*</span> <span class="n">index</span><span class="p">)</span>
|
|
|
|
|
|
<span class="k">return</span> <span class="n">fitness</span></div>
|