K  n  o  w  L  a  n  g
Framework for Knowledge Representation and Reasoning for Self-Adaptive Systems


U s e r    G u i d e

Home
Running KnowLang
Knowledge Model
Concepts
Objects
States
Metrics
Self-Adaptive Behavior
Goals
Situations
Policies
Reasoner
Contact Info
Description

The KnowLang Reasoner is supplied as a component hosted by a self-adaptive system and thus, it runs in the system's Operational Context as any other system's component. However, it operates in the KR (knowledge representation) Context and on the KB (represented knowledge). The system talks to the reasoner via special ASK and TELL Operators allowing for knowledge queries and knowledge updates

Upon demand, the KnowLang Reasoner can also build up and return a self-adaptive behavior model - a chain of actions to be realized in the environment or in the system.

KnowLang Reasoner

Upon start, the KnowLang Reasoner creates and controls a special awareness control loop, which is implemented to help the reasoner monitor, recognize, analyze, and learn. For example, when analyzing, the reasoner evaluates all the states specified in the KB as following:

Enumeration eStates = KnowLangReasonerDef.vsStates.elements();
while (eStates.hasMoreElements())
{
    eStates.nextElement().evaluateState();
}

In that way, the reasoner constantly evaluates all the states and deducts new state changes, thus emerging as awareness about new situations, and realization of goals (recall that states are used to express situations and goals).

Embeding

Similarly to the KnowLang Toolset, the KnowLang Reasoner has been implemented in Java. Its Java implementation is organized in four Java packages (see the figure below) that host all the necessary classes needed at both startup and runtime. To embed the reasoner in an application, you need to integrate its Java packages to the application’s Java implementation.

KnowLang Reasoner Startup
Startup

To operate, the KnowLang Reasoner requires a KnowLang-compiled KB. The file carrying the compiled KB should have the name "compiledKB.bin" and should be placed in the host application’s root directory. At startup, the reasoner loads this file and builds the structures of the KB optimized for reasoning.

As shown in the following figure, there are a few important operations performed by the reasoner at startup. Along with loading the compiled KB into a tree of optimized KnowLang tokens, these operations also build special information-retrieval and information-update structures and load the implementation of multiple search algorithms. Finally, the startup process loads the awareness control loop and a special query interpreter, and starts the control loop.

KnowLang Reasoner Startup
Runtime

Once the KB is loaded, the reasoner waits for further instructions. When in a "waiting" mode, the reasoner is iterating over the awareness control loop. Therefore, all the states expressed in KnowLang are constantly evaluated at any loop iteration (performed by the analyzer), which leads to re-evaluation of all the goals and situations expressed with states. Via the ASK and TELL operators, the reasoner communicates with the host system (the application embedding the KnowLang Reasoner). For example, the application may ask for "current_situation", "active_states", "active_policy", "behavior", etc. Or, it may tell the reasoner about "prop_val" (the value held by a concept’s property), "func_val" (the value returned by a concept’s function), "sensor_val" (the value carried by a particular system’s sensor), "behavior_val" (the positive\negative feedback of a certain behavior), etc. The following is an example of "ask active_states" command.

ASK ACTIVE_STATES COMMAND

top
User Guide Curator - Emil Vassev
Last modified on January 28, 2014