From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02926.html | 1699 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1699 insertions(+) create mode 100644 docs/doxygen/nel/a02926.html (limited to 'docs/doxygen/nel/a02926.html') diff --git a/docs/doxygen/nel/a02926.html b/docs/doxygen/nel/a02926.html new file mode 100644 index 00000000..f65585c5 --- /dev/null +++ b/docs/doxygen/nel/a02926.html @@ -0,0 +1,1699 @@ + + +NeL: NLAINIMAT::CMHiCSagent class Reference + + + +
+

NLAINIMAT::CMHiCSagent Class Reference

#include <mhics.h> +

+


Detailed Description

+A Modular Hierarchical Classifier System. This is the agent component where motivations levels and perceptions are stored.
Author:
Gabriel ROBERT

+Nevrax France

+
Date:
2002
+ +

+ +

+Definition at line 200 of file mhics.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CMHiCSagent (CMHiCSbase *pMHiCSbase)
void getDebugString (std::string &t) const
 Chaine de debug.

double getExecutionIntensity (TAction action, TTargetId target) const
 Retourne l'intensité d'exécution d'une action.

const CMHiCSbasegetMHiCSbase () const
double getMotivationPP (TMotivation motivationName) const
 Retourne la Puissance Propre d'une Motivation.

double getMotivationValue (TMotivation motivationName) const
 Retourne la valeur d'une motiation.

uint32 getTemporaryClassifierPriorityTime (TMotivation motivationName, TClassifierNumber classifierNumber) const
void run ()
 * if (selectedClassifierNumber < 0)

const std::map< TTargetId,
+ std::map< TAction, CMotivationEnergy > > * 
selectBehavior ()
 Return the Behavior that must be active.

void setLearning (bool active)
void setMotivationPP (TMotivation motivationName, double PP)
 Donne la Puissance Propre d'une Motivation.

void setMotivationValue (TMotivation motivationName, double value)
 Fixe la valeur d'une motivation.

void setSensors (CCSPerception *psensorMap)
 Set the sensor source.

bool wasClassifierPreviouslyActive (TMotivation motivationName, TClassifierNumber classifierNumber) const
virtual ~CMHiCSagent ()

Private Member Functions

void learningComputation ()
 If _Learning == true, it will compute new priority for each classifier.

void motivationCompute ()
std::string targetId2String (TTargetId id) const
 function used in debug to change a TTargetId in a string


Private Attributes

std::map< TMotivation, CMotivationEnergy_ClassifiersAndMotivationIntensity
bool _Learning
std::map< TMotivation, CMotivationEnergy_OldClassifiersAndMotivationIntensity
std::map< TTargetId, std::map<
+ TAction, CMotivationEnergy > > * 
_pActionsExecutionIntensityByTarget
std::map< TMotivation, std::map<
+ TClassifierNumber, CClassifierActivityInfo > > * 
_pInfoClassifierActivity
CMHiCSbase_pMHiCSbase
std::map< TTargetId, std::map<
+ TAction, CMotivationEnergy > > * 
_pOldActionsExecutionIntensityByTarget
std::map< TMotivation, std::map<
+ TClassifierNumber, CClassifierActivityInfo > > * 
_pOldInfoClassifierActivity
CCSPerception_pSensorsValues
std::map< TMotivation, std::map<
+ TClassifierNumber, CTemporaryPriority > > 
_TemporaryPriority
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + +
NLAINIMAT::CMHiCSagent::CMHiCSagent CMHiCSbase pMHiCSbase  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 668 of file mhics.cpp. +

+References _Learning, _pActionsExecutionIntensityByTarget, _pInfoClassifierActivity, _pMHiCSbase, _pOldActionsExecutionIntensityByTarget, _pOldInfoClassifierActivity, and nlassert. +

+

00669 {
+00670         nlassert (pMHiCSbase != NULL);
+00671         _pMHiCSbase = pMHiCSbase;
+00672         _pActionsExecutionIntensityByTarget = new std::map<TTargetId, std::map<TAction, CMotivationEnergy> >();
+00673         _pOldActionsExecutionIntensityByTarget = new std::map<TTargetId, std::map<TAction, CMotivationEnergy> >();
+00674         _Learning = true;
+00675         _pInfoClassifierActivity = new std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >();
+00676         _pOldInfoClassifierActivity = new std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >();
+00677         //      _ActionsExecutionIntensity[Action_DoNothing] = CMotivationEnergy();
+00678 //      _IdByActions[Action_DoNothing] = NullTargetId;
+00679 //      _ItCurrentAction = _IdByActions.find(Action_DoNothing);
+00680 }
+
+

+ + + + +
+ + + + + + + + + +
NLAINIMAT::CMHiCSagent::~CMHiCSagent  )  [virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 682 of file mhics.cpp. +

+References _pActionsExecutionIntensityByTarget, _pInfoClassifierActivity, _pOldActionsExecutionIntensityByTarget, and _pOldInfoClassifierActivity. +

+

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLAINIMAT::CMHiCSagent::getDebugString std::string &  t  )  const
+
+ + + + + +
+   + + +

+Chaine de debug. +

+ +

+Definition at line 707 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity, _pSensorsValues, NLAINIMAT::CCSPerception::NoTargetSensors, t, targetId2String(), NLAINIMAT::CCSPerception::TargetSensors, and NLMISC::toString(). +

+

00708 {
+00709         std::string ret = "\n\n---------------------------\n";
+00710         ret += "\nPerceptions :";
+00711         ret += "\n Without target";
+00712         NLAINIMAT::TSensorMap::const_iterator itNoTargetSensors;
+00713         for (itNoTargetSensors  = _pSensorsValues->NoTargetSensors.begin();
+00714                  itNoTargetSensors != _pSensorsValues->NoTargetSensors.end();
+00715                  itNoTargetSensors++)
+00716         {
+00717                 ret += "\n  " + conversionSensor.toString((*itNoTargetSensors).first) + "(" + (*itNoTargetSensors).second + ")";
+00718         }
+00719         std::map<TTargetId, TSensorMap>::const_iterator itTargetSensors;
+00720         for (itTargetSensors  = _pSensorsValues->TargetSensors.begin();
+00721                  itTargetSensors != _pSensorsValues->TargetSensors.end();
+00722                  itTargetSensors++)
+00723         {
+00724                 ret += "\n On target n#" + targetId2String((*itTargetSensors).first);
+00725                 for (itNoTargetSensors  = (*itTargetSensors).second.begin();
+00726                          itNoTargetSensors != (*itTargetSensors).second.end();
+00727                          itNoTargetSensors++)
+00728                 {
+00729                          ret += "\n  " + conversionSensor.toString((*itNoTargetSensors).first) + "(" + (*itNoTargetSensors).second + ")";
+00730                 }
+00731         }
+00732         ret += "\n\nMotivations :";
+00733         std::map<TMotivation, CMotivationEnergy>::const_iterator itClassifiersAndMotivationIntensity;
+00734         for (itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.begin();
+00735                  itClassifiersAndMotivationIntensity != _ClassifiersAndMotivationIntensity.end();
+00736                  itClassifiersAndMotivationIntensity++)
+00737         {
+00738                 ret += "\n <" + conversionMotivation.toString((*itClassifiersAndMotivationIntensity).first) + "> ";
+00739                 ret += "[MI=" + NLMISC::toString((*itClassifiersAndMotivationIntensity).second.getSumValue()) + "] :";
+00740                 (*itClassifiersAndMotivationIntensity).second.getDebugString(ret);
+00741 //              ret += "\n  -> Classifier number " + NLMISC::toString((*itClassifiersAndMotivationIntensity).second.ClassifierNumber); 
+00742                 ret += "\n";
+00743         }
+00744 //      ret += "\nVirtual Actions :";
+00745 //      std::map<TAction, CMotivationEnergy>::const_iterator itClassifiersAndVirtualActionIntensity;
+00746 //      for (itClassifiersAndVirtualActionIntensity = _ClassifiersAndVirtualActionIntensity.begin();
+00747 //               itClassifiersAndVirtualActionIntensity != _ClassifiersAndVirtualActionIntensity.end();
+00748 //               itClassifiersAndVirtualActionIntensity++)
+00749 //      {
+00750 //              ret += "\n <" + conversionAction.toString((*itClassifiersAndVirtualActionIntensity).first) + "> ";
+00751 //              ret += "[MI=" + NLMISC::toString((*itClassifiersAndVirtualActionIntensity).second.getSumValue()) + "] :";
+00752 //              (*itClassifiersAndVirtualActionIntensity).second.getDebugString(ret);
+00757 //              ret += "\n  -> Classifier number " + NLMISC::toString((*itClassifiersAndVirtualActionIntensity).second.ClassifierNumber); 
+00758 //              ret += "\n";
+00759 //      }
+00760         ret += "\nACTIONS :";
+00761         std::map<TAction, CMotivationEnergy>::const_iterator itActionsExecutionIntensity;
+00762 //      for (itActionsExecutionIntensity = _ActionsExecutionIntensity.begin(); itActionsExecutionIntensity != _ActionsExecutionIntensity.end(); itActionsExecutionIntensity++)
+00763 //      {
+00764 //              ret += "\n <" + conversionAction.toString((* itActionsExecutionIntensity).first) + "> [EI=" + NLMISC::toString((*itActionsExecutionIntensity).second.getSumValue()) + "] : ";
+00765 //              (*itActionsExecutionIntensity).second.getDebugString(ret);
+00766 //              std::map<TAction, TTargetId>::const_iterator itIdByActions = _IdByActions.find((*itActionsExecutionIntensity).first);
+00767 //              nlassert (itIdByActions != _IdByActions.end());
+00769 //              ret += " on target n#" + targetId2String((*itIdByActions).second);
+00770 //      }
+00771 //      if (_ItCurrentAction != _IdByActions.end())
+00772 //      {
+00774 //              ret += "\nACTION ACTIVE : " + NLAINIMAT::conversionAction.toString((*_ItCurrentAction).first) + " on " + targetId2String((*_ItCurrentAction).second);
+00775 //      }
+00776         t+=ret;
+00777 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
double NLAINIMAT::CMHiCSagent::getExecutionIntensity TAction  action,
TTargetId  target
const
+
+ + + + + +
+   + + +

+Retourne l'intensité d'exécution d'une action. +

+ +

+Definition at line 855 of file mhics.cpp. +

+References _pActionsExecutionIntensityByTarget, and NLAINIMAT::TTargetId. +

+

00856 {
+00857         std::map<TTargetId, std::map<TAction, CMotivationEnergy> >::const_iterator itActionsExecutionIntensityByTarget;
+00858         itActionsExecutionIntensityByTarget = _pActionsExecutionIntensityByTarget->find(target);
+00859         if (itActionsExecutionIntensityByTarget == _pActionsExecutionIntensityByTarget->end())
+00860         {
+00861                 return -1;
+00862         }
+00863         std::map<TAction, CMotivationEnergy>::const_iterator itActionsExecutionIntensity = (*itActionsExecutionIntensityByTarget).second.find(action);
+00864         if (itActionsExecutionIntensity != (*itActionsExecutionIntensityByTarget).second.end()) 
+00865         {
+00866                 return (*itActionsExecutionIntensity).second.getSumValue();
+00867         }
+00868         else
+00869         {
+00870                 return -1;
+00871         }
+00872 }
+
+

+ + + + +
+ + + + + + + + + +
const CMHiCSbase* NLAINIMAT::CMHiCSagent::getMHiCSbase  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 240 of file mhics.h. +

+References _pMHiCSbase. +

+Referenced by NLAINIMAT::CMotivationEnergy::computeMotivationValue(). +

+

00240 {return _pMHiCSbase;}
+
+

+ + + + +
+ + + + + + + + + + +
double NLAINIMAT::CMHiCSagent::getMotivationPP TMotivation  motivationName  )  const
+
+ + + + + +
+   + + +

+Retourne la Puissance Propre d'une Motivation. +

+ +

+Definition at line 788 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity. +

+Referenced by NLAINIMAT::CMotivationEnergy::computeMotivationValue(). +

+

00789 {
+00790         std::map<TMotivation, CMotivationEnergy>::const_iterator itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.find(motivationName);
+00791         if (itClassifiersAndMotivationIntensity != _ClassifiersAndMotivationIntensity.end()) 
+00792         {
+00793                 return (*itClassifiersAndMotivationIntensity).second.getMotivationPP(motivationName);
+00794         }
+00795         else
+00796         {
+00797                 return -1;
+00798         }
+00799 }
+
+

+ + + + +
+ + + + + + + + + + +
double NLAINIMAT::CMHiCSagent::getMotivationValue TMotivation  motivationName  )  const
+
+ + + + + +
+   + + +

+Retourne la valeur d'une motiation. +

+ +

+Definition at line 827 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity. +

+Referenced by NLAINIMAT::CMotivationEnergy::computeMotivationValue(). +

+

00828 {
+00829         std::map<TMotivation, CMotivationEnergy>::const_iterator itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.find(motivationName);
+00830         if (itClassifiersAndMotivationIntensity != _ClassifiersAndMotivationIntensity.end()) 
+00831         {
+00832                 return (*itClassifiersAndMotivationIntensity).second.getMotivationValue(motivationName);
+00833         }
+00834         else
+00835         {
+00836                 return -1;
+00837         }
+00838 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint32 NLAINIMAT::CMHiCSagent::getTemporaryClassifierPriorityTime TMotivation  motivationName,
TClassifierNumber  classifierNumber
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 1608 of file mhics.cpp. +

+References _TemporaryPriority, NLAINIMAT::TClassifierNumber, and uint32. +

+Referenced by NLAINIMAT::CMotivationEnergy::computeMotivationValue(). +

+

01609 {
+01610         std::map<TMotivation, std::map<TClassifierNumber, CTemporaryPriority> >::const_iterator itTemporaryPriority = _TemporaryPriority.find(motivationName);
+01611         if (itTemporaryPriority == _TemporaryPriority.end())
+01612         {
+01613                 return 0;
+01614         }
+01615         std::map<TClassifierNumber, CTemporaryPriority>::const_iterator itIteratorBis = (*itTemporaryPriority).second.find(classifierNumber);
+01616         if (itIteratorBis == (*itTemporaryPriority).second.end())
+01617         {
+01618                 return 0;
+01619         }
+01620         uint32 bibureturn = (*itIteratorBis).second.TemporaryClassifierPriorityTime;
+01621         return bibureturn;
+01622 }
+
+

+ + + + +
+ + + + + + + + + +
void NLAINIMAT::CMHiCSagent::learningComputation  )  [private]
+
+ + + + + +
+   + + +

+If _Learning == true, it will compute new priority for each classifier. +

+ +

+Definition at line 1219 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity, _OldClassifiersAndMotivationIntensity, _pActionsExecutionIntensityByTarget, _pMHiCSbase, _TemporaryPriority, NLMISC::CTime::getSecondsSince1970(), NLAINIMAT::CMHiCSbase::learningUpdatePriorityValueClassifierTime(), NLAINIMAT::CMHiCSbase::learningUpdatePriorityValueTimeToSuccess(), nlassert, NLAINIMAT::TClassifierNumber, NLAINIMAT::TMotivation, and uint32. +

+Referenced by selectBehavior(). +

+

01220 {
+01221         /*
+01222          *      Le but de l'apprentissage par ajustement des valeurs de priorité :
+01223          *      La valeur de priorité est utilisé pour choisir un classeur lorsque plusieurs classeurs sont activable simultanement
+01224          *      et partagent une même ressource d'action.
+01225          *      On veut la faire évoluer afin que dans une situation donnée, c'est le classeur le plus apte à satisfaire la motivation 
+01226          *      qui soit sélectionné.
+01227          *      Celon le principe de bucket brigade, un classeur qui mène à satisfaire une motivation est un bon classeur.
+01228          *      Ensuite un classeur qui a défaut de satisfaire la motivation mène à un classeur pouvant la satisfaire est bon mais un peut moins, etc.
+01229          */
+01230 
+01231         
+01232 //      std::map<TMotivation, std::set<TClassifierNumber> > oldClassifierByMotivation; // Liste des classeurs actifs au pas précédent.
+01233 //      std::map<TMotivation, std::set<TClassifierNumber> > classifierByMotivation; // Liste des classeurs activés
+01234         
+01235         //      On note les descentes de motivations
+01236         uint32 newTime = NLMISC::CTime::getSecondsSince1970();
+01237         std::set<TMotivation> decreasingMotivations;
+01238         std::map<TMotivation, CMotivationEnergy>::iterator      itOldClassifiersAndMotivationIntensity, itClassifiersAndMotivationIntensity;
+01239         for(itOldClassifiersAndMotivationIntensity = _OldClassifiersAndMotivationIntensity.begin();
+01240                 itOldClassifiersAndMotivationIntensity != _OldClassifiersAndMotivationIntensity.end();
+01241                 itOldClassifiersAndMotivationIntensity++)
+01242         {
+01243                 TMotivation motivationName = (*itOldClassifiersAndMotivationIntensity).first;
+01244                 double oldMV = (*itOldClassifiersAndMotivationIntensity).second.getMotivationValue(motivationName);
+01245                 itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.find(motivationName);
+01246                 nlassert(itClassifiersAndMotivationIntensity != _ClassifiersAndMotivationIntensity.end());
+01247                 double newMV = (*itClassifiersAndMotivationIntensity).second.getMotivationValue(motivationName);
+01248                 if (newMV < oldMV)
+01249                 {
+01250                         decreasingMotivations.insert(motivationName);
+01251                 }
+01252         }
+01253 
+01254 //      // On établit la liste des classeurs utilisés précédemment
+01255 //      std::map<TMotivation, std::set<TClassifierNumber> >::iterator itOldClassifierByMotivation;
+01256 //      std::map<TTargetId, std::map<TAction, CMotivationEnergy> >::iterator itOldActionsExecutionIntensityByTarget;
+01257 //      std::map<TAction, CMotivationEnergy>::iterator itOldActionsExecutionIntensity;
+01258 //      for(itOldActionsExecutionIntensityByTarget  = _pOldActionsExecutionIntensityByTarget->begin();
+01259 //              itOldActionsExecutionIntensityByTarget != _pOldActionsExecutionIntensityByTarget->end();
+01260 //              itOldActionsExecutionIntensityByTarget++)
+01261 //      {
+01262 //              for(itOldActionsExecutionIntensity  = (*itOldActionsExecutionIntensityByTarget).second.begin();
+01263 //                      itOldActionsExecutionIntensity != (*itOldActionsExecutionIntensityByTarget).second.end();
+01264 //                      itOldActionsExecutionIntensity++)
+01265 //              {
+01266 //                      const std::map<TMotivation, std::set<TClassifierNumber> >* provounet = (*itOldActionsExecutionIntensity).second.getProviders();
+01267 //                      std::map<TMotivation, std::set<TClassifierNumber> >::const_iterator itProvounet;
+01268 //                      for(itProvounet  = provounet->begin();
+01269 //                              itProvounet != provounet->end();
+01270 //                              itProvounet++)
+01271 //                      {
+01272 //                              TMotivation motivationName = (*itProvounet).first;
+01273 //                              std::set<TClassifierNumber>::const_iterator itClassifierNumber;
+01274 //                              for (itClassifierNumber = (*itProvounet).second.begin(); itClassifierNumber != (*itProvounet).second.end(); itClassifierNumber++)
+01275 //                              {
+01276 //                                      TClassifierNumber classifierNumber = (*itClassifierNumber);
+01277 //                                      // On établit une liste des classeurs ayant été actifs.
+01278 //                                      oldClassifierByMotivation[motivationName].insert(classifierNumber);
+01279 //                              }
+01280 //                      }
+01281 //              }
+01282 //      }
+01283 
+01284         // On remet à zero les compteurs de temps pour les actions qui on satisfait une motivation
+01285         std::set<TMotivation>::iterator itDecreasingMotivations;
+01286         for (itDecreasingMotivations = decreasingMotivations.begin(); itDecreasingMotivations != decreasingMotivations.end(); itDecreasingMotivations++)
+01287         {
+01288                 TMotivation motivationName = (*itDecreasingMotivations);
+01289                 std::map<TMotivation, std::map<TClassifierNumber, CTemporaryPriority> >::iterator itTemporaryPriority = _TemporaryPriority.find(motivationName);
+01290                 if (itTemporaryPriority != _TemporaryPriority.end())
+01291                 {
+01292                         std::map<TClassifierNumber, CTemporaryPriority>::iterator itPrioByCl;
+01293                         for (itPrioByCl = (*itTemporaryPriority).second.begin(); itPrioByCl != (*itTemporaryPriority).second.end(); itPrioByCl++ )
+01294                         {
+01295                                 // Si le temps a été fixé
+01296 //                              bool aUnFixedStartTime = (*itPrioByCl).second.FixedStartTime;
+01297 //                              if (aUnFixedStartTime)
+01298 //                              {
+01299                                         uint32 startTime = (*itPrioByCl).second.StartTime;
+01300                                         if (startTime > newTime)
+01301                                         {
+01302                                                 newTime = startTime;
+01303                                         }
+01304                                         uint32 timeToSatisfaction = newTime - startTime;
+01305                                         TClassifierNumber classifierNumber = (*itPrioByCl).first;
+01306                                         // On met à jour la fitness des classeurs ayant été activés.
+01307                                         _pMHiCSbase->learningUpdatePriorityValueTimeToSuccess(motivationName, classifierNumber, timeToSatisfaction);
+01308 //                              }
+01309                         }
+01310                 }
+01311                 _TemporaryPriority.erase(motivationName);
+01312         }
+01313                 
+01314         // On établit la liste des classeurs nouveaux utilisés à ce pas ci
+01315         std::map<TTargetId, std::map<TAction, CMotivationEnergy> >::iterator itActionsExecutionIntensityByTarget;
+01316         std::map<TAction, CMotivationEnergy>::iterator itActionsExecutionIntensity;
+01317         for(itActionsExecutionIntensityByTarget  = _pActionsExecutionIntensityByTarget->begin();
+01318                 itActionsExecutionIntensityByTarget != _pActionsExecutionIntensityByTarget->end();
+01319                 itActionsExecutionIntensityByTarget++)
+01320         {
+01321                 for(itActionsExecutionIntensity  = (*itActionsExecutionIntensityByTarget).second.begin();
+01322                         itActionsExecutionIntensity != (*itActionsExecutionIntensityByTarget).second.end();
+01323                         itActionsExecutionIntensity++)
+01324                 {
+01325                         const std::map<TMotivation, std::set<TClassifierNumber> >* provounet = (*itActionsExecutionIntensity).second.getProviders();
+01326                         std::map<TMotivation, std::set<TClassifierNumber> >::const_iterator itProvounet;
+01327                         for(itProvounet  = provounet->begin();
+01328                                 itProvounet != provounet->end();
+01329                                 itProvounet++)
+01330                         {
+01331                                 TMotivation motivationName = (*itProvounet).first;
+01332                                 std::set<TClassifierNumber>::const_iterator itClassifierNumber;
+01333                                 for (itClassifierNumber = (*itProvounet).second.begin(); itClassifierNumber != (*itProvounet).second.end(); itClassifierNumber++)
+01334                                 {
+01335                                         TClassifierNumber classifierNumber = (*itClassifierNumber);
+01336 //                                      itOldClassifierByMotivation = oldClassifierByMotivation.find(motivationName);
+01337 //                                      if (itOldClassifierByMotivation != oldClassifierByMotivation.end() )
+01338 //                                      {
+01339                                                 // ajout du classeur dans la liste des classeurs activés
+01340                                                 (*_pInfoClassifierActivity)[motivationName][classifierNumber].IsActive = true;
+01341 //                                              classifierByMotivation[motivationName].insert(classifierNumber);
+01342 //                                      }
+01343                                 }
+01344                         }
+01345                 }
+01346         }
+01347 
+01348         // on établit la liste des classeurs qui étaient activables et qui ne le sont plus
+01349         std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >::iterator itOldInfoClassifierActivity;
+01350         std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >::iterator itInfoClassifierActivity;
+01351         for(itOldInfoClassifierActivity = (*_pOldInfoClassifierActivity).begin();
+01352                 itOldInfoClassifierActivity != (*_pOldInfoClassifierActivity).end();
+01353                 itOldInfoClassifierActivity++ )
+01354         {
+01355                 TMotivation motivationName = (*itOldInfoClassifierActivity).first;
+01356                 std::map<TClassifierNumber, CClassifierActivityInfo>::iterator itClassifiers, itClassifiersBis;
+01357                 for (itClassifiers = (*itOldInfoClassifierActivity).second.begin(); itClassifiers != (*itOldInfoClassifierActivity).second.end(); itClassifiers++)
+01358                 {
+01359 //                      std::set<TClassifierNumber>::iterator itClassifiersBisBis;
+01360 //                      bool isStillActivable = false;
+01361                         TClassifierNumber classifierNumber = (*itClassifiers).first;
+01362                         bool wasActive = (*itClassifiers).second.IsActive;
+01363                         bool isActive = (*_pInfoClassifierActivity)[motivationName][classifierNumber].IsActive;
+01364                         if (wasActive && !isActive)
+01365                         {
+01366                                 // Le classeur vient de finir son activité, je calcule sa nouvelle priorité.
+01367                                 uint32 diffTime = _TemporaryPriority[motivationName][classifierNumber].TemporaryClassifierPriorityTime;
+01368                                 if (diffTime >0)
+01369                                 {
+01370                                         _pMHiCSbase->learningUpdatePriorityValueClassifierTime(motivationName, classifierNumber, diffTime);
+01371 //                                      _TemporaryPriority[motivationName][classifierNumber].FixedStartTime = false;
+01372                                 }
+01373                         }
+01374 
+01375 //                      bool wasActivable = (*itClassifiers).second.IsActivable;
+01376 //                      if (wasActivable)
+01377 //                      {
+01378 //                              itInfoClassifierActivity = (*_pInfoClassifierActivity).find(motivationName);
+01379 //                              if (itInfoClassifierActivity != (*_pInfoClassifierActivity).end())
+01380 //                              {
+01381 //                                      itClassifiersBis = (*itInfoClassifierActivity).second.find(classifierNumber);
+01382 //                                      if ( itClassifiersBis != (*itInfoClassifierActivity).second.end() )
+01383 //                                      {
+01384 //                                              isStillActivable = true;
+01385 //                                      }
+01386 //                              }
+01387 //                              if (isStillActivable)
+01388 //                              {
+01389 //                                      // s'il est activable mais plus activé alors on met à jour son compteur de temps d'execution
+01390 //                                      bool estActif = (*_pInfoClassifierActivity)[motivationName][classifierNumber].IsActive;
+01400 //                                      if (!estActif)
+01401 //                                      {
+01402 //                                              std::map<TMotivation, std::set<TClassifierNumber> >::iterator itOldClassifierByMotivation = oldClassifierByMotivation.find(motivationName);
+01403 //                                              if (itOldClassifierByMotivation != oldClassifierByMotivation.end())
+01404 //                                              {
+01405 //                                                      itClassifiersBisBis = (*itOldClassifierByMotivation).second.find(classifierNumber);
+01406 //                                                      if ( itClassifiersBisBis != (*itOldClassifierByMotivation).second.end() )
+01407 //                                                      {
+01408 //                                                              // Le classeur vient de finir son activité, je calcule sa nouvelle priorité.
+01409 //                                                              uint32 diffTime = _TemporaryPriority[motivationName][classifierNumber].TemporaryClassifierPriorityTime;
+01410 //                                                              if (diffTime >0)
+01411 //                                                              {
+01412 //                                                                      _pMHiCSbase->learningUpdatePriorityValueClassifierTime(motivationName, classifierNumber, diffTime);
+01413 //                                                                      _TemporaryPriority[motivationName][classifierNumber].FixedStartTime = false;
+01414 //                                                              }
+01415 //                                                      }
+01416 //                                              }
+01417 //                                      }
+01418 //                              }
+01419 //                              else
+01420 //                              {
+01421 //                                      // Dans tous les cas on met à jour son temps d'activation s'il a été activé par le passé.
+01422 //                                      std::map<TMotivation, std::map<TClassifierNumber, CTemporaryPriority> >::iterator itTemporaryPriority = _TemporaryPriority.find(motivationName);
+01423 //                                      if (itTemporaryPriority != _TemporaryPriority.end())
+01424 //                                      {
+01425 //                                              std::map<TClassifierNumber, CTemporaryPriority>::iterator itClassifiersTerce = (*itTemporaryPriority).second.find(classifierNumber);
+01426 //                                              if (itClassifiersTerce != (*itTemporaryPriority).second.end() )
+01427 //                                              {
+01428 //                                                      // Le classeur vient de finir son activité, je calcule sa nouvelle priorité.
+01429 //                                                      uint32 diffTime = _TemporaryPriority[motivationName][classifierNumber].TemporaryClassifierPriorityTime;
+01430 //                                                      if (diffTime >0)
+01431 //                                                      {
+01432 //                                                              _pMHiCSbase->learningUpdatePriorityValueClassifierTime(motivationName, classifierNumber, diffTime);
+01433 //                                                              _TemporaryPriority[motivationName][classifierNumber].FixedStartTime = false;
+01434 //                                                      }
+01435 //                                              }
+01436 //                                      }
+01437 //                                      
+01438 //                                      // S'il n'était pas activé (avant de n'être plus activable), on le retire de la liste des éligibles au T2S
+01451 //                                              _TemporaryPriority[motivationName][classifierNumber].FixedStartTime = false;
+01453 //                              }
+01454 //                      }
+01455                 }
+01456         }
+01457 
+01458         std::map<TClassifierNumber, CClassifierActivityInfo>::iterator itUnChtitClassifierNumberInfo;
+01459         // On regarde quelles sont les nouveaux classeurs activés
+01460         for(itInfoClassifierActivity  = (*_pInfoClassifierActivity).begin();
+01461                 itInfoClassifierActivity != (*_pInfoClassifierActivity).end();
+01462                 itInfoClassifierActivity++)
+01463         {
+01464                 TMotivation motivationName = (*itInfoClassifierActivity).first;
+01465                 
+01466                 for(itUnChtitClassifierNumberInfo  = (*itInfoClassifierActivity).second.begin();
+01467                         itUnChtitClassifierNumberInfo != (*itInfoClassifierActivity).second.end();
+01468                         itUnChtitClassifierNumberInfo++)
+01469                 {
+01470                         TClassifierNumber leNumberDuClasseur = (*itUnChtitClassifierNumberInfo).first;
+01471                         bool wasActive = (*_pOldInfoClassifierActivity)[motivationName][leNumberDuClasseur].IsActive;
+01472                         bool isActive = (*itUnChtitClassifierNumberInfo).second.IsActive;
+01473                         if (isActive)
+01474                         {
+01475                                 if (!wasActive)
+01476                                 {
+01477                                         _TemporaryPriority[motivationName][leNumberDuClasseur].StartTime = newTime;
+01478                                         _TemporaryPriority[motivationName][leNumberDuClasseur].LastTime = newTime;
+01479                                         _TemporaryPriority[motivationName][leNumberDuClasseur].FixedStartTime = true;
+01480                                         _TemporaryPriority[motivationName][leNumberDuClasseur].TemporaryClassifierPriorityTime = 0;
+01481                                 }
+01482                                 // Je fais progresser le timer
+01483                                 uint32 lastTime = _TemporaryPriority[motivationName][leNumberDuClasseur].LastTime;
+01484                                 if (lastTime > newTime)
+01485                                 {
+01486                                         newTime = lastTime;
+01487                                 }
+01488                                 uint32 diffTime = newTime - lastTime;
+01489                                 _TemporaryPriority[motivationName][leNumberDuClasseur].LastTime = newTime;
+01490                                 _TemporaryPriority[motivationName][leNumberDuClasseur].TemporaryClassifierPriorityTime += diffTime;
+01491                         }
+01492                         
+01493 //                      if (isActive)
+01494 //                      {
+01495 //                              // Si l'action n'avait pas de startTime fixé, on lui en donne un.
+01496 //                              bool avaitUnFixedStartTime = false;
+01497 //                              std::map<TMotivation, std::map<TClassifierNumber, CTemporaryPriority> >::iterator itTemporaryPriority = _TemporaryPriority.find(motivationName);
+01498 //                              if (itTemporaryPriority != _TemporaryPriority.end() )
+01499 //                              {
+01500 //                                      std::map<TClassifierNumber, CTemporaryPriority>::iterator itClassifierAndPrio = (*itTemporaryPriority).second.find(leNumberDuClasseur);
+01501 //                                      if (itClassifierAndPrio != (*itTemporaryPriority).second.end() )
+01502 //                                      {
+01503 //                                              avaitUnFixedStartTime = (*itClassifierAndPrio).second.FixedStartTime;
+01504 //                                      }
+01505 //                              }
+01506 //                              if (!avaitUnFixedStartTime)
+01507 //                              {
+01508 //                                      _TemporaryPriority[motivationName][leNumberDuClasseur].StartTime = newTime;
+01509 //                                      _TemporaryPriority[motivationName][leNumberDuClasseur].FixedStartTime = true;
+01510 //                                      _TemporaryPriority[motivationName][leNumberDuClasseur].TemporaryClassifierPriorityTime = 0;
+01511 //                              }
+01512 //                              else
+01513 //                              {
+01514 //                                      // Si elle avait un startime, on regarde si elle était active au tour précédent.
+01515 //                                      bool etaitActifJusteAvant = false;
+01516 //                                      std::map<TMotivation, std::set<TClassifierNumber> >::iterator itOldClassifierByMotivation = oldClassifierByMotivation.find(motivationName);
+01517 //                                      if (itOldClassifierByMotivation != oldClassifierByMotivation.end())
+01518 //                                      {
+01519 //                                              std::set<TClassifierNumber>::iterator itClassifier = (*itOldClassifierByMotivation).second.find(leNumberDuClasseur);
+01520 //                                              if (itClassifier != (*itOldClassifierByMotivation).second.end() )
+01521 //                                              {
+01522 //                                                      etaitActifJusteAvant = true;
+01523 //                                              }
+01524 //                                      }
+01525 //                                      if (!etaitActifJusteAvant)
+01526 //                                      {
+01527 //                                              _TemporaryPriority[motivationName][leNumberDuClasseur].LastTime = newTime;
+01529 //                                      }
+01530 //                              }
+01531 //                              
+01532 //                              // Je fais progresser le timer
+01533 //                              uint32 lastTime = _TemporaryPriority[motivationName][leNumberDuClasseur].LastTime;
+01534 //                              if (lastTime > newTime)
+01535 //                              {
+01536 //                                      newTime = lastTime;
+01537 //                              }
+01538 //                              uint32 diffTime = newTime - lastTime;
+01539 //                              _TemporaryPriority[motivationName][leNumberDuClasseur].LastTime = newTime;
+01540 //                              _TemporaryPriority[motivationName][leNumberDuClasseur].TemporaryClassifierPriorityTime += diffTime;
+01541 //                      }
+01542 
+01543                 }
+01544         }
+01545 }
+
+

+ + + + +
+ + + + + + + + + +
void NLAINIMAT::CMHiCSagent::motivationCompute  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 982 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity, _pMHiCSbase, _pSensorsValues, NLAINIMAT::Action_DoNothing, NLAINIMAT::CMHiCSbase::getActionPart(), NLAINIMAT::CMotivationEnergy::getSumValue(), NLAINIMAT::CMHiCSbase::selectBehavior(), NLAINIMAT::TAction, NLAINIMAT::TClassifierNumber, NLAINIMAT::TMotivation, and NLAINIMAT::TTargetId. +

+Referenced by run(). +

+

00983 {
+00984         TAction behav;
+00985 
+00986         std::map<TMotivation, CMotivationEnergy>::iterator itClassifiersAndMotivationIntensity;
+00987 
+00988         // On parcour toutes les motivations.
+00989         for (itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.begin();
+00990                  itClassifiersAndMotivationIntensity != _ClassifiersAndMotivationIntensity.end();
+00991                  itClassifiersAndMotivationIntensity++)
+00992         {
+00993                 CMotivationEnergy* pCSselection = &((*itClassifiersAndMotivationIntensity).second);
+00994                 TMotivation selectionName = (*itClassifiersAndMotivationIntensity).first;
+00995                 double energy = pCSselection->getSumValue();
+00996                 // Si une motivation est active (une energie >0 ) on actionne ses règles.
+00997                 if (energy > 0)
+00998                 {
+00999                         // On fait calculer le CS
+01000                         std::multimap<CClassifierPriority, std::pair<TClassifierNumber, TTargetId> > mapActivableCS;
+01001                         std::multimap<CClassifierPriority, std::pair<TClassifierNumber, TTargetId> >::iterator itMapActivableCS;
+01002 
+01003                         // On fait la liste des classeurs activables.
+01004                         _pMHiCSbase->selectBehavior(selectionName,_pSensorsValues, mapActivableCS);
+01005 
+01006                         // Pour chaque classeur activable, on transmet la valeur de motivation à l'action selectionnée.
+01007                         for (itMapActivableCS = mapActivableCS.begin(); itMapActivableCS != mapActivableCS.end(); itMapActivableCS++)
+01008                         {
+01009                                 TClassifierNumber selectedClassifierNumber = (*itMapActivableCS).second.first;
+01010                                 TTargetId currentTargetId = (*itMapActivableCS).second.second;
+01011                                 behav = _pMHiCSbase->getActionPart(selectionName, selectedClassifierNumber);
+01012 
+01013                                 (*_pInfoClassifierActivity)[selectionName][selectedClassifierNumber].IsActivable = true;
+01014                                 
+01015                                 // We add the current motivation energy to the selected action.
+01016                                 if (behav != Action_DoNothing)
+01017                                 {
+01018 //                                      std::map<TTargetId, std::map<TAction, CMotivationEnergy> >::const_iterator itOldActionsExecutionIntensityByTarget = (*_pOldActionsExecutionIntensityByTarget).find(currentTargetId);
+01019 //                                      if (itOldActionsExecutionIntensityByTarget != (*_pOldActionsExecutionIntensityByTarget).end() )
+01020 //                                      {
+01021 //                                              std::map<TAction, CMotivationEnergy>::const_iterator itIntensityByTarget = (*itOldActionsExecutionIntensityByTarget).second.find(behav);
+01022 //                                              if (itIntensityByTarget != (*itOldActionsExecutionIntensityByTarget).second.end())
+01023 //                                              {
+01024 //                                                      (*_pActionsExecutionIntensityByTarget)[currentTargetId][behav].setWasPreviouslyActived(true);
+01025 //                                              }
+01026 //                                      }
+01027                                         (*_pActionsExecutionIntensityByTarget)[currentTargetId][behav].setMHiCSagent(this);
+01028                                         (*_pActionsExecutionIntensityByTarget)[currentTargetId][behav].addProvider(selectionName, selectedClassifierNumber);
+01029                                 }
+01030                         }
+01031                 }
+01032         }
+01033 }
+
+

+ + + + +
+ + + + + + + + + +
void NLAINIMAT::CMHiCSagent::run  ) 
+
+ + + + + +
+   + + +

+* if (selectedClassifierNumber < 0) +

+ +

+Definition at line 1159 of file mhics.cpp. +

+References _pActionsExecutionIntensityByTarget, _pInfoClassifierActivity, _pOldActionsExecutionIntensityByTarget, _pOldInfoClassifierActivity, and motivationCompute(). +

+

01160 {
+01161         std::map<TTargetId, std::map<TAction, CMotivationEnergy> >      *bibu = _pOldActionsExecutionIntensityByTarget;
+01162         _pOldActionsExecutionIntensityByTarget = _pActionsExecutionIntensityByTarget;
+01163         _pActionsExecutionIntensityByTarget = bibu;
+01164         _pActionsExecutionIntensityByTarget->clear();
+01165 
+01166         std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> > *biba = _pOldInfoClassifierActivity;
+01167         _pOldInfoClassifierActivity = _pInfoClassifierActivity;
+01168         _pInfoClassifierActivity = biba;
+01169         _pInfoClassifierActivity->clear();
+01170         
+01171         motivationCompute();
+01172 //      virtualActionCompute();
+01173 }
+
+

+ + + + +
+ + + + + + + + + +
const std::map< TTargetId, std::map< TAction, CMotivationEnergy > > * NLAINIMAT::CMHiCSagent::selectBehavior  ) 
+
+ + + + + +
+   + + +

+Return the Behavior that must be active. +

+ +

+Definition at line 1548 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity, _Learning, _OldClassifiersAndMotivationIntensity, _pActionsExecutionIntensityByTarget, _pMHiCSbase, NLAINIMAT::CActionResources::filterMyActions(), learningComputation(), nlassert, NLAINIMAT::CMHiCSbase::pActionResources, NLAINIMAT::TAction, and NLAINIMAT::TTargetId. +

+

01549 {
+01550         //We sort actions by priority
+01551         double priority;
+01552         TAction action;
+01553         TTargetId target;
+01554         std::multimap<double, std::pair<TTargetId,TAction> > actionsToRemove;
+01555 
+01556         std::map<TTargetId, std::map<TAction, CMotivationEnergy> >::iterator itActionsExecutionIntensityByTarget;
+01557         std::map<TAction, CMotivationEnergy>::const_iterator itMotiveByAction;
+01558         for (itActionsExecutionIntensityByTarget  = _pActionsExecutionIntensityByTarget->begin();
+01559                  itActionsExecutionIntensityByTarget != _pActionsExecutionIntensityByTarget->end();
+01560                  itActionsExecutionIntensityByTarget++)
+01561         {
+01562                 for (itMotiveByAction  = (*itActionsExecutionIntensityByTarget).second.begin();
+01563                          itMotiveByAction != (*itActionsExecutionIntensityByTarget).second.end();
+01564                          itMotiveByAction++)
+01565                 {
+01566                         priority = (*itMotiveByAction).second.getSumValue();
+01567                         action = (*itMotiveByAction).first;
+01568                         target = (*itActionsExecutionIntensityByTarget).first;
+01569 
+01570                         // on rajoute du bruit sur les priorité afin d'avoir une diversité si des priorités sont proches
+01571 //                      double randomeNumber = ((rand()%5)*priority)/100;
+01572 //                      priority += randomeNumber;
+01573                         
+01574                         actionsToRemove.insert(std::make_pair(priority, std::make_pair(target,action)));
+01575                 }
+01576         }
+01577 
+01578         _pMHiCSbase->pActionResources->filterMyActions(actionsToRemove);
+01579 
+01580         std::multimap<double, std::pair<TTargetId,TAction> >::iterator itActionsToRemove;
+01581         for (itActionsToRemove = actionsToRemove.begin();
+01582                  itActionsToRemove != actionsToRemove.end();
+01583                  itActionsToRemove++)
+01584         {
+01585                  target = (*itActionsToRemove).second.first;
+01586                  action = (*itActionsToRemove).second.second;
+01587                  itActionsExecutionIntensityByTarget = _pActionsExecutionIntensityByTarget->find(target);
+01588                  nlassert (itActionsExecutionIntensityByTarget != _pActionsExecutionIntensityByTarget->end());
+01589                  itMotiveByAction = (*itActionsExecutionIntensityByTarget).second.find(action);
+01590                  nlassert (itMotiveByAction != (*itActionsExecutionIntensityByTarget).second.end());
+01591                  (*itActionsExecutionIntensityByTarget).second.erase(action);
+01592                  if ( (*itActionsExecutionIntensityByTarget).second.begin() == (*itActionsExecutionIntensityByTarget).second.end() )
+01593                  {
+01594                          _pActionsExecutionIntensityByTarget->erase(target);
+01595                  }
+01596         }
+01597 
+01598         if (_Learning)
+01599         {
+01600                 learningComputation();
+01601 
+01602                 _OldClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity;
+01603         }
+01604 
+01605         return _pActionsExecutionIntensityByTarget;
+01606 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLAINIMAT::CMHiCSagent::setLearning bool  active  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 1181 of file mhics.cpp. +

+References _Learning. +

+

01182 {
+01183         _Learning = active;
+01184 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLAINIMAT::CMHiCSagent::setMotivationPP TMotivation  motivationName,
double  PP
+
+ + + + + +
+   + + +

+Donne la Puissance Propre d'une Motivation. +

+ +

+Definition at line 780 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity. +

+

00781 {
+00782         _ClassifiersAndMotivationIntensity[motivationName].setMHiCSagent(this);
+00783         _ClassifiersAndMotivationIntensity[motivationName].setMotivationPP(motivationName, PP);
+00784 //      spreadMotivationReckon(motivationName);
+00785 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLAINIMAT::CMHiCSagent::setMotivationValue TMotivation  motivationName,
double  value
+
+ + + + + +
+   + + +

+Fixe la valeur d'une motivation. +

+ +

+Definition at line 802 of file mhics.cpp. +

+References _ClassifiersAndMotivationIntensity, and value. +

+

00803 {
+00804 //      if (_Learning)
+00805 //      {
+00806 //              double lastMotiveValue = _ClassifiersAndMotivationIntensity[motivationName].getMotivationValue(motivationName);
+00807 //              // Si la valeur de motivation a diminuée, il est temps d'apprendre
+00808 //              if (lastMotiveValue > value)
+00809 //              {
+00810 //                      learningComputationMotivationDecrease(motivationName);
+00811 //              }
+00812 //      }
+00813 
+00814         std::map<TMotivation, CMotivationEnergy>::iterator itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.find(motivationName);
+00815         if (itClassifiersAndMotivationIntensity == _ClassifiersAndMotivationIntensity.end())
+00816         {
+00817                 itClassifiersAndMotivationIntensity = _ClassifiersAndMotivationIntensity.insert(std::make_pair(motivationName,CMotivationEnergy())).first;
+00818 
+00819                 // On en profite pour mettre à zero la date de la première réponse positive d'une motivation
+00820 //              _TimeOfLastMotivationValueDecrease[motivationName] = NLMISC::CTime::getSecondsSince1970();
+00821         }
+00822         (*itClassifiersAndMotivationIntensity).second.setMHiCSagent(this);
+00823         (*itClassifiersAndMotivationIntensity).second.setMotivationValue(motivationName, value);
+00824         //      spreadMotivationReckon(motivationName);
+00825 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLAINIMAT::CMHiCSagent::setSensors CCSPerception psensorMap  ) 
+
+ + + + + +
+   + + +

+Set the sensor source. +

+ +

+Definition at line 1176 of file mhics.cpp. +

+References _pSensorsValues. +

+

01177 {
+01178         _pSensorsValues = psensorMap;
+01179 }
+
+

+ + + + +
+ + + + + + + + + + +
std::string NLAINIMAT::CMHiCSagent::targetId2String TTargetId  id  )  const [private]
+
+ + + + + +
+   + + +

+function used in debug to change a TTargetId in a string +

+ +

+Definition at line 691 of file mhics.cpp. +

+References NLMISC::toString(), and NLAINIMAT::TTargetId. +

+Referenced by getDebugString(). +

+

00692 {
+00693 /*      // Le format est celui pour afficher en debug le Nb comme dans Ryzom.
+00694         uint32 aiBoteId = id;
+00695         uint32 managerID = (aiBoteId>>(8+12))&( (1<<10)-1 );
+00696         uint32 groupeID = (aiBoteId>>8)&( (1<<12)-1 );
+00697         uint32 boteID = aiBoteId&( (1<<8)-1 );
+00698         char result[30];
+00699         sprintf(result,"AI:%04x:BOT:%04x:%04x:%04x",aiBoteId,managerID,groupeID,boteID);
+00700         return result;
+00701 */
+00702         std::string ret = NLMISC::toString(id);
+00703         return ret;
+00704 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLAINIMAT::CMHiCSagent::wasClassifierPreviouslyActive TMotivation  motivationName,
TClassifierNumber  classifierNumber
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 1624 of file mhics.cpp. +

+References _pOldInfoClassifierActivity, and NLAINIMAT::TClassifierNumber. +

+Referenced by NLAINIMAT::CMotivationEnergy::computeMotivationValue(). +

+

01625 {
+01626         bool wasPreviouslyActived = false;
+01627 
+01628         std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >::const_iterator itOldInfoClassifierActivity;
+01629         itOldInfoClassifierActivity = (*_pOldInfoClassifierActivity).find(motivationName);
+01630         if (itOldInfoClassifierActivity != _pOldInfoClassifierActivity->end())
+01631         {
+01632                 std::map<TClassifierNumber, CClassifierActivityInfo>::const_iterator itClassifierInfo = (*itOldInfoClassifierActivity).second.find(classifierNumber);
+01633                 if (itClassifierInfo != (*itOldInfoClassifierActivity).second.end() )
+01634                 {
+01635                         wasPreviouslyActived = (*itClassifierInfo).second.IsActive;
+01636                 }
+01637         }
+01638         return wasPreviouslyActived;    
+01639 }
+
+


Field Documentation

+

+ + + + +
+ + +
std::map<TMotivation, CMotivationEnergy> NLAINIMAT::CMHiCSagent::_ClassifiersAndMotivationIntensity [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 294 of file mhics.h. +

+Referenced by getDebugString(), getMotivationPP(), getMotivationValue(), learningComputation(), motivationCompute(), selectBehavior(), setMotivationPP(), and setMotivationValue().

+

+ + + + +
+ + +
bool NLAINIMAT::CMHiCSagent::_Learning [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 300 of file mhics.h. +

+Referenced by CMHiCSagent(), selectBehavior(), and setLearning().

+

+ + + + +
+ + +
std::map<TMotivation, CMotivationEnergy> NLAINIMAT::CMHiCSagent::_OldClassifiersAndMotivationIntensity [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 295 of file mhics.h. +

+Referenced by learningComputation(), and selectBehavior().

+

+ + + + +
+ + +
std::map<TTargetId, std::map<TAction, CMotivationEnergy> >* NLAINIMAT::CMHiCSagent::_pActionsExecutionIntensityByTarget [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 298 of file mhics.h. +

+Referenced by CMHiCSagent(), getExecutionIntensity(), learningComputation(), run(), selectBehavior(), and ~CMHiCSagent().

+

+ + + + +
+ + +
std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >* NLAINIMAT::CMHiCSagent::_pInfoClassifierActivity [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 304 of file mhics.h. +

+Referenced by CMHiCSagent(), run(), and ~CMHiCSagent().

+

+ + + + +
+ + +
CMHiCSbase* NLAINIMAT::CMHiCSagent::_pMHiCSbase [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 293 of file mhics.h. +

+Referenced by CMHiCSagent(), getMHiCSbase(), learningComputation(), motivationCompute(), and selectBehavior().

+

+ + + + +
+ + +
std::map<TTargetId, std::map<TAction, CMotivationEnergy> >* NLAINIMAT::CMHiCSagent::_pOldActionsExecutionIntensityByTarget [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 299 of file mhics.h. +

+Referenced by CMHiCSagent(), run(), and ~CMHiCSagent().

+

+ + + + +
+ + +
std::map<TMotivation, std::map<TClassifierNumber, CClassifierActivityInfo> >* NLAINIMAT::CMHiCSagent::_pOldInfoClassifierActivity [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 305 of file mhics.h. +

+Referenced by CMHiCSagent(), run(), wasClassifierPreviouslyActive(), and ~CMHiCSagent().

+

+ + + + +
+ + +
CCSPerception* NLAINIMAT::CMHiCSagent::_pSensorsValues [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 297 of file mhics.h. +

+Referenced by getDebugString(), motivationCompute(), and setSensors().

+

+ + + + +
+ + +
std::map<TMotivation, std::map<TClassifierNumber, CTemporaryPriority> > NLAINIMAT::CMHiCSagent::_TemporaryPriority [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 303 of file mhics.h. +

+Referenced by getTemporaryClassifierPriorityTime(), and learningComputation().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 11:10:17 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1