This file is indexed.

/usr/share/doc/python-pyevolve-doc/html/module_functionslot.html is in python-pyevolve-doc 0.6~rc1+svn398+dfsg-7.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>FunctionSlot – function slots module &mdash; Pyevolve 0.6 final documentation</title>
    
    <link rel="stylesheet" href="_static/default_patch.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.6 final',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Pyevolve 0.6 final documentation" href="index.html" />
    <link rel="up" title="pyevolve – the main pyevolve namespace" href="module_pyevolve.html" />
    <link rel="next" title="Statistics – statistical structure module" href="module_statistics.html" />
    <link rel="prev" title="DBAdapters – database adapters for statistics" href="module_dbadapters.html" />

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="module_statistics.html" title="Statistics – statistical structure module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="module_dbadapters.html" title="DBAdapters – database adapters for statistics"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Pyevolve 0.6 final documentation</a> &raquo;</li>
          <li><a href="modules.html" >Modules</a> &raquo;</li>
          <li><a href="module_pyevolve.html" accesskey="U"><tt class="docutils literal"><span class="pre">pyevolve</span></tt> &#8211; the main pyevolve namespace</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">

      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-FunctionSlot"></span><div class="section" id="functionslot-function-slots-module">
<h1><a class="reference internal" href="#module-FunctionSlot" title="FunctionSlot"><tt class="xref py py-mod docutils literal"><span class="pre">FunctionSlot</span></tt></a> &#8211; function slots module<a class="headerlink" href="#functionslot-function-slots-module" title="Permalink to this headline"></a></h1>
<p>The <em>function slot</em> concept is large used by Pyevolve, the idea
is simple, each genetic operator or any operator, can be assigned
to a slot, by this way, we can add more than simple one operator,
we can have for example, two or more mutator operators at same time,
two or more evaluation functions, etc. In this <a class="reference internal" href="#module-FunctionSlot" title="FunctionSlot"><tt class="xref py py-mod docutils literal"><span class="pre">FunctionSlot</span></tt></a> module,
you&#8217;ll find the class <a class="reference internal" href="#FunctionSlot.FunctionSlot" title="FunctionSlot.FunctionSlot"><tt class="xref py py-class docutils literal"><span class="pre">FunctionSlot.FunctionSlot</span></tt></a>, which is the slot class.</p>
<dl class="class">
<dt id="FunctionSlot.FunctionSlot">
<em class="property">class </em><tt class="descclassname">FunctionSlot.</tt><tt class="descname">FunctionSlot</tt><big>(</big><em>name='Anonymous Function'</em>, <em>rand_apply=False</em><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot" title="Permalink to this definition"></a></dt>
<dd><p>FunctionSlot Class - The function slot</p>
<dl class="docutils">
<dt>Example:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">eval_func</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">&lt;function eval_func at 0x018C8930&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span>
<span class="go">Slot [Evaluation Function] (Count: 1)</span>
<span class="go">          Name: eval_func</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span>
<span class="go">Slot [Evaluation Function] (Count: 0)</span>
<span class="go">          No function</span>
</pre></div>
</div>
</dd>
<dt>You can add weight to functions when using the <cite>rand_apply</cite> paramter:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">eval_main</span><span class="p">,</span> <span class="mf">0.9</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">eval_sec</span><span class="p">,</span>  <span class="mf">0.3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span><span class="o">.</span><span class="n">setRandomApply</span><span class="p">()</span>
</pre></div>
</div>
</dd>
</dl>
<p>In the above example, the function <em>eval_main</em> will be called with 90% of
probability and the <em>eval_sec</em> will be called with 30% of probability.</p>
<dl class="docutils">
<dt>There are another way to add functions too:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">genome</span><span class="o">.</span><span class="n">evaluator</span> <span class="o">+=</span> <span class="n">eval_func</span>
</pre></div>
</div>
</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> &#8211; the slot name</li>
<li><strong>rand_apply</strong> &#8211; if True, just one of the functions in the slot
will be applied, this function is randomly picked based
on the weight of the function added.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="FunctionSlot.FunctionSlot.add">
<tt class="descname">add</tt><big>(</big><em>func</em>, <em>weight=0.5</em><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.add" title="Permalink to this definition"></a></dt>
<dd><p>Used to add a function to the slot</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>func</strong> &#8211; the function to be added in the slot</li>
<li><strong>weight</strong> &#8211; used when you enable the <em>random apply</em>, it&#8217;s the weight
of the function for the random selection</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6: </span>The <cite>weight</cite> parameter.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="FunctionSlot.FunctionSlot.apply">
<tt class="descname">apply</tt><big>(</big><em>index</em>, <em>obj</em>, <em>**args</em><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.apply" title="Permalink to this definition"></a></dt>
<dd><p>Apply the index function</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>index</strong> &#8211; the index of the function</li>
<li><strong>obj</strong> &#8211; this object is passes as parameter to the function</li>
<li><strong>args</strong> &#8211; this args dictionary is passed to the function</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="FunctionSlot.FunctionSlot.applyFunctions">
<tt class="descname">applyFunctions</tt><big>(</big><em>obj=None</em>, <em>**args</em><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.applyFunctions" title="Permalink to this definition"></a></dt>
<dd><p>Generator to apply all function slots in obj</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>obj</strong> &#8211; this object is passes as parameter to the function</li>
<li><strong>args</strong> &#8211; this args dictionary is passed to the function</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="FunctionSlot.FunctionSlot.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.clear" title="Permalink to this definition"></a></dt>
<dd><p>Used to clear the functions in the slot</p>
</dd></dl>

<dl class="method">
<dt id="FunctionSlot.FunctionSlot.isEmpty">
<tt class="descname">isEmpty</tt><big>(</big><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.isEmpty" title="Permalink to this definition"></a></dt>
<dd><p>Return true if the function slot is empy</p>
</dd></dl>

<dl class="method">
<dt id="FunctionSlot.FunctionSlot.set">
<tt class="descname">set</tt><big>(</big><em>func</em>, <em>weight=0.5</em><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.set" title="Permalink to this definition"></a></dt>
<dd><p>Used to clear all functions in the slot and add one</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>func</strong> &#8211; the function to be added in the slot</li>
<li><strong>weight</strong> &#8211; used when you enable the <em>random apply</em>, it&#8217;s the weight
of the function for the random selection</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6: </span>The <cite>weight</cite> parameter.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">the method <em>set</em> of the function slot remove all previous
functions added to the slot.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="FunctionSlot.FunctionSlot.setRandomApply">
<tt class="descname">setRandomApply</tt><big>(</big><em>flag=True</em><big>)</big><a class="headerlink" href="#FunctionSlot.FunctionSlot.setRandomApply" title="Permalink to this definition"></a></dt>
<dd><p>Sets the random function application, in this mode, the
function will randomly choose one slot to apply</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>flag</strong> &#8211; True or False</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">

  <h4>Previous topic</h4>
  <p class="topless"><a href="module_dbadapters.html"
                        title="previous chapter"><tt class="docutils literal"><span class="pre">DBAdapters</span></tt> &#8211; database adapters for statistics</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="module_statistics.html"
                        title="next chapter"><tt class="docutils literal"><span class="pre">Statistics</span></tt> &#8211; statistical structure module</a></p>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>

        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="module_statistics.html" title="Statistics – statistical structure module"
             >next</a> |</li>
        <li class="right" >
          <a href="module_dbadapters.html" title="DBAdapters – database adapters for statistics"
             >previous</a> |</li>
        <li><a href="index.html">Pyevolve 0.6 final documentation</a> &raquo;</li>
          <li><a href="modules.html" >Modules</a> &raquo;</li>
          <li><a href="module_pyevolve.html" ><tt class="docutils literal"><span class="pre">pyevolve</span></tt> &#8211; the main pyevolve namespace</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2010, Christian S. Perone.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>