source: cpp/geno_fx/html/geno__fx_8h-source.html @ 7

Last change on this file since 7 was 3, checked in by Maciej Komosinski, 16 years ago

added geno_fx, a base class for genetic operations on genotypes

File size: 11.8 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3<title>geno_fx.h Source File</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5</head><body>
6<!-- Generated by Doxygen 1.2.17 -->
7<center>
8<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
9<hr><h1>geno_fx.h</h1><a href="geno__fx_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">// This file is a part of Framsticks GenoFX library.</span>
1000002 <span class="comment">// Copyright (C) 2002  Maciej Komosinski.  See LICENSE.txt for details.</span>
1100003 <span class="comment">// Refer to http://www.frams.alife.pl/ for further information.</span>
1200004
1300005 <span class="preprocessor">#ifndef _GENO_FX_H_</span>
1400006 <span class="preprocessor"></span><span class="preprocessor">#define _GENO_FX_H_</span>
1500007 <span class="preprocessor"></span>
1600008 <span class="preprocessor">#include "nonstd.h"</span>
1700009 <span class="preprocessor">#include "modelparts.h"</span>
1800010
19<a name="l00015"></a><a class="code" href="geno__fx_8h.html#a0">00015</a> <span class="preprocessor">#define GENOPER_OK          0 </span>
20<a name="l00016"></a><a class="code" href="geno__fx_8h.html#a1">00016</a> <span class="preprocessor">#define GENOPER_OPFAIL     -1 </span>
21<a name="l00017"></a><a class="code" href="geno__fx_8h.html#a2">00017</a> <span class="preprocessor">#define GENOPER_REPAIR     -2 </span>
22<a name="l00018"></a><a class="code" href="geno__fx_8h.html#a3">00018</a> <span class="preprocessor">#define GENOPER_NOOPER     -3 </span>
2300019 <span class="preprocessor"></span>
2400020 <span class="preprocessor"></span>
2500021 <span class="preprocessor"></span>
26<a name="l00023"></a><a class="code" href="geno__fx_8h.html#a4">00023</a> <span class="preprocessor">#define GENSTYLE_NONE       0 </span>
27<a name="l00024"></a><a class="code" href="geno__fx_8h.html#a5">00024</a> <span class="preprocessor">#define GENSTYLE_INVALID    1 </span>
28<a name="l00025"></a><a class="code" href="geno__fx_8h.html#a6">00025</a> <span class="preprocessor">#define GENSTYLE_BOLD       2 </span>
29<a name="l00026"></a><a class="code" href="geno__fx_8h.html#a7">00026</a> <span class="preprocessor">#define GENSTYLE_ITALIC     4 </span>
30<a name="l00027"></a><a class="code" href="geno__fx_8h.html#a8">00027</a> <span class="preprocessor">#define GENSTYLE_STRIKEOUT  8 </span>
3100028 <span class="preprocessor">//UNDERLINE used to mark errors</span>
3200029 <span class="preprocessor"></span>
3300030
3400033 <span class="preprocessor">#define GENRGB(r,g,b) ((unsigned long)(((unsigned char)(r)|((unsigned short)((unsigned char)(g))&lt;&lt;8))|(((unsigned long)(unsigned char)(b))&lt;&lt;16)))</span>
3500034 <span class="preprocessor"></span><span class="preprocessor">#define GENSTYLE_RGBS(r,g,b,s) ((unsigned long)((unsigned char)s)&lt;&lt;24 | GENRGB(r,g,b))</span>
3600035 <span class="preprocessor"></span><span class="preprocessor">#define GENSTYLE_CS(rgb,s) ((unsigned long)((unsigned char)s)&lt;&lt;24 | rgb)</span>
3700036 <span class="preprocessor"></span>
3800037 <span class="preprocessor">#define GENGETSTYLE(style) ((style)&gt;&gt;24)</span>
3900038 <span class="preprocessor"></span><span class="preprocessor">#define GENGETCOLOR(style) ((style)&amp;0x00ffffff)</span>
4000039 <span class="preprocessor"></span>
41<a name="l00040"></a><a class="code" href="geno__fx_8h.html#a14">00040</a> <span class="preprocessor">#define GENCOLOR_TEXT    GENRGB(0,0,0) </span>
42<a name="l00041"></a><a class="code" href="geno__fx_8h.html#a15">00041</a> <span class="preprocessor">#define GENCOLOR_NUMBER  GENRGB(200,0,0) </span>
4300042 <span class="preprocessor"></span>
4400043 <span class="preprocessor"></span>
4500044 <span class="preprocessor"></span>
4600045
47<a name="l00075"></a><a class="code" href="classGeno__fx.html">00075</a> <span class="keyword">class </span><a class="code" href="classGeno__fx.html">Geno_fx</a>
4800076 {
4900077  <span class="keyword">public</span>:
5000078    Param par;
51<a name="l00079"></a><a class="code" href="classGeno__fx.html#m1">00079</a>    <span class="keywordtype">char</span> <a class="code" href="classGeno__fx.html#m1">supported_format</a>;
52<a name="l00080"></a><a class="code" href="classGeno__fx.html#m2">00080</a>    SString <a class="code" href="classGeno__fx.html#m2">name</a>;
5300081    <a class="code" href="classGeno__fx.html">Geno_fx</a>() : par(empty_paramtab) {<a class="code" href="classGeno__fx.html#m1">supported_format</a>=<span class="charliteral">'x'</span>; <a class="code" href="classGeno__fx.html#m2">name</a>=<span class="stringliteral">"Default"</span>;}
5400082
55<a name="l00087"></a><a class="code" href="classGeno__fx.html#a1">00087</a>    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#a1">checkValidity</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *geno) {<span class="keywordflow">return</span> <a class="code" href="geno__fx_8h.html#a3">GENOPER_NOOPER</a>;}
5600088
57<a name="l00094"></a><a class="code" href="classGeno__fx.html#a2">00094</a>    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#a2">validate</a>(<span class="keywordtype">char</span> *&amp;geno) {<span class="keywordflow">return</span> <a class="code" href="geno__fx_8h.html#a3">GENOPER_NOOPER</a>;}
5800095
59<a name="l00127"></a><a class="code" href="classGeno__fx.html#a3">00127</a>    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#a3">mutate</a>(<span class="keywordtype">char</span> *&amp;geno,<span class="keywordtype">float</span>&amp; chg) {<span class="keywordflow">return</span> <a class="code" href="geno__fx_8h.html#a3">GENOPER_NOOPER</a>;}
6000128
61<a name="l00144"></a><a class="code" href="classGeno__fx.html#a4">00144</a>    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#a4">crossOver</a>(<span class="keywordtype">char</span> *&amp;g1,<span class="keywordtype">char</span> *&amp;g2,<span class="keywordtype">float</span>&amp; chg1,<span class="keywordtype">float</span>&amp; chg2) {<span class="keywordflow">return</span> <a class="code" href="geno__fx_8h.html#a3">GENOPER_NOOPER</a>;}
6200145
63<a name="l00147"></a><a class="code" href="classGeno__fx.html#a5">00147</a>    <span class="keyword">virtual</span> <span class="keywordtype">char</span>* <a class="code" href="classGeno__fx.html#a5">getSimplest</a>() {<span class="keywordflow">return</span> NULL;}
6400148
65<a name="l00155"></a><a class="code" href="classGeno__fx.html#a6">00155</a>    <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classGeno__fx.html#a6">style</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *geno,<span class="keywordtype">int</span> pos) {<span class="keywordflow">return</span> GENSTYLE_RGBS(0,0,0,<a class="code" href="geno__fx_8h.html#a4">GENSTYLE_NONE</a>);}
6600156
67<a name="l00158"></a><a class="code" href="classGeno__fx.html#a7">00158</a>    <span class="keyword">virtual</span> <span class="keywordtype">float</span> <a class="code" href="classGeno__fx.html#a7">similarity</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>*,<span class="keyword">const</span> <span class="keywordtype">char</span>*) {<span class="keywordflow">return</span> <a class="code" href="geno__fx_8h.html#a3">GENOPER_NOOPER</a>;}
6800159    <span class="keyword">virtual</span> ~<a class="code" href="classGeno__fx.html">Geno_fx</a>() {}
6900160 <span class="comment">//   virtual char getFormat() {return 255;} //returns supported genotype format, for ex. '1'</span>
7000161 <span class="comment">//   virtual int enabled() {return 1;} // should be enabled by default</span>
7100162
7200165         <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#z7_0">roulette</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> *probtab,<span class="keywordtype">int</span> count);   
7300166    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classGeno__fx.html#z7_1">getMinMaxDef</a>(ParamInterface *p,<span class="keywordtype">int</span> propindex,<span class="keywordtype">double</span> &amp;mn,<span class="keywordtype">double</span> &amp;mx,<span class="keywordtype">double</span> &amp;def);
7400167    <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#z7_2">selectRandomProperty</a>(Neuro* n);
7500168    <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classGeno__fx.html#z7_3">mutateNeuProperty</a>(<span class="keywordtype">double</span> current,Neuro *n,<span class="keywordtype">int</span> propindex);
7600169    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classGeno__fx.html#z7_4">mutateProperty</a>(ParamInterface &amp;p,<span class="keywordtype">int</span> propindex);
7700170    <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classGeno__fx.html#z7_5">mutateValue</a>(<span class="keywordtype">double</span> current,<span class="keywordtype">double</span> vmin,<span class="keywordtype">double</span> vmax);
7800171    <span class="keyword">static</span> NeuroClass* <a class="code" href="classGeno__fx.html#z7_6">getRandomNeuroClass</a>();
7900172    <span class="keyword">static</span> NeuroClass* <a class="code" href="classGeno__fx.html#z7_7">parseNeuroClass</a>(<span class="keywordtype">char</span> *&amp;s);
8000173    <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classGeno__fx.html#z7_8">neuroClassProp</a>(<span class="keywordtype">char</span> *&amp;s,NeuroClass *nc,<span class="keywordtype">bool</span> also_v1_N_props=<span class="keyword">false</span>);
8100174    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classGeno__fx.html#z7_9">isWS</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> c);
8200175    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classGeno__fx.html#z7_10">skipWS</a>(<span class="keywordtype">char</span> *&amp;s);
8300176    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classGeno__fx.html#z7_11">areAlike</a>(<span class="keywordtype">char</span>*,<span class="keywordtype">char</span>*);
8400177         <span class="keyword">static</span> <span class="keywordtype">char</span>* <a class="code" href="classGeno__fx.html#z7_12">strchrn0</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *str,<span class="keywordtype">char</span> ch);
8500178    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classGeno__fx.html#z7_13">isNeuroClassName</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> firstchar);
8600179
8700180 };
8800181
8900182
9000183 <span class="preprocessor">#endif</span>
9100184 <span class="preprocessor"></span>
92</pre></div><hr><address style="align: right;"><small>Generated on Sun Sep 15 00:58:39 2002 for Framsticks GenoFX by
93<a href="http://www.doxygen.org/index.html">
94<img src="doxygen.png" alt="doxygen" align="middle" border=0
95width=110 height=53></a>1.2.17 </small></address>
96</body>
97</html>
Note: See TracBrowser for help on using the repository browser.