You are here

Report #4 - LIDA Tutorial Projects

1. ACTIVITIES

1.1 BASIC EXERCISES

1.1.1 Exercise 0

In this activity, it was explored the structure of the basicAgentsExercises project, identifying the main classes and main LIDA config files.

Figure 1 - basicAgentExercises main classes.

Figure 2 - basicAgentExercises main XML files.

The main classes and XML files in basicAgentExercises project are highlighted in  blue  in the images above.

1.1.2 Exercise 1

The main goal of this activities is to help getting familiarized with LIDA Framework's GUI. The picture following shows a screenshot of the framework on OSX environment.

Figure 3 - LIDA Framework Graphical User Interface.

As presented in the Tutorial Document, the framework's GUI contains buttons for starting - Start - and pausing - Pause - the simulation. It also contains the step mode function, available by clicking on Step mode button and entering the number of steps in the field just beside that button. The step mode function allows entering a number of steps to run the simulation every time the button Run ticks is pressed. For following the simulation execution, the field Current tick contains the number of ticks run during the simulation period. For speeding up or slowing down the execution of the simulation, there is also available the button Tick duration (ms) for this purpose. 

Figure 4 - LIDA Framework Tool Bar.

The picture above shows a screenshot of a toolbar with the number of current simulated ticks (Current ticks), the number of entered steps (Step mode) and the number of selected tick duration (Tick duration).

The logging area, at the button of the framework window, brings a lot of logging information regarding the simulation. There are a few options for selecting the logger - Logger - and logging level - Logging Level

Figure 5 - LIDA Framework Logging Area.

There is also available in the framework an area for accessing the current configuration files as defined in LidaConfig.properties.

Figure 6 - LIDA Framework Config Area.

1.1.3 Exercise 2

For the tasks in this exercise, lidaConfig.properties was changed as shown in the follows code snippet

1
2
3
#Agent properties
#lida.agentdata=configs/basicAgent.xml
lida.agentdata=configs/basicAgent_ex2.xml

Code Snippet 1 - lida.agentdata parameter new value.

Notice that line 2 above was connected out and line 3 was added with a new value for lida.agentdata parameter.

The new file basicAgent_ex2.xml referred in the lidaConfig.properties changes tasks related to blue circle detection in PerceptualAssociativeMemory and AttentionModule modules.

As explored later by a task in this exercise during the simulation there should be no activations for blue circles but only for red squares.

As observed in basicAgent_ex2.xml, the Perceptual Buffer is a submodule of Workspace module. Nodes in Perceptual Buffer come from the Perceptual Associative Memory (PAM). In general, nodes added to that workspace differ for other nodes having their own activation and mechanism for excitation and decay.

The Global Workspace available in the GUI shows the colations that compete for consciousness. Those colations are created and added to the Global Workspace by AttentionCodelets from the AttentionCodeletModule. Coalitions compete for consciousness, based on their activations derived from the content activation and attention codelet, and the wining coalitions are broadcast throughout the system.

Based on the exercises requirements, the line following was added to the guiPanels.properties file:

1
csm = CSM,edu.memphis.ccrg.lida.framework.gui.panels.NodeStructurePanel,B,7,Y,Workspace.CurrentSituationalModel

Code Snippet 2 - guiPanel properties file.

The Current Situational Model (CSM) is a submodule of the Workspace module that contains structures that represent the current agent situation, composed of real and virtual parts. The real piece contains an internal representation of the real world and the virtual piece contains the internal rememberings, plannings or imaginings of the agent. 

1.1.4 Exercise 3

For the tasks in this exercise, lidaConfig.properties was changed as shown in the follows code snippet.

1
2
3
#Agent properties
#lida.agentdata=configs/basicAgent.xml
lida.agentdata=configs/basicAgent_ex3.xml

Code Snippet 3 - lida.agentdata parameter new value.

Notice that line 2 above was connected out and line 3 was added with a new value for lida.agentdata parameter.

The dotted lines in the picture following contain the elements that were added to the framework during the exercise.

Figure 7 - Partial diagram of ButtonAgent’s architecture.

1.2 ADVANCED EXERCISES

1.2.1 Exercise 1

In this exercise the activation and deactivation of GUI were tested together with logging methods were tested, which are:

For disabling the GUI, the following line has to be changed in lidaConfig.properties:

1
lida.gui.enabled=false                                  

Code Snippet 4 - Disabling GUI.

For the logging, either one of the following handlers can be configured for handling logging information:

  • Using file logging handler:
1
handler=java.util.logging.FileHandler                 

Code Snippet 5 - File logging handler.

  • Using console logging handler:
1
handler=java.util.logging.ConsoleHandler              

Code Snippet 5 - Console logging handler.

1.2.2 Exercise 2

In this exercise, the parameters ticksPerRun and refractoryPeriod where changed and the changed behaviour of LIDA framework was checked in Global Workspace tab.

 

1
2
3
4
5
6
7
<task name="RedSquareCodelet">
	<tasktype>BasicAttentionCodelet</tasktype>
	<ticksperrun>50</ticksperrun>
	<param name="nodes" type="string">red,square</param>
	<param name="refractoryPeriod" type="int">300</param>
	<param name="initialActivation" type="double">1.0</param>
</task>


Code Snippet 6 - ticksPerRun and refractoryPeriod parameters change.

1.2.3 Exercise 3

In this exercise, a new feature detector for detecting white screen was implemented. It was called WhiteScreenFeatureDetector.

 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
package myagent.featuredetectors;

import java.util.HashMap;
import java.util.Map;

import edu.memphis.ccrg.lida.pam.tasks.BasicDetectionAlgorithm;

public class WhiteScreenFeatureDetector extends BasicDetectionAlgorithm {
    
    /*
     * Size of the shape in pixels.  
     */
    private int soughtArea = 1000;
    /*
     * The white background color.
     */
    private int backgroundColor = 0xFFFFFFFF;

    private Map<String, Object> smParams = new HashMap<String, Object>();
    
    @Override
    public void init() {
       super.init();
       smParams.put("mode","all");

       soughtArea = (Integer) getParam("area", 1000);
       backgroundColor = (Integer) getParam("backgroundColor", 0xFFFFFFFF);
    }

    @Override
    public double detect() {
        int[] layer = (int[]) sensoryMemory.getSensoryContent("visual",smParams);
        int area=0;
        for(int i=0;i<layer.length;i++){
            if(layer[i]==backgroundColor){
                area++;
            }
        }
	if ( area == layer.length )
            return 1.0;
	return 0.0;
    }
}

Code Snippet 7 - WhiteScreenFeatureDetector class.

 

1
2
3
4
5
6
7
8
9
<task name="WhiteScreenFeatureDetector">
	<class>myagent.featuredetectors.WhiteScreenFeatureDetector</class>
	<ticksperrun>5</ticksperrun>
	<associatedmodule>SensoryMemory</associatedmodule>
	<associatedmodule>PerceptualAssociativeMemory</associatedmodule>
	<param name="area" type="int">40</param>
	<param name="backgroundColor" type="int">-1</param>
	<param name="node" type="string">empty</param>
</task>

Code Snippet 8 - WhiteScreenFeatureDetector task.

 

 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
        <module name="PerceptualAssociativeMemory">
            <class>edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemoryImpl</class>
            <param name="pam.Upscale" type="double">.7 </param>
            <param name="pam.Downscale" type="double">.6 </param>
            <param name="pam.Selectivity" type="double">.5 </param>
            <param name="nodes">red,blue,square,circle,empty</param>
            <taskspawner>defaultTS</taskspawner>
            <initialTasks>
                <task name="RedDetector">
                    <tasktype>ColorDetector</tasktype>
                    <ticksperrun>3</ticksperrun>
                    <param name="color" type="int">-65536</param>
                    <param name="node" type="string">red</param>
                </task>
                <task name="SquareDetector">
                    <tasktype>ShapeDetector</tasktype>
                    <ticksperrun>3</ticksperrun>
                    <param name="area" type="int">40</param>
                    <param name="backgroundColor" type="int">-1</param>
                    <param name="node" type="string">square</param>
                </task>
                <task name="BlueDetector">
                    <tasktype>ColorDetector</tasktype>
                    <ticksperrun>3</ticksperrun>
                    <param name="color" type="int">-16776961</param>
                    <param name="node" type="string">blue</param>
                </task>
                <task name="CircleDetector">
                    <tasktype>ShapeDetector</tasktype>
                    <ticksperrun>3</ticksperrun>
                    <param name="area" type="int">31</param>
                    <param name="backgroundColor" type="int">-1</param>
                    <param name="node" type="string">circle</param>
                </task>
                    <task name="EmptyDetector">
                    <tasktype>WhiteScreenFeatureDetector</tasktype>
                    <ticksperrun>3</ticksperrun>
                    <param name="area" type="int">40</param>
                    <param name="backgroundColor" type="int">-1</param>
                    <param name="node" type="string">empty</param>
                </task>
                <task name="WhiteEmptyCodelet">
                    <tasktype>BasicAttentionCodelet</tasktype>
                    <ticksperrun>5</ticksperrun>
                    <param name="nodes" type="string">white,empty</param>
                    <param name="refractoryPeriod" type="int">30</param>
                    <param name="initialActivation" type="double">1.0</param>
                </task>
            </initialTasks>

Code Snippet 9 - PercentualAssociativeMemory new tasks.

1.3 TUTORIAL PROJECT

1.3.1 Exercise 1

Figure 8 - Alien life screen.

1.3.2 Exercise 2

The implemented code for this task is available for download following

1.3.3 Exercise 3

The implemented code for this task is available for download following

1.3.4 Exercise 4

The implemented code for this task is available for download following

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer