All Feelings are implemented using PredicateNodes with the truth values representing the degree of that feeling. The internal computation is done through C++ functions.
Regardless of the representational choice, all percepts that drive feelings are mapped into the interval [0, 1]. Where 0 indicates an absence of the feeling and 1 represents the maximum presence of it.
There are two types of feelings, which we will refer to as just Feelings and Physiological Needs.
Feelings are emotions that influences the agent's objectives. Depending on the combination of the Truth values of its feelings, the agent will select actions to be executed. A Rule Based System is responsible for evaluate a list of actions that uses the current feelings values as preconditions. Here are some examples of feelings: happiness, fear, pride, love, hate, anger, gratitude, excitement, etc..
The agent's RuleEngine has three kinds of rules. One of them is the FEELING_RULE. A FEELING_RULE has as output an emotion value. When a FEELING_RULE is selected and executed, the current emotion value is merged with the rule suggested value, modifying the current agent feeling. So, the PredicateNode stores that resulting value of this merge process to be used in the next cycle of the RuleEngine.
Physiological Needs (PNs) are provided by the Embodiment Proxy. The proxy starts all the agent's Physiological needs with default values. At each system update cycle (Tick), the proxy decrements or increments the PNs values depending on its type. Hungry, for example, will have its value incremented at each cycle, but Energy will be decremented.
An agent can execute several sorts of actions. Depending on the executed action, it will have greater or minor impact on the PNs. Walk, for example, is an action that requires a lot of Energy to be executed. Thus, besides the 'natural' decrement on Energy, after that action was executed, an extra value will be deducted from Energy. So, we can conclude that actions can directly impact PNs.
Energy, Effectiveness and Fitness
These feelings are different representations of energy levels reflecting short medium term and long term energy stores. These also form part of the compound Physical Health feeling.
The Hunger feeling is essentially inverserly proportional to the food intake minus energy expenditure. This is used primarily to drive the eat() action. It also forms part of the compound Physical Health feeling.
The Thirst feeling is similar to the hunger feeling in that it is inversely proportional to the water intake minus energy expenditure and is used primarily to drive the drink() action. It also forms part of the compound Physical Health feeling.
The PeeUrgency feeling is directly related to the amount of water consumed and is used primarily to drive the pee() action. It also forms part of the compound Physical Health feeling.
The PooUrgency feeling is directly related to the amount of food consumed and is used primarily to drive the poo() action. It also forms part of the compound Physical Health feeling.
Psychological Feelings (Not implemented)
Psychological feelings are generated by the Embodiment Brain 1.0 from within the cognitive architecture. The psychological feelings with the exception of social interaction (see below) are taken from the NCE design wiki. See OpenCogPrime:FeelingNodes for more info.
These should be represented as PredicateNodes, because they are not pushed into the OAC by the Embodiment Proxy, but are rather calculated by BuiltInProcedures within the OAC.
The External Novelty feeling is a measure of how much the external environment is changing over time. This can be based on the perception stream or higher level pattern formation related to the perception stream such as context creation. Each object perceived by the agent is marked with cycles steps for first seen and last seen. So, an object will be considered Novel only if its first seen value was minor than a given number of cycles.
Internal Novelty (Not implemented)
The internal Novelty feeling represents how much the AtomSpace is changing over time. One way to measure this would be based on the number of new schema, contextual rules and behaviour patterns generated for the avatar.
Social satisfaction (Not implemented)
The social Satisfaction feeling is determined by the degree of interaction between the avatar and other avatars. The exact details are still to be confirmed.
Mental Health (Not implemented)
The Mental Health feeling is a high level compound feeling that represents the overall state of the psychological aspects of the avatar. It incorporates all of the above psychological feelings.
External Feelings (Not implemented)
External Feelings are generated by events outside of the avatar's "body" such as owner interaction.
Owner satisfaction (Not implemented)
This is a composite of rolling reward with other information such as how often the user has smiled recently. As we don't need it for the AI skeleton, and there are many ways to do it, I'll defer proposing details right now.
It will be a PredicateNode, I would say.
This was implemented as a Reinforcement Learning mechanism inside the RuleEngine.
The reward feeling is triggered by the avatar's owner providing a reward signal. The feeling is a rolling average of the amount of reward received over the recent past.
The truth value decays at a certain constant rate, and is then increased by a certain amount when a reward is received. (Of course, it can never be increased above one.)
Implementation detail: Decay may be done each cycle; or if the time-stamp of the last truth-value access is stored, it may be done lazily whenever the truth value is accessed.
UberFeelings (Not implemented )
The Satisfaction feeling is the top level feeling or uberfeeling. It represents a single feeling that incorporates aspects of the avatar's state, physiological, psychological and external. It combines Physiological Health feeling, Mental Health feeling and Owner Satisfaction feeling and is the metric for the top level or ubergoal Satisfaction..
We will need this for "learning of spontaneous behaviors" beyond PB 1.0, but at the moment I don't see why it's needed for PB 1.0.