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/a02938.html | 842 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 842 insertions(+) create mode 100644 docs/doxygen/nel/a02938.html (limited to 'docs/doxygen/nel/a02938.html') diff --git a/docs/doxygen/nel/a02938.html b/docs/doxygen/nel/a02938.html new file mode 100644 index 00000000..ade0215d --- /dev/null +++ b/docs/doxygen/nel/a02938.html @@ -0,0 +1,842 @@ + + +NeL: NLAINIMAT::CMotivationEnergy class Reference + + + +
+

NLAINIMAT::CMotivationEnergy Class Reference

#include <mhics.h> +

+


Detailed Description

+A Class for manage witch source motivate a CS or an action
Author:
Gabriel ROBERT

+Nevrax France

+
Date:
2002
+ +

+ +

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

Public Member Functions

void addProvider (TMotivation providerName, TClassifierNumber classifierNumber)
 CMotivationEnergy ()
void getDebugString (std::string &t) const
 Chaine de debug.

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

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

const std::map< TMotivation,
+ std::set< TClassifierNumber > > * 
getProviders () const
double getSumValue () const
void removeProvider (TMotivation providerName)
 Gestion des classeurs qui apportent la motivation.

void setMHiCSagent (CMHiCSagent *pmhicsAgent)
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.

virtual ~CMotivationEnergy ()

Private Types

typedef std::map< TMotivation,
+ CMotivationValue
TEnergyByMotivation

Private Member Functions

void computeMotivationValue ()

Private Attributes

TEnergyByMotivation _EnergyByMotivation
CMHiCSagent_MHiCSagent
std::map< TMotivation, std::set<
+ TClassifierNumber > > 
_MotivationProviders
CMotivationValue _MyMotivationValue
double _SumValue
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::map< TMotivation, CMotivationValue> NLAINIMAT::CMotivationEnergy::TEnergyByMotivation [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 64 of file mhics.h.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLAINIMAT::CMotivationEnergy::CMotivationEnergy  ) 
+
+ + + + + +
+   + + +

+ +

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

+References _MHiCSagent, and _SumValue. +

+

00039 {
+00040         _SumValue = 0;
+00041         _MHiCSagent = NULL;
+00042 //      _WasPreviouslyActived = false;
+00043 }
+
+

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

+ +

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

+

00046 {
+00047 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLAINIMAT::CMotivationEnergy::addProvider TMotivation  providerName,
TClassifierNumber  classifierNumber
+
+ + + + + +
+   + + +

+ +

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

+References _MotivationProviders, computeMotivationValue(), and NLAINIMAT::TClassifierNumber. +

+

00067 {
+00068         _MotivationProviders[providerName].insert(classifierNumber);
+00069         computeMotivationValue();
+00070 }
+
+

+ + + + +
+ + + + + + + + + +
void NLAINIMAT::CMotivationEnergy::computeMotivationValue  )  [private]
+
+ + + + + +
+   + + +

+ +

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

+References _EnergyByMotivation, _MHiCSagent, _MotivationProviders, _MyMotivationValue, _SumValue, NLAINIMAT::CClassifierPriority::getClassifierTimer(), NLAINIMAT::CMHiCSagent::getMHiCSbase(), NLAINIMAT::CMHiCSagent::getMotivationPP(), NLAINIMAT::CMHiCSagent::getMotivationValue(), NLAINIMAT::CMHiCSbase::getPriorityPart(), NLAINIMAT::CClassifierPriority::getPriorityTimer(), NLAINIMAT::CMHiCSagent::getTemporaryClassifierPriorityTime(), NLAINIMAT::Motivation_Unknown, nlassert, NLAINIMAT::CMotivationEnergy::CMotivationValue::PP, NLAINIMAT::TClassifierNumber, NLAINIMAT::TMotivation, uint32, NLAINIMAT::CMotivationEnergy::CMotivationValue::Value, and NLAINIMAT::CMHiCSagent::wasClassifierPreviouslyActive(). +

+Referenced by addProvider(), and removeProvider(). +

+

00096 {
+00097         _EnergyByMotivation.clear();
+00098 
+00099         TMotivation lastMotivationName = Motivation_Unknown;
+00100         // We look for motivation values comming directly from Motivations
+00101         std::multimap<TMotivation, std::set<TClassifierNumber> >::iterator itMotivationProviders;
+00102         for (itMotivationProviders = _MotivationProviders.begin();
+00103                  itMotivationProviders != _MotivationProviders.end();
+00104                  itMotivationProviders++)
+00105         {
+00106                 uint32 lastMaxMotiveValue = 0;
+00107                 TMotivation motivationName = (*itMotivationProviders).first;
+00108                 std::set<TClassifierNumber>::iterator itClassifierNumber;
+00109                 for (itClassifierNumber = (*itMotivationProviders).second.begin(); itClassifierNumber != (*itMotivationProviders).second.end(); itClassifierNumber++)
+00110                 {
+00111                         TClassifierNumber classierNumber = (*itClassifierNumber);
+00112                         uint32 classifierTimer = _MHiCSagent->getMHiCSbase()->getPriorityPart(motivationName, classierNumber).getClassifierTimer();;
+00113                         bool wasPreviouslyActived = _MHiCSagent->wasClassifierPreviouslyActive(motivationName,classierNumber);
+00114                         if (wasPreviouslyActived)
+00115                         {
+00116                                 uint32 temporaryClassifierPriorityTime = _MHiCSagent->getTemporaryClassifierPriorityTime(motivationName, classierNumber);
+00117                                 // on donne une marge de 15 secondes à l'action activée.
+00118                                 if (temporaryClassifierPriorityTime > classifierTimer + 15)
+00119                                 {
+00120                                         classifierTimer = temporaryClassifierPriorityTime;
+00121                                 }
+00122                                 else
+00123                                 {
+00124                                         classifierTimer -=1; // Pour lui donner un avantage en cas d'égalité
+00125                                 }
+00126                         }
+00127                         double motiveValue = _MHiCSagent->getMotivationValue(motivationName);
+00128                         double motivePP = _MHiCSagent->getMotivationPP(motivationName);
+00129                         uint32 priorityTimer = _MHiCSagent->getMHiCSbase()->getPriorityPart(motivationName, classierNumber).getPriorityTimer();
+00130                         priorityTimer = std::max(priorityTimer, classifierTimer);
+00131 
+00132 
+00133                         uint32 combinedValue = (motiveValue * 10000.0) - priorityTimer;
+00134                         if (combinedValue > lastMaxMotiveValue)
+00135                         {
+00136                                 lastMaxMotiveValue = combinedValue;
+00137                                 _EnergyByMotivation[motivationName].Value = combinedValue;
+00138                                 _EnergyByMotivation[motivationName].PP = motivePP;
+00139                         }
+00140                 }
+00141         }
+00142 
+00143         TEnergyByMotivation::const_iterator itEnergyByMotivation;
+00144         double sum = 0;
+00145         for (itEnergyByMotivation = _EnergyByMotivation.begin(); itEnergyByMotivation != _EnergyByMotivation.end(); itEnergyByMotivation++)
+00146         {
+00147                 sum += (*itEnergyByMotivation).second.Value * (*itEnergyByMotivation).second.PP;
+00148         }
+00149         sum += _MyMotivationValue.PP * _MyMotivationValue.Value;
+00150 
+00151         _SumValue = sum;
+00152         nlassert(_SumValue >= 0);
+00153 }
+
+

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

+Chaine de debug. +

+ +

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

+References _EnergyByMotivation, t, and NLMISC::toString(). +

+

00197 {
+00198         std::string ret;
+00199         TEnergyByMotivation::const_iterator itEnergyByMotivation;
+00200         
+00201         for (itEnergyByMotivation = _EnergyByMotivation.begin(); itEnergyByMotivation!= _EnergyByMotivation.end(); itEnergyByMotivation++)
+00202         {
+00203                 ret += " " + conversionMotivation.toString((*itEnergyByMotivation).first) + " (" + NLMISC::toString((*itEnergyByMotivation).second.Value * (*itEnergyByMotivation).second.PP) + ") ";
+00204         }
+00205         t+=ret;
+00206 }
+
+

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

+Retourne la Puissance Propre d'une Motivation. +

+ +

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

+References _MyMotivationValue, and NLAINIMAT::CMotivationEnergy::CMotivationValue::PP. +

+

00167 {
+00168         return _MyMotivationValue.PP;
+00169 }
+
+

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

+Retourne la valeur d'une motiation. +

+ +

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

+References _MyMotivationValue, and NLAINIMAT::CMotivationEnergy::CMotivationValue::Value. +

+

00186 {
+00187         return _MyMotivationValue.Value;
+00188 }
+
+

+ + + + +
+ + + + + + + + + +
const std::map< TMotivation, std::set< TClassifierNumber > > * NLAINIMAT::CMotivationEnergy::getProviders  )  const
+
+ + + + + +
+   + + +

+ +

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

+References _MotivationProviders. +

+

00191 {
+00192         return &_MotivationProviders;
+00193 }
+
+

+ + + + +
+ + + + + + + + + +
double NLAINIMAT::CMotivationEnergy::getSumValue  )  const
+
+ + + + + +
+   + + +

+ +

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

+References _SumValue. +

+Referenced by NLAINIMAT::CMHiCSagent::motivationCompute(). +

+

00050 {
+00051         return _SumValue;
+00052 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLAINIMAT::CMotivationEnergy::removeProvider TMotivation  providerName  ) 
+
+ + + + + +
+   + + +

+Gestion des classeurs qui apportent la motivation. +

+ +

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

+References _MotivationProviders, and computeMotivationValue(). +

+

00055 {
+00056         _MotivationProviders.erase(providerName);
+00057         computeMotivationValue();
+00058 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLAINIMAT::CMotivationEnergy::setMHiCSagent CMHiCSagent pmhicsAgent  )  [inline]
+
+ + + + + +
+   + + +

+ +

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

+References _MHiCSagent. +

+

00095 {_MHiCSagent = pmhicsAgent;}
+
+

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

+Donne la Puissance Propre d'une Motivation. +

+ +

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

+References _EnergyByMotivation, _MyMotivationValue, _SumValue, nlassert, NLAINIMAT::CMotivationEnergy::CMotivationValue::PP, and NLAINIMAT::CMotivationEnergy::CMotivationValue::Value. +

+

00157 {
+00158         _SumValue -= _MyMotivationValue.Value * _MyMotivationValue.PP;
+00159         _SumValue += _MyMotivationValue.Value * PP;
+00160         _EnergyByMotivation[motivationName].PP = PP;
+00161         _MyMotivationValue.PP = PP;
+00162         nlassert(_SumValue >= 0);
+00163 }
+
+

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

+Fixe la valeur d'une motivation. +

+ +

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

+References _EnergyByMotivation, _MyMotivationValue, _SumValue, nlassert, NLAINIMAT::CMotivationEnergy::CMotivationValue::PP, NLAINIMAT::CMotivationEnergy::CMotivationValue::Value, and value. +

+

00173 {
+00174         nlassert(value >= 0);
+00175         _SumValue -= _MyMotivationValue.Value * _MyMotivationValue.PP;
+00176         nlassert(_SumValue >= 0);
+00177         _SumValue += value * _MyMotivationValue.PP;
+00178         _EnergyByMotivation[motivationName].Value = value;
+00179         _MyMotivationValue.Value = value;
+00180 
+00181         nlassert(_SumValue >= 0);
+00182 }
+
+


Field Documentation

+

+ + + + +
+ + +
TEnergyByMotivation NLAINIMAT::CMotivationEnergy::_EnergyByMotivation [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by computeMotivationValue(), getDebugString(), setMotivationPP(), and setMotivationValue().

+

+ + + + +
+ + +
CMHiCSagent* NLAINIMAT::CMotivationEnergy::_MHiCSagent [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by CMotivationEnergy(), computeMotivationValue(), and setMHiCSagent().

+

+ + + + +
+ + +
std::map<TMotivation, std::set<TClassifierNumber> > NLAINIMAT::CMotivationEnergy::_MotivationProviders [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by addProvider(), computeMotivationValue(), getProviders(), and removeProvider().

+

+ + + + +
+ + +
CMotivationValue NLAINIMAT::CMotivationEnergy::_MyMotivationValue [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by computeMotivationValue(), getMotivationPP(), getMotivationValue(), setMotivationPP(), and setMotivationValue().

+

+ + + + +
+ + +
double NLAINIMAT::CMotivationEnergy::_SumValue [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by CMotivationEnergy(), computeMotivationValue(), getSumValue(), setMotivationPP(), and setMotivationValue().

+


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