aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/classifier_8cpp-source.html
blob: ea3ec53d593419fdcc440f91ea057f6f3c9e91c4 (plain)
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</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="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>classifier.cpp</h1><a href="classifier_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="classifier_8h.html">nel/ai/nimat/classifier.h</a>"</font>
00027 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
00028 
00029 <font class="keyword">namespace </font>NLAINIMAT
00030 {
00031 
00033 <font class="comment">// CClassifierSystem</font>
00035 <font class="comment"></font>
<a name="l00036"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a0">00036</a> CClassifierSystem::CClassifierSystem()
00037 {
00038 }
00039 
<a name="l00040"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a1">00040</a> CClassifierSystem::~CClassifierSystem()
00041 {
00042         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifier*&gt;</a>::iterator itClassifiers = <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.begin();
00043         <font class="keywordflow">while</font> (itClassifiers != <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.end())
00044         {
00045                 <font class="keyword">delete</font> (*itClassifiers);
00046                 itClassifiers++;
00047         }
00048 }
00049 
<a name="l00050"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a2">00050</a> <font class="keywordtype">void</font> CClassifierSystem::addClassifier(<font class="keyword">const</font> <a class="code" href="namespaceNLAINIMAT.html#a3">TSensorMap</a> &amp;conditionsMap, sint16 priority, <font class="keyword">const</font> <font class="keywordtype">char</font>* behavior)
00051 {
00052         <font class="comment">// We build a new classifier.</font>
00053         CClassifier* classifier = <font class="keyword">new</font> CClassifier();
00054         classifier-&gt;Behavior = behavior;
00055         classifier-&gt;Priority = priority;
00056 
00057         CClassifierConditionCell* condCell;
00058         std::map&lt;std::string, char&gt;::const_iterator itCondition;
00059         <font class="keywordflow">for</font> (itCondition = conditionsMap.begin(); itCondition != conditionsMap.end(); itCondition++)
00060         {
00061                 <font class="comment">// We add the new sensor in the sensor map and init it with a joker value '#'</font>
00062                 <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o0">_sensors</a>[(*itCondition).first] = <font class="charliteral">'#'</font>;
00063 
00064                 <font class="comment">// A new condition cell is added to the classifier condition.</font>
00065                 condCell = <font class="keyword">new</font> CClassifierConditionCell(<a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o0">_sensors</a>.find((*itCondition).first), (*itCondition).second);
00066                 classifier-&gt;Condition.push_back(condCell);
00067         }
00068 
00069         <font class="comment">// The new classifier is added to the classifier list.</font>
00070         <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.push_back(classifier);
00071 }
00072 
<a name="l00074"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a3">00074</a> <font class="keywordtype">void</font> CClassifierSystem::addClassifierSystem(<font class="keyword">const</font> CClassifierSystem &amp;cs)
00075 {
00076         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifier*&gt;</a>::const_iterator itCSClassifiers;
00077         <font class="keywordflow">for</font> (itCSClassifiers = cs._classifiers.begin(); itCSClassifiers != cs._classifiers.end(); itCSClassifiers++)
00078         {
00079                 <a class="code" href="namespaceNLAINIMAT.html#a3">TSensorMap</a> conditionsMap;
00080 
00081                 <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifierConditionCell*&gt;</a>::const_iterator itCondCell;
00082                 <font class="keywordflow">for</font> (itCondCell = (*itCSClassifiers)-&gt;Condition.begin(); itCondCell !=(*itCSClassifiers)-&gt;Condition.end(); itCondCell++)
00083                 {
00084                         CClassifierConditionCell* pCondCell = (*itCondCell);
00085                         conditionsMap[pCondCell-&gt;getSensorName()] = pCondCell-&gt;getValue();
00086                 }
00087                 <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a2">addClassifier</a>(conditionsMap, (*itCSClassifiers)-&gt;Priority, (*itCSClassifiers)-&gt;Behavior.c_str());
00088         }
00089 }
00090 
<a name="l00091"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a4">00091</a> std::string CClassifierSystem::selectBehavior( <font class="keyword">const</font> <a class="code" href="namespaceNLAINIMAT.html#a3">TSensorMap</a> &amp;sensorMap)
00092 {
00093         <font class="comment">// We update the internal sensor values.</font>
00094         std::map&lt;std::string, char&gt;::const_iterator itConditionsmap;
00095         <font class="keywordflow">for</font> (itConditionsmap = sensorMap.begin(); itConditionsmap != sensorMap.end(); itConditionsmap++)
00096         {
00097                 <font class="keywordtype">char</font> c =  (*itConditionsmap).second;
00098                 std::string sensName = (*itConditionsmap).first;
00099                 <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o0">_sensors</a>[sensName ] = c;
00100                 <font class="keywordtype">int</font> size = <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o0">_sensors</a>.size();
00101         }
00102 
00103         <font class="comment">// We select the activables classifiers</font>
00104         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifier*&gt;</a> activableList;
00105         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifier*&gt;</a>::iterator itClassifiers = <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.begin();
00106         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifierConditionCell*&gt;</a>::iterator itConditions;
00107         <font class="keywordtype">bool</font> activable;
00108         <font class="keywordtype">int</font> totalPriority = 0;
00109 
00110         <font class="keywordflow">while</font> (itClassifiers != <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.end())
00111         {
00112                 activable = <font class="keyword">true</font>;
00113                 itConditions = (*itClassifiers)-&gt;Condition.begin();
00114                 <font class="keywordflow">while</font> (itConditions != (*itClassifiers)-&gt;Condition.end())
00115                 {
00116                         <font class="keywordflow">if</font> (! (*itConditions)-&gt;isActivable() )
00117                         {
00118                                 activable = <font class="keyword">false</font>;
00119                                 <font class="keywordflow">break</font>;
00120                         }
00121                         itConditions++;
00122                 }
00123                 <font class="keywordflow">if</font> (activable)
00124                 {
00125                         activableList.push_back(*itClassifiers);
00126                         totalPriority += (*itClassifiers)-&gt;Priority;
00127                 }
00128                 itClassifiers++;
00129         }
00130 
00131         <font class="comment">// We set the sensors back to the default value.</font>
00132         <font class="keywordflow">for</font> (itConditionsmap = sensorMap.begin(); itConditionsmap != sensorMap.end(); itConditionsmap++)
00133         {
00134                 <font class="keywordtype">char</font> c =  (*itConditionsmap).second;
00135                 std::string sensName = (*itConditionsmap).first;
00136                 <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o0">_sensors</a>[sensName ] = <font class="charliteral">'#'</font>;
00137                 <font class="keywordtype">int</font> size = <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o0">_sensors</a>.size();
00138         }
00139 
00140         <font class="comment">// We select a classifier in the active classifier with a roullette wheel random.</font>
00141         <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> = rand() * totalPriority;
00142         <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> /= RAND_MAX;
00143         itClassifiers = activableList.begin();
00144         <font class="keywordflow">while</font> (itClassifiers != activableList.end())
00145         {
00146                 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> -= (*itClassifiers)-&gt;Priority;
00147                 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>&lt;=0)
00148                 {
00149                         <font class="keywordflow">return</font> (*itClassifiers)-&gt;Behavior;
00150                 }
00151                 itClassifiers++;
00152         }
00153 
00154         <font class="comment">// If no classifier is activable, we send a default joker value '#'</font>
00155         <font class="keywordflow">return</font> <font class="stringliteral">"#"</font>;
00156 }
00157 
<a name="l00158"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#a5">00158</a> <font class="keywordtype">void</font> CClassifierSystem::getDebugString(std::string &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)<font class="keyword"> const</font>
00159 <font class="keyword"></font>{
00160         std::string dbg = <font class="stringliteral">"\n"</font>;
00161 
00162         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifier*&gt;</a>::const_iterator itClassifiers;
00163         <font class="keywordflow">for</font> (itClassifiers = <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.begin(); itClassifiers != <a class="code" href="classNLAINIMAT_1_1CClassifierSystem.html#o1">_classifiers</a>.end(); itClassifiers++)
00164         {
00165                 <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifierConditionCell*&gt;</a>::const_iterator itConditions;
00166                 <font class="keywordflow">for</font> (itConditions = (*itClassifiers)-&gt;Condition.begin(); itConditions != (*itClassifiers)-&gt;Condition.end(); itConditions++)
00167                 {
00168                         CClassifierConditionCell* condCell = (*itConditions);
00169                         dbg += <font class="stringliteral">" ("</font> + condCell-&gt;getSensorName() + <font class="stringliteral">"="</font> + condCell-&gt;getValue() + <font class="stringliteral">") +"</font>;
00170                 }
00171                 std::string actionName = (*itClassifiers)-&gt;Behavior;
00172                 sint16          prio = (*itClassifiers)-&gt;Priority;
00173                 dbg += <font class="stringliteral">"&gt; "</font> + actionName + <font class="stringliteral">" ["</font> + <a class="code" href="namespaceNLMISC.html#a243">NLMISC::toString</a>(prio) + <font class="stringliteral">"]\n"</font>;
00174         }
00175         <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a> += dbg;
00176 }
00177 
00179 <font class="comment">// CClassifier</font>
00181 <font class="comment"></font>
<a name="l00182"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifier.html#a0">00182</a> CClassifierSystem::CClassifier::CClassifier()
00183 {
00184 }
00185 
<a name="l00186"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifier.html#a1">00186</a> CClassifierSystem::CClassifier::~CClassifier()
00187 {
00188         <a class="code" href="classstd_1_1list.html">std::list&lt;CClassifierConditionCell*&gt;</a>::iterator itConditions = <a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifier.html#m0">Condition</a>.begin();
00189         <font class="keywordflow">while</font> (itConditions != <a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifier.html#m0">Condition</a>.end())
00190         {
00191                 <font class="keyword">delete</font> (*itConditions );
00192                 itConditions++;
00193         }
00194 }
00195 
00197 <font class="comment">// CClassifierConditionCell</font>
00199 <font class="comment"></font>
<a name="l00200"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#a0">00200</a> CClassifierSystem::CClassifierConditionCell::CClassifierConditionCell(TSensorMap::const_iterator itSensor, <font class="keywordtype">char</font> <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
00201 {
00202         <a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#o0">_itSensor</a> = itSensor;
00203         <a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#o1">_value</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>;
00204 }
00205 
<a name="l00206"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#a1">00206</a> <font class="keywordtype">bool</font> CClassifierSystem::CClassifierConditionCell::isActivable()<font class="keyword"> const</font>
00207 <font class="keyword"></font>{
00208         <font class="keywordflow">if</font> ((*_itSensor).second == <a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#o1">_value</a>)
00209                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00210         <font class="keywordflow">else</font>
00211                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00212 }
00213 
<a name="l00214"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#a2">00214</a> std::string CClassifierSystem::CClassifierConditionCell::getSensorName()<font class="keyword"> const</font>
00215 <font class="keyword"></font>{
00216         <font class="keywordflow">return</font> (*_itSensor).first;
00217 }
00218 
<a name="l00219"></a><a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#a3">00219</a> <font class="keywordtype">char</font> CClassifierSystem::CClassifierConditionCell::getValue()
00220 {
00221         <font class="keywordflow">return</font> <a class="code" href="classNLAINIMAT_1_1CClassifierSystem_1_1CClassifierConditionCell.html#o1">_value</a>;
00222 }
00223 
00225 <font class="comment">// CActionCS</font>
<a name="l00227"></a><a class="code" href="classNLAINIMAT_1_1CActionCS.html#a0">00227</a> <font class="comment">CActionCS::CActionCS(std::string name)</font>
00228 {
00229         _Name = name;
00230 }
00231 
<a name="l00232"></a><a class="code" href="classNLAINIMAT_1_1CActionCS.html#a1">00232</a> CActionCS::~CActionCS()
00233 {
00234 }
00235 
<a name="l00237"></a><a class="code" href="classNLAINIMAT_1_1CActionCS.html#a2">00237</a> std::string <a class="code" href="zone__lighter_8cpp.html#a11">CActionCS::getName</a>()<font class="keyword"> const</font>
00238 <font class="keyword"></font>{
00239         <font class="keywordflow">return</font> <a class="code" href="classNLAINIMAT_1_1CActionCS.html#o1">_Name</a>;
00240 }
00241 
<a name="l00243"></a><a class="code" href="classNLAINIMAT_1_1CActionCS.html#a3">00243</a> <font class="keywordtype">void</font> CActionCS::addMotivationRule (std::string motivationName, <font class="keyword">const</font> <a class="code" href="namespaceNLAINIMAT.html#a3">TSensorMap</a> &amp;conditionsMap, sint16 priority)
00244 {
00245         CClassifierSystem* pCS;
00246 
00247         pCS = &amp;(<a class="code" href="classNLAINIMAT_1_1CActionCS.html#o0">_ClassifiersByMotivation</a>[motivationName]);
00248         pCS-&gt;addClassifier(conditionsMap, priority, <a class="code" href="classNLAINIMAT_1_1CActionCS.html#o1">_Name</a>.c_str());
00249 }
00250 
<a name="l00251"></a><a class="code" href="classNLAINIMAT_1_1CActionCS.html#a5">00251</a> <font class="keyword">const</font> std::map&lt;std::string, CClassifierSystem&gt; *CActionCS::getClassifiersMap ()<font class="keyword"> const</font>
00252 <font class="keyword"></font>{
00253         <font class="keywordflow">return</font> &amp;<a class="code" href="classNLAINIMAT_1_1CActionCS.html#o0">_ClassifiersByMotivation</a>;
00254 }
00255 
00256 
<a name="l00258"></a><a class="code" href="classNLAINIMAT_1_1CActionCS.html#a4">00258</a> <font class="keywordtype">void</font> CActionCS::getDebugString(std::string &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)<font class="keyword"> const</font>
00259 <font class="keyword"></font>{
00260         std::string ret = <font class="stringliteral">"\nACTION :\t"</font> + <a class="code" href="classNLAINIMAT_1_1CActionCS.html#o1">_Name</a> + <font class="stringliteral">"\n"</font>;
00261         std::map&lt;std::string, CClassifierSystem&gt;::const_iterator ItClassifiersByMotivation;
00262         <font class="keywordflow">for</font> (ItClassifiersByMotivation = <a class="code" href="classNLAINIMAT_1_1CActionCS.html#o0">_ClassifiersByMotivation</a>.begin(); ItClassifiersByMotivation != <a class="code" href="classNLAINIMAT_1_1CActionCS.html#o0">_ClassifiersByMotivation</a>.end(); ItClassifiersByMotivation++)
00263         {
00264                 ret += <font class="stringliteral">"\nMotivation : "</font> + (*ItClassifiersByMotivation).first + <font class="stringliteral">"\n"</font>;
00265                 (*ItClassifiersByMotivation).second.getDebugString(ret);
00266         }
00267         <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>+=ret;
00268 }
00269 
00270 
00272 <font class="comment">// CMotivationEnergy</font>
<a name="l00274"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a0">00274</a> <font class="comment">CMotivationEnergy::CMotivationEnergy()</font>
00275 {
00276         _SumValue = 0;
00277 }
00278 
<a name="l00279"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a1">00279</a> CMotivationEnergy::~CMotivationEnergy()
00280 {
00281 }
00282 
<a name="l00283"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a2">00283</a> sint16 CMotivationEnergy::getSumValue()<font class="keyword"> const</font>
00284 <font class="keyword"></font>{
00285         <font class="keywordflow">return</font> <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o0">_SumValue</a>;
00286 }
00287 
<a name="l00288"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a3">00288</a> <font class="keywordtype">void</font>    CMotivationEnergy::removeProvider(std::string providerName)
00289 {
00290         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o1">_MotivationProviders</a>.erase(providerName);
00291         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#c0">computeMotivationValue</a>();
00292 }
00293 
<a name="l00294"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a4">00294</a> <font class="keywordtype">void</font>    CMotivationEnergy::addProvider(std::string providerName, <font class="keyword">const</font> CMotivationEnergy&amp; providerMotivation)
00295 {
00296         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o1">_MotivationProviders</a>[providerName] = providerMotivation._EnergyByMotivation ;
00297         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#c0">computeMotivationValue</a>();
00298 }
00299 
<a name="l00300"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#c0">00300</a> <font class="keywordtype">void</font>    CMotivationEnergy::computeMotivationValue()
00301 {
00302         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.clear();
00303         std::map&lt;std::string, TEnergyByMotivation&gt;::iterator itMotivationProviders;
00304 
00305         <font class="keywordflow">for</font> (itMotivationProviders = <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o1">_MotivationProviders</a>.begin(); itMotivationProviders != <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o1">_MotivationProviders</a>.end(); itMotivationProviders++)
00306         {
00307                 <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#u0">TEnergyByMotivation</a> &amp;motivation = (*itMotivationProviders).second;
00308                 TEnergyByMotivation::iterator itMotivation, itMyMotivation;
00309                 <font class="keywordflow">for</font> (itMotivation = motivation.begin(); itMotivation != motivation.end(); itMotivation++)
00310                 {
00311                         std::string motivSource = (*itMotivation).first;
00312                         sint16 motiveValue = (*itMotivation).second.Value;
00313                         sint16 motivePP = (*itMotivation).second.PP;
00314                         itMyMotivation = <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.find(motivSource);
00315                         <font class="keywordflow">if</font> (itMyMotivation != <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.end())
00316                         {
00317                                 sint16 myMotiveValue = (*itMyMotivation).second.Value;
00318                                 <font class="keywordflow">if</font> (motiveValue &gt; myMotiveValue)
00319                                 {
00320                                         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivSource].Value = motiveValue;
00321                                         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivSource].PP = motivePP;
00322                                 }
00323                         }
00324                         <font class="keywordflow">else</font>
00325                         {
00326                                 <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivSource].Value = motiveValue;
00327                                 <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivSource].PP = motivePP;
00328                         }
00329                 }
00330         }
00331 
00332         TEnergyByMotivation::const_iterator itEnergyByMotivation;
00333         sint16 sum = 0;
00334         <font class="keywordflow">for</font> (itEnergyByMotivation = <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.begin(); itEnergyByMotivation != <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.end(); itEnergyByMotivation++)
00335         {
00336                 sum += (*itEnergyByMotivation).second.Value * (*itEnergyByMotivation).second.PP;
00337         }
00338         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o0">_SumValue</a> = sum;
00339 }
00340 
<a name="l00342"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a5">00342</a> <font class="keywordtype">void</font> CMotivationEnergy::setMotivationPP(std::string motivationName, sint16 PP)
00343 {
00344         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o0">_SumValue</a> -= <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].Value * <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].PP;
00345         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o0">_SumValue</a> += <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].Value * PP;
00346         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].PP = PP;
00347 }
00348 
<a name="l00350"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a6">00350</a> <font class="keywordtype">void</font> CMotivationEnergy::setMotivationValue(std::string motivationName, sint16 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
00351 {
00352         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o0">_SumValue</a> -= <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].Value * <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].PP;
00353         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o0">_SumValue</a> += <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> * <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].PP;
00354         <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>[motivationName].Value = <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>;
00355 }
00356 
<a name="l00358"></a><a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#a7">00358</a> <font class="keywordtype">void</font> CMotivationEnergy::getDebugString(std::string &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)<font class="keyword"> const</font>
00359 <font class="keyword"></font>{
00360         std::string ret;
00361         TEnergyByMotivation::const_iterator itEnergyByMotivation;
00362         
00363         <font class="keywordflow">for</font> (itEnergyByMotivation = <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.begin(); itEnergyByMotivation!= <a class="code" href="classNLAINIMAT_1_1CMotivationEnergy.html#o2">_EnergyByMotivation</a>.end(); itEnergyByMotivation++)
00364         {
00365                 ret += <font class="stringliteral">" Motivation source : "</font> + (*itEnergyByMotivation).first + <font class="stringliteral">" ("</font> + <a class="code" href="namespaceNLMISC.html#a243">NLMISC::toString</a>((*itEnergyByMotivation).second.Value * (*itEnergyByMotivation).second.PP) + <font class="stringliteral">")\n"</font>;
00366         }
00367         <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>+=ret;
00368 }
00369 
00371 <font class="comment">// CNetCS</font>
00373 <font class="comment"></font>
<a name="l00374"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a0">00374</a> CNetCS::CNetCS()
00375 {
00376 }
00377 
<a name="l00378"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a1">00378</a> CNetCS::~CNetCS()
00379 {
00380 }
00381 
<a name="l00382"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a3">00382</a> <font class="keywordtype">void</font> CNetCS::addVirtualActionCS(<font class="keyword">const</font> CActionCS &amp;action)
00383 {
00384         <font class="keyword">const</font> std::map&lt;std::string, CClassifierSystem&gt; *mapAction = action.getClassifiersMap();
00385         std::map&lt;std::string, CClassifierSystem&gt;::const_iterator ItMapAction;
00386         <font class="keywordflow">for</font> (ItMapAction = mapAction-&gt;begin(); ItMapAction != mapAction-&gt;end(); ItMapAction++)
00387         {
00388                 CClassifierSystem* pCS;
00389                 std::string motivationName = (*ItMapAction).first;
00390                 <font class="keyword">const</font> CClassifierSystem* pOtherCS = &amp;((*ItMapAction).second);
00391 
00392                 pCS = &amp;(<a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>[motivationName].CS);
00393                 pCS-&gt;addClassifierSystem(*pOtherCS);
00394         }
00395 }
00396 
<a name="l00397"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a2">00397</a> <font class="keywordtype">void</font> CNetCS::addActionCS(<font class="keyword">const</font> CActionCS&amp; action)
00398 {
00399         <a class="code" href="classNLAINIMAT_1_1CNetCS.html#a3">addVirtualActionCS</a>(action);
00400         CMotivationEnergy motivalue;
00401         <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>[action.getName()] = motivalue;
00402 }
00403 
00404 
<a name="l00406"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a9">00406</a> <font class="keywordtype">void</font> CNetCS::getDebugString(std::string &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)<font class="keyword"> const</font>
00407 <font class="keyword"></font>{
00408         std::string ret = <font class="stringliteral">"\n---------------------------"</font>;
00409         std::map&lt;std::string, CMotivateCS&gt;::const_iterator itClassifiers;
00410         <font class="keywordflow">for</font> (itClassifiers = <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>.begin(); itClassifiers!= <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>.end(); itClassifiers++)
00411         {
00412                 ret += <font class="stringliteral">"\nMotivation : "</font> + (*itClassifiers).first;
00413                 (*itClassifiers).second.CS.getDebugString(ret);
00414                 (*itClassifiers).second.MotivationIntensity.getDebugString(ret);
00415         }
00416         ret += <font class="stringliteral">"\nACTIONS :\n"</font>;
00417         std::map&lt;std::string, CMotivationEnergy&gt;::const_iterator itActionsExecutionIntensity;
00418         <font class="keywordflow">for</font> (itActionsExecutionIntensity = <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>.begin(); itActionsExecutionIntensity != <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>.end(); itActionsExecutionIntensity++)
00419         {
00420                 ret += (* itActionsExecutionIntensity).first + <font class="stringliteral">" :\n"</font>;
00421                 (*itActionsExecutionIntensity).second.getDebugString(ret);
00422         }
00423         <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>+=ret;
00424 }
00425 
<a name="l00427"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a4">00427</a> <font class="keywordtype">void</font> CNetCS::setMotivationPP(std::string motivationName, sint16 PP)
00428 {
00429         <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>[motivationName].MotivationIntensity.setMotivationPP(motivationName, PP);
00430 }
00431 
<a name="l00433"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a5">00433</a> <font class="keywordtype">void</font> CNetCS::setMotivationValue(std::string motivationName, sint16 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
00434 {
00435         <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>[motivationName].MotivationIntensity.setMotivationValue(motivationName, <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>);
00436 }
00437 
<a name="l00438"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a7">00438</a> <font class="keywordtype">void</font> CNetCS::run()
00439 {
00440         <font class="comment">/*</font>
00441 <font class="comment">        Je s�lectionne par roulette weel le classeur que je vais g�rer</font>
00442 <font class="comment">        Je met � jour l'�nergie du vainqueur</font>
00443 <font class="comment">        */</font>
00444         sint16 somme = 0;
00445         <font class="keyword">typedef</font> std::map&lt;std::string, CMotivateCS&gt;::iterator TitNameAndMotivation;
00446         std::map&lt;sint16, TitNameAndMotivation &gt; mapCSweel;
00447         std::map&lt;std::string, CMotivateCS&gt;::iterator itClassifiers;
00448         <font class="comment">// On calcule la somme</font>
00449         <font class="keywordflow">for</font> (itClassifiers = <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>.begin(); itClassifiers != <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>.end(); itClassifiers++)
00450         {
00451                 CMotivateCS* pCMotivateCS = &amp;((*itClassifiers).second);
00452                 sint16 energy = pCMotivateCS-&gt;MotivationIntensity.getSumValue();
00453                 <font class="keywordflow">if</font> (energy &gt; 0)
00454                 {
00455                         somme += energy;
00456                         mapCSweel[somme] = itClassifiers;
00457                 }
00458         }
00459         <font class="keywordflow">if</font> (somme&gt;0)
00460         {
00461                 <font class="comment">// on selectionne le classeur;</font>
00462                 sint16 randomeNumber = rand()%(somme);
00463                 std::map&lt;sint16, TitNameAndMotivation&gt;::iterator itMapCSweel = mapCSweel.upper_bound(randomeNumber);
00464                 CMotivateCS* pCSselection = &amp;((*((*itMapCSweel).second)).second);
00465                 std::string selectionName = (*((*itMapCSweel).second)).first;
00466 
00467                 <font class="comment">// On fait calculer le CS</font>
00468                 std::string behav = pCSselection-&gt;CS.selectBehavior(<a class="code" href="classNLAINIMAT_1_1CNetCS.html#o1">_SensorsValues</a>);
00469 
00470                 <font class="comment">// On r�cup�re le pointeur sur le modul auquel on va transmettre la motivation</font>
00471                 CMotivationEnergy* pEnergy2Evolve;
00472                 CMotivationEnergy&amp; refMyEnergy = pCSselection-&gt;MotivationIntensity;
00473                 std::map&lt;std::string, CMotivationEnergy&gt;::iterator itActionsExecutionIntensity;
00474                 itActionsExecutionIntensity = <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>.find(behav);
00475                 <font class="keywordflow">if</font> (itActionsExecutionIntensity != <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>.end())
00476                 {
00477                         pEnergy2Evolve = &amp;((*itActionsExecutionIntensity).second);
00478                 }
00479                 <font class="keywordflow">else</font>
00480                 {
00481                         std::map&lt;std::string, CMotivateCS&gt;::iterator itClassifiersAndMotivationIntensity;
00482                         itClassifiersAndMotivationIntensity = <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>.find(behav);
00483                         <a class="code" href="debug_8h.html#a6">nlassert</a> (itClassifiersAndMotivationIntensity != <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>.end()); <font class="comment">// Sinon c'est que j'ai une action qui ne correspond ni � une vrai action ni � un autre classeur.</font>
00484                         pEnergy2Evolve = &amp;((*itClassifiersAndMotivationIntensity).second.MotivationIntensity);
00485                 }
00486                 <a class="code" href="debug_8h.html#a6">nlassert</a>(pEnergy2Evolve);
00487 
00488                 <font class="comment">// On change la valeur de motivation de la cible.</font>
00489                 <font class="comment">// 1) on retire son �nergie au pr�c�dent truc</font>
00490                 <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o0">_ClassifiersAndMotivationIntensity</a>[pCSselection-&gt;LastMotivedAction].MotivationIntensity.removeProvider(selectionName);
00491 
00492                 <font class="comment">// 2) on rajoute notre �nergie au nouveau.</font>
00493                 pEnergy2Evolve-&gt;addProvider(selectionName, refMyEnergy);
00494                 
00495         }
00496 }
00497 
<a name="l00498"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a8">00498</a> <font class="keywordtype">void</font> CNetCS::setSensors(<font class="keyword">const</font> <a class="code" href="namespaceNLAINIMAT.html#a3">TSensorMap</a> &amp;sensorMap)
00499 {
00500         <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o1">_SensorsValues</a> = sensorMap;
00501 }
00502 
00503 
<a name="l00504"></a><a class="code" href="classNLAINIMAT_1_1CNetCS.html#a6">00504</a> std::string CNetCS::selectBehavior()
00505 {
00506         <font class="comment">// On prend le max</font>
00507         std::string ret = <font class="stringliteral">""</font>;
00508         sint16 executionIntensity = 0;
00509         std::map&lt;std::string, CMotivationEnergy&gt;::iterator itActionsExecutionIntensity;
00510         <font class="keywordflow">for</font> (itActionsExecutionIntensity = <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>.begin(); itActionsExecutionIntensity != <a class="code" href="classNLAINIMAT_1_1CNetCS.html#o2">_ActionsExecutionIntensity</a>.end(); itActionsExecutionIntensity++)
00511         {
00512                 sint16 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (*itActionsExecutionIntensity).second.getSumValue();
00513                 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> &gt; executionIntensity)
00514                 {
00515                         ret = (*itActionsExecutionIntensity).first;
00516                 }
00517         }
00518         <font class="keywordflow">return</font> ret;
00519 }
00520 
00521 
00522 } <font class="comment">// NLAINIMAT</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>