params);
45 | }
46 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/environment/EnvironmentImpl.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.environment;
9 |
10 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
11 | import edu.memphis.ccrg.lida.framework.FrameworkModuleImpl;
12 | import edu.memphis.ccrg.lida.framework.initialization.AgentXmlFactory;
13 |
14 | /**
15 | * Abstract implementation of {@link Environment} Environments should not be a
16 | * listener of anything besides GUIs. Rather, SensoryMemory and
17 | * SensoryMotorMemory should add environments as associated modules in the XML
18 | * configuration file.
19 | *
20 | * @author Ryan J. McCall
21 | */
22 | public abstract class EnvironmentImpl extends FrameworkModuleImpl implements
23 | Environment {
24 |
25 | /**
26 | * Default constructor will be invoked by {@link AgentXmlFactory} to create
27 | * this {@link FrameworkModule}
28 | */
29 | public EnvironmentImpl() {
30 | }
31 |
32 | /**
33 | * override to implement Environment's decay.
34 | *
35 | * @see FrameworkModule#decayModule(long)
36 | */
37 | @Override
38 | public void decayModule(long ticks) {
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/environment/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes which define the interface for environments which
3 | a framework Agent can sense from and perform actions in.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/episodicmemory/CueListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.episodicmemory;
9 |
10 | import edu.memphis.ccrg.lida.framework.ModuleListener;
11 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
12 | import edu.memphis.ccrg.lida.workspace.Workspace;
13 |
14 | /**
15 | * Listens to cues from the {@link Workspace}. This interface is typically
16 | * implemented by {@link EpisodicMemory} modules.
17 | *
18 | * @author Ryan J. McCall
19 | */
20 | public interface CueListener extends ModuleListener {
21 |
22 | /**
23 | * Receive a cue
24 | *
25 | * @param cue
26 | * a {@link NodeStructure} to cue {@link EpisodicMemory} with
27 | */
28 | public void receiveCue(NodeStructure cue);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/episodicmemory/EpisodicMemory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 |
9 | package edu.memphis.ccrg.lida.episodicmemory;
10 |
11 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
12 |
13 | /**
14 | * The interface for LIDA's episodic memory. Episodic memory in LIDA
15 | * communicates with the workspace, receiving memory cues, and returning local
16 | * associations.
17 | *
18 | * Specific implementations of episodic memories must implement this interface.
19 | * Every implementation of this interface must also implement
20 | * {@link edu.memphis.ccrg.lida.globalworkspace.BroadcastListener}.
21 | *
22 | * @author Javier Snaider
23 | */
24 | public interface EpisodicMemory extends FrameworkModule {
25 |
26 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/episodicmemory/LocalAssociationListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.episodicmemory;
9 |
10 | import edu.memphis.ccrg.lida.framework.ModuleListener;
11 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
12 |
13 | /**
14 | * Listen to response from Episodic memory to a previous cue. This cue need not
15 | * originate from this same Listener. Any class can originate the cue even if it
16 | * does not implement this interface.
17 | *
18 | * @author Ryan J. McCall
19 | */
20 | public interface LocalAssociationListener extends ModuleListener {
21 |
22 | /**
23 | * @param association
24 | * The response generated from the Episodic Memory to a previous
25 | * cue.
26 | */
27 | public void receiveLocalAssociation(NodeStructure association);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/episodicmemory/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of the Episodic Memory module and its default implementation.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/episodicmemory/sdm/Translator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 |
9 | package edu.memphis.ccrg.lida.episodicmemory.sdm;
10 |
11 | import cern.colt.bitvector.BitVector;
12 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
13 |
14 | /**
15 | * A translator between {@link BitVector} used in
16 | * {@link SparseDistributedMemory}, and {@link NodeStructure} used in many other
17 | * LIDA modules.
18 | *
19 | * @author Javier Snaider
20 | */
21 | public interface Translator {
22 |
23 | /**
24 | * Translates a {@link BitVector} into a {@link NodeStructure}.
25 | *
26 | * @param v
27 | * a {@link BitVector} containing the boolean vector to be
28 | * translated
29 | * @return the {@link NodeStructure} associated with the address
30 | */
31 | public NodeStructure translate(BitVector v);
32 |
33 | /**
34 | * Translates a {@link NodeStructure} into a {@link BitVector}.
35 | *
36 | * @param ns
37 | * the {@link NodeStructure} to be translated
38 | * @return a {@link BitVector} with the boolean address associated with the
39 | * {@link NodeStructure}
40 | */
41 | public BitVector translate(NodeStructure ns);
42 |
43 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/episodicmemory/sdm/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to an implementation of Sparse Distributed Memory (Kanerva).
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/Agent.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework;
9 |
10 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
11 |
12 | /**
13 | * A {@link FrameworkModule} containing all of the {@link FrameworkModule}s of
14 | * an agent.
15 | *
16 | * @author Javier Snaider
17 | *
18 | */
19 | public interface Agent extends FrameworkModule {
20 |
21 | /**
22 | * Returns the Task Manager
23 | *
24 | * @return {@link TaskManager} in charge of all tasks.
25 | */
26 | public TaskManager getTaskManager();
27 |
28 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/AgentImpl.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework;
9 |
10 | import java.util.logging.Level;
11 | import java.util.logging.Logger;
12 |
13 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
14 |
15 | /**
16 | * Basic {@link Agent} Implementation.
17 | *
18 | * @author Javier Snaider
19 | *
20 | */
21 | public class AgentImpl extends FrameworkModuleImpl implements Agent {
22 |
23 | private static final Logger logger = Logger.getLogger(AgentImpl.class
24 | .getCanonicalName());
25 |
26 | private TaskManager taskManager;
27 |
28 | /**
29 | * @param tm
30 | * {@link TaskManager}
31 | */
32 | public AgentImpl(TaskManager tm) {
33 | super(ModuleName.Agent);
34 | taskManager = tm;
35 | }
36 |
37 | @Override
38 | public void init() {
39 | taskManager.setDecayingModules(getSubmodules().values());
40 | logger.log(Level.INFO, "FrameworkModules have been started\n", 0L);
41 | }
42 |
43 | @Override
44 | public TaskManager getTaskManager() {
45 | return taskManager;
46 | }
47 |
48 | /**
49 | * Should do nothing, submodules' decayModule method is called in
50 | * FrameworkModuleImpl#taskManagerDecayModule.
51 | *
52 | * @see edu.memphis.ccrg.lida.framework.FrameworkModule#decayModule(long)
53 | */
54 | @Override
55 | public void decayModule(long ticks) {
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/ModuleListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.framework;
12 |
13 | /**
14 | * Implementations should be added to the agent.xml configuration file by
15 | * canonical name. i.e. package name + class name
16 | *
17 | * @author Javier Snaider
18 | */
19 | public interface ModuleListener {
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/FrameworkGuiController.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.framework.gui;
12 |
13 | import java.util.Map;
14 |
15 | import edu.memphis.ccrg.lida.framework.Agent;
16 | import edu.memphis.ccrg.lida.framework.gui.commands.Command;
17 |
18 | /**
19 | * Controller for the {@link FrameworkGui}. An interface between the Gui and
20 | * {@link Agent} implementing the MVC pattern.
21 | *
22 | * @author Javier Snaider
23 | */
24 | public interface FrameworkGuiController {
25 |
26 | /**
27 | * Executes a command specified by the name. This name corresponds to a
28 | * property in guiCommands.properties file.
29 | *
30 | * @param commandName
31 | * the name of the command, names must be defined in
32 | * guiCommands.properties
33 | * @param parameters
34 | * a Map of optional parameters for the command.
35 | * @return the result of the command.
36 | */
37 | public Object executeCommand(String commandName,
38 | Map parameters);
39 |
40 | /**
41 | * Executes a command sent by the GUI
42 | *
43 | * @param command
44 | * the command to execute.
45 | * @return The result of the command.
46 | */
47 | public Object executeCommand(Command command);
48 |
49 | /**
50 | * Sets the {@link Agent} this controller controls. This {@link Agent}
51 | * object represents the model.
52 | *
53 | * @param agent
54 | * {@link Agent}
55 | */
56 | public void registerAgent(Agent agent);
57 |
58 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/AddPanelCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.framework.Agent;
11 | import edu.memphis.ccrg.lida.framework.gui.FrameworkGui;
12 | import edu.memphis.ccrg.lida.framework.gui.panels.GuiPanel;
13 |
14 | /**
15 | * Command to add a {@link GuiPanel} to the {@link FrameworkGui}
16 | *
17 | * @author Tamas Madl
18 | */
19 | public class AddPanelCommand extends CommandImpl {
20 |
21 | @Override
22 | public void execute(Agent agent) {
23 | java.awt.Container parent = (java.awt.Container) getParameter("parent");
24 | javax.swing.JPanel panel = (javax.swing.JPanel) getParameter("panel");
25 |
26 | if (parent != null) {
27 | boolean panelFound = false;
28 | for (java.awt.Component c : parent.getComponents()) {
29 | if (c.equals(panel)) {
30 | panelFound = true;
31 | // panel exists, remove it
32 | parent.remove(panel);
33 | break;
34 | }
35 | }
36 | if (!panelFound) {
37 | // panel doesn't exist, add it
38 | parent.add(panel);
39 | }
40 | parent.repaint();
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/AddTicksCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.framework.Agent;
11 |
12 | /**
13 | * This command is used for the tick mode to add ticks for execution. A Integer
14 | * "ticks" parameter must be specified.
15 | *
16 | * @author Javier Snaider
17 | *
18 | */
19 | public class AddTicksCommand extends CommandImpl {
20 |
21 | @Override
22 | public void execute(Agent agent) {
23 | Integer ticks = (Integer) getParameter("ticks");
24 | if (ticks != null) {
25 | agent.getTaskManager().addTicksToExecute(ticks);
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/Command.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /*
9 | * To change this template, choose Tools | Templates
10 | * and open the template in the editor.
11 | */
12 |
13 | package edu.memphis.ccrg.lida.framework.gui.commands;
14 |
15 | import java.util.Map;
16 |
17 | import edu.memphis.ccrg.lida.framework.Agent;
18 |
19 | /**
20 | * A command is an encapsulation of an event from the Gui such as a button press
21 | * or a slider state change.
22 | *
23 | * Implementations should add themselves to guiCommands.properties.
24 | *
25 | * @author Javier Snaider
26 | */
27 | public interface Command {
28 |
29 | /**
30 | * Executes this command performing the necessary actions in the model (the
31 | * {@link Agent}).
32 | *
33 | * @param agent
34 | * {@link Agent} Object
35 | */
36 | public void execute(Agent agent);
37 |
38 | /**
39 | * Returns result of the command.
40 | *
41 | * @return the result of the command's execution
42 | */
43 | public Object getResult();
44 |
45 | /**
46 | * Sets optional parameters for command.
47 | *
48 | * @param parameters
49 | * parameters
50 | */
51 | public void setParameters(Map parameters);
52 |
53 | /**
54 | * Set single parameter for command.
55 | *
56 | * @param name
57 | * name of parameter
58 | * @param value
59 | * default value to use if parameter cannot be found
60 | */
61 | public void setParameter(String name, Object value);
62 |
63 | /**
64 | * Gets a parameter by name.
65 | *
66 | * @param name
67 | * retrieved parameter
68 | * @return the parameter
69 | */
70 | public Object getParameter(String name);
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/CommandImpl.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | import edu.memphis.ccrg.lida.framework.Agent;
14 |
15 | /**
16 | * Abstract implementation of {@link Command}. Extend from this base class to
17 | * create new commands overriding {@link #execute(Agent)}.
18 | *
19 | * @author Javier Snaider
20 | *
21 | */
22 | public abstract class CommandImpl implements Command {
23 |
24 | private Map parameters = new HashMap();
25 | /**
26 | * Result of the command's execution. May be set during the execution of the
27 | * {@link #execute(Agent)} method.
28 | */
29 | protected Object result;
30 |
31 | @Override
32 | public abstract void execute(Agent agent);
33 |
34 | @Override
35 | public Object getParameter(String name) {
36 | Object res = null;
37 | if (parameters != null) {
38 | res = parameters.get(name);
39 | }
40 | return res;
41 | }
42 |
43 | @Override
44 | public Object getResult() {
45 | return result;
46 | }
47 |
48 | @Override
49 | public void setParameter(String name, Object value) {
50 | parameters.put(name, value);
51 | }
52 |
53 | @Override
54 | public void setParameters(Map parameters) {
55 | this.parameters = parameters;
56 | }
57 |
58 | @Override
59 | public String toString() {
60 | return getClass().getSimpleName();
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/EnableTicksModeCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.framework.Agent;
11 |
12 | /**
13 | * This command is used for enabling or disabling the tick mode. A Boolean
14 | * "enable" parameter must be specified.
15 | *
16 | * @author Javier Snaider
17 | *
18 | */
19 | public class EnableTicksModeCommand extends CommandImpl {
20 |
21 | @Override
22 | public void execute(Agent agent) {
23 | Boolean b = (Boolean) getParameter("enable");
24 | if (b != null) {
25 | agent.getTaskManager().setInIntervalMode(b);
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/PauseRunningThreadsCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.framework.gui.commands;
12 |
13 | import edu.memphis.ccrg.lida.framework.Agent;
14 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTask;
15 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
16 |
17 | /**
18 | * Pauses all {@link FrameworkTask} using the {@link TaskManager}
19 | *
20 | * @author Javier Snaider
21 | *
22 | */
23 | public class PauseRunningThreadsCommand extends CommandImpl {
24 |
25 | @Override
26 | public void execute(Agent agent) {
27 | agent.getTaskManager().pauseTasks();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/QuitAllCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.framework.Agent;
11 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
12 |
13 | /**
14 | * Stops all thread execution and quits the system.
15 | *
16 | * @author Javier Snaider
17 | *
18 | */
19 | public class QuitAllCommand extends CommandImpl {
20 |
21 | @Override
22 | public void execute(Agent agent) {
23 | TaskManager tm = agent.getTaskManager();
24 | tm.pauseTasks();
25 | try {
26 | Thread.sleep(100);
27 | } catch (InterruptedException e) {
28 | e.printStackTrace();
29 | }
30 | tm.stopRunning();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/ResetEnvironmentCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.environment.Environment;
11 | import edu.memphis.ccrg.lida.framework.Agent;
12 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
13 | import edu.memphis.ccrg.lida.framework.ModuleName;
14 |
15 | /**
16 | * Resets the {@link Environment} of the current application.
17 | *
18 | * @author Ryan Mccall
19 | *
20 | */
21 | public class ResetEnvironmentCommand extends CommandImpl {
22 |
23 | @Override
24 | public void execute(Agent agent) {
25 | FrameworkModule environ = agent.getSubmodule(ModuleName.Environment);
26 | if (environ != null && environ instanceof Environment) {
27 | ((Environment) environ).resetState();
28 | }
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/ResumeRunningThreadsCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.framework.Agent;
11 |
12 | /**
13 | * Resumes Tasks execution.
14 | *
15 | * @author Javier Snaider
16 | *
17 | */
18 | public class ResumeRunningThreadsCommand extends CommandImpl {
19 |
20 | @Override
21 | public void execute(Agent agent) {
22 | agent.getTaskManager().resumeTasks();
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/SetTimeScaleCommand.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.commands;
9 |
10 | import edu.memphis.ccrg.lida.framework.Agent;
11 |
12 | /**
13 | * Sets the tickDuration of the system.
14 | *
15 | * A Integer "tickDuration" parameter must be specified.
16 | *
17 | * @author Javier Snaider
18 | *
19 | */
20 | public class SetTimeScaleCommand extends CommandImpl {
21 |
22 | @Override
23 | public void execute(Agent agent) {
24 | Integer tickDuration = (Integer) getParameter("tickDuration");
25 | if (tickDuration != null) {
26 | agent.getTaskManager().setTickDuration(tickDuration);
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/commands/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to GUI commands; the encapsulation of actions to be taken in the model (the Agent)
3 | which are generated in the GUI.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/events/FrameworkGuiEventListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /*
9 | * To change this template, choose Tools | Templates
10 | * and open the template in the editor.
11 | */
12 |
13 | package edu.memphis.ccrg.lida.framework.gui.events;
14 |
15 | /**
16 | * An object that listens for FrameworkGuiEvents, that is, data being sent from
17 | * the model (framework) to the GUI.
18 | *
19 | * @author Javier Snaider
20 | */
21 | public interface FrameworkGuiEventListener {
22 |
23 | /**
24 | * Must be able to receive FrameworkGuiEvents
25 | *
26 | * @param event
27 | * GuiEvent
28 | */
29 | public void receiveFrameworkGuiEvent(FrameworkGuiEvent event);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/events/GuiEventProvider.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.gui.events;
9 |
10 | /**
11 | * A GuiContentProvider is a class that provides content to a GUI. The GUIs
12 | * listen to providers, following Observer pattern.
13 | *
14 | * @author Ryan J. McCall
15 | *
16 | */
17 | public interface GuiEventProvider {
18 |
19 | /**
20 | * Must be able to register FrameworkGuiEvent listeners
21 | *
22 | * @param listener
23 | * receiver of GuiEvents, typically a GuiPanel
24 | */
25 | public void addFrameworkGuiEventListener(FrameworkGuiEventListener listener);
26 |
27 | /**
28 | * This is a convenience method to send GUI events to listeners.
29 | *
30 | * @param event
31 | * GuiEvent
32 | */
33 | public void sendEventToGui(FrameworkGuiEvent event);
34 | }
35 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/events/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to GUI events -- encapsulations of events generated in the model (the agent)
3 | which are sent to the GUI.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the framework's GUI and GUI controller.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/panels/GuiPanelImpl.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
29 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/panels/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to GuiPanels which can be added to the framework's GUI to display particular information.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/utils/NodeIcon.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.framework.gui.utils;
12 |
13 | import java.awt.Color;
14 | import java.awt.Component;
15 | import java.awt.Graphics;
16 |
17 | import javax.swing.Icon;
18 |
19 | import edu.memphis.ccrg.lida.framework.gui.panels.NodeStructurePanel;
20 | import edu.memphis.ccrg.lida.framework.shared.Link;
21 | import edu.memphis.ccrg.lida.framework.shared.Node;
22 |
23 | /**
24 | * Utility which {@link NodeStructurePanel} uses to represent {@link Node} and
25 | * {@link Link}.
26 | *
27 | * @author Javier Snaider
28 | *
29 | */
30 | public class NodeIcon implements Icon {
31 |
32 | /**
33 | * Default node icon
34 | */
35 | public static final Icon NODE_ICON = new NodeIcon(20, Color.red);
36 | /**
37 | * Default link icon
38 | */
39 | public static final Icon LINK_ICON = new NodeIcon(5, Color.black);
40 |
41 | private int size;
42 | private Color color;
43 |
44 | /**
45 | * @param size
46 | * NodeIcon size
47 | * @param color
48 | * NodeIcon color
49 | */
50 | public NodeIcon(int size, Color color) {
51 | this.color = color;
52 | this.size = size;
53 | }
54 |
55 | @Override
56 | public int getIconHeight() {
57 | return size;
58 | }
59 |
60 | @Override
61 | public int getIconWidth() {
62 | return size;
63 | }
64 |
65 | @Override
66 | public void paintIcon(Component c, Graphics g, int x, int y) {
67 | g.setColor(color);
68 | g.fillOval(x, y, size, size);
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/gui/utils/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains utility classes for the GUI.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/initialization/AgentFactory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.initialization;
9 |
10 | import java.util.Properties;
11 |
12 | import edu.memphis.ccrg.lida.framework.Agent;
13 |
14 | /**
15 | * Factory for {@link Agent} objects.
16 | *
17 | * @author Javier Snaider
18 | */
19 | public interface AgentFactory {
20 |
21 | /**
22 | * Creates and returns a {@link Agent} from specified {@link Properties}
23 | *
24 | * @param properties
25 | * Agent properties
26 | * @return Constructed {@link Agent} object
27 | */
28 | public Agent getAgent(Properties properties);
29 |
30 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/initialization/FrameworkFormatter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.initialization;
9 |
10 | import java.text.MessageFormat;
11 | import java.util.logging.Formatter;
12 | import java.util.logging.Handler;
13 | import java.util.logging.LogManager;
14 | import java.util.logging.LogRecord;
15 |
16 | /**
17 | * Logger formatter for the framework that can be used with any {@link Handler}.
18 | *
19 | * @author Javier Snaider
20 | * @see LogManager
21 | */
22 | public class FrameworkFormatter extends Formatter {
23 |
24 | @Override
25 | public String format(LogRecord logRecord) {
26 | String logMessages = new String("");
27 | // String dateString="";
28 | long actualTick = 0L;
29 | // String name;
30 |
31 | String message = logRecord.getMessage();
32 | if (message != null) {
33 | MessageFormat mf = new MessageFormat(message);
34 |
35 | Object[] param = logRecord.getParameters();
36 | if (param != null && param[0] instanceof Long) {
37 | actualTick = (Long) param[0];
38 | }
39 | logMessages = String.format(
40 | "%010d :%010d :%-10s :%-60s \t-> %s %n", logRecord
41 | .getSequenceNumber(), actualTick, logRecord
42 | .getLevel(), logRecord.getLoggerName(), mf
43 | .format(logRecord.getParameters()));
44 | return logMessages;
45 | }
46 | return "";
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/initialization/FullyInitializable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.initialization;
9 |
10 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
11 |
12 | /**
13 | * An {@link Initializable} object e.g. an {@link FrameworkModule} that is
14 | * initialized by the AgentXmlFactory.
15 | *
16 | * @author Ryan J. McCall
17 | * @author Javier Snaider
18 | *
19 | * @see AgentXmlFactory
20 | * @see FrameworkModule
21 | */
22 | public interface FullyInitializable extends Initializable {
23 |
24 | /**
25 | * Sets an associated FrameworkModule.
26 | *
27 | * @param m
28 | * the module to be associated.
29 | * @param usg
30 | * how module will be used
31 | * @see ModuleUsage
32 | */
33 | public void setAssociatedModule(FrameworkModule m, String usg);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/initialization/Initializer.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.initialization;
9 |
10 | import java.util.Map;
11 |
12 | import edu.memphis.ccrg.lida.framework.Agent;
13 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
14 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTask;
15 |
16 | /**
17 | * An initializer configures a {@link FullyInitializable}.
18 | *
19 | * @author Ryan J. McCall
20 | */
21 | public interface Initializer {
22 |
23 | /**
24 | * Receives a particular {@link FullyInitializable} to configure. The
25 | * {@link Agent} object and a map of parameters can be used in the specific
26 | * initialization code. Named 'initModule' historically, however an
27 | * initializer need not initialize a {@link FrameworkModule}, for example a
28 | * {@link FrameworkTask} is also valid.
29 | *
30 | * @param obj
31 | * the {@link FullyInitializable} object being initialized
32 | * @param a
33 | * the {@link Agent} object
34 | * @param params
35 | * parameters to configure the {@link FullyInitializable}
36 | *
37 | */
38 | public void initModule(FullyInitializable obj, Agent a,
39 | Map params);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/initialization/ModuleUsage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.initialization;
9 |
10 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
11 |
12 | /**
13 | * Specifies different ways a {@link FullyInitializable} will use an associated
14 | * module.
15 | *
16 | * @see FullyInitializable#setAssociatedModule(FrameworkModule, String)
17 | * @author Javier Snaider
18 | *
19 | */
20 | @SuppressWarnings(value = { "all" })
21 | public class ModuleUsage {
22 | // TODO dynamic enum like ModuleName
23 |
24 | public static final String NOT_SPECIFIED = "NOT_SPECIFIED";
25 | public static final String TO_READ_FROM = "TO_READ_FROM";
26 | public static final String TO_WRITE_TO = "TO_WRITE_TO";
27 | public static final String TO_DELETE_FROM = "TO_DELETE_FROM";
28 | public static final String TO_CHECK_FROM = "TO_CHECK_FROM";
29 | public static final String TO_LISTEN_FROM = "TO_LISTEN_FROM";
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/initialization/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes involved in the run-time creation of the Agent and the initialization of the ElementFactory from various configuration files.
3 | Also includes classes which define the way various components of an Agent are configured.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes which define the main structures of framework Agents.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/LinkCategory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.shared;
9 |
10 | import edu.memphis.ccrg.lida.pam.PamNode;
11 |
12 | /**
13 | * Specifies the category of a Link.
14 | *
15 | * @see PamNode
16 | * @see Link
17 | * @author Javier Snaider
18 | * @author Ryan J. McCall
19 | */
20 | public interface LinkCategory {
21 |
22 | /**
23 | * @return readable label
24 | */
25 | public String getLabel();
26 |
27 | /**
28 | * @return category's id
29 | */
30 | public int getId();
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/Linkable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.shared;
9 |
10 | import edu.memphis.ccrg.lida.framework.initialization.Initializable;
11 | import edu.memphis.ccrg.lida.framework.shared.activation.Activatible;
12 |
13 | /**
14 | * A object that can have links attached to it.
15 | *
16 | * @author Javier Snaider
17 | * @author Ryan J. McCall
18 | */
19 | public interface Linkable extends Activatible, Initializable {
20 |
21 | /**
22 | * Gets label.
23 | *
24 | * @return readable label
25 | */
26 | public String getLabel();
27 |
28 | /**
29 | * Gets extendedId.
30 | *
31 | * @return a general id for Linkables.
32 | */
33 | public ExtendedId getExtendedId();
34 |
35 | /**
36 | * Gets factory type
37 | *
38 | * @return the factory type of the Linkable
39 | * @see ElementFactory
40 | */
41 | public String getFactoryType();
42 |
43 | /**
44 | * Sets factory type
45 | *
46 | * @param t
47 | * the factory type of the Linkable
48 | * @see ElementFactory
49 | */
50 | public void setFactoryType(String t);
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/NodeType.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.framework.shared;
2 |
3 | /**
4 | * A marker of Node type. Different types are treated differently in
5 | * {@link NodeStructure}. This feature is not fully implemented in this
6 | * framework version.
7 | *
8 | * @author Ryan J. McCall
9 | */
10 | public enum NodeType {
11 |
12 | /**
13 | * Catch-all type
14 | */
15 | defaultType,
16 | /**
17 | * {@link Node}s that represent objects
18 | */
19 | object,
20 | /**
21 | * {@link Node}s that represent events
22 | */
23 | event,
24 | /**
25 | * {@link Node}s that represent built-in need feelings e.g. thirst, hunger
26 | */
27 | needFeeling,
28 | /**
29 | * {@link Node}s that represent interpretive (appraisal) feelings, e.g.
30 | * sweet, sour
31 | */
32 | interprativeFeeling
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/RefractoryPeriod.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.shared;
9 |
10 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
11 |
12 | /**
13 | * Implementors of this interface can have a refractory period. The unit of the
14 | * time period is in ticks, the unit of time in the framework.
15 | *
16 | * @see TaskManager
17 | * @author Ryan J. McCall
18 | */
19 | public interface RefractoryPeriod {
20 |
21 | /**
22 | * Sets refractoryPeriod
23 | *
24 | * @param ticks
25 | * length of refractory period in ticks
26 | * @see TaskManager
27 | */
28 | public void setRefractoryPeriod(int ticks);
29 |
30 | /**
31 | * Gets refractoryPeriod
32 | *
33 | * @return length of refractory period in ticks
34 | * @see TaskManager
35 | */
36 | public int getRefractoryPeriod();
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/Translatable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 |
9 | package edu.memphis.ccrg.lida.framework.shared;
10 |
11 | import cern.colt.bitvector.BitVector;
12 |
13 | /**
14 | *
15 | * @author Rodrigo Silva-Lugo
16 | */
17 | public interface Translatable {
18 |
19 | /**
20 | * @param vector
21 | * BitVector
22 | */
23 | public void setSdmId(BitVector vector);
24 |
25 | /**
26 | * @return BitVector
27 | */
28 | public BitVector getSdmId();
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/activation/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes which define activation attributes and operations related to these activations.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/shared/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to common data structures used in the framework.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/DecayStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | import java.util.Map;
11 |
12 | import edu.memphis.ccrg.lida.framework.shared.ElementFactory;
13 |
14 | /**
15 | * A strategy pattern for decaying Activatibles or Learnables
16 | *
17 | * Implementations should add themselves to {@link ElementFactory} via the
18 | * factoriesData.xml configuration file.
19 | *
20 | * @author Javier Snaider
21 | * @author Ryan J. McCall
22 | */
23 | public interface DecayStrategy extends Strategy {
24 |
25 | /**
26 | * Decays the current activation according to some internal decay function.
27 | *
28 | * @param currentActivation
29 | * activation of the entity before decay.
30 | * @param ticks
31 | * The number of ticks to decay.
32 | * @param params
33 | * optional parameters
34 | * @return new activation
35 | */
36 | public double decay(double currentActivation, long ticks, Object... params);
37 |
38 | /**
39 | * Decays the current activation according to some internal decay function.
40 | *
41 | * @param currentActivation
42 | * activation of the entity before decay.
43 | * @param ticks
44 | * how much time has passed since last decay
45 | * @param params
46 | * parameters
47 | * @return new activation amount
48 | */
49 | public double decay(double currentActivation, long ticks,
50 | Map params);
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/DefaultTotalActivationStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | /**
11 | * Default method to calculate total activation. Sums activations returning sum
12 | * or 1.0, whichever is lowest.
13 | *
14 | * @author Ryan J. McCall
15 | *
16 | */
17 | public class DefaultTotalActivationStrategy extends StrategyImpl implements
18 | TotalActivationStrategy {
19 |
20 | @Override
21 | public double calculateTotalActivation(double baseLevelActivation,
22 | double currentActivation) {
23 | double sum = baseLevelActivation + currentActivation;
24 | return (sum > 1.0) ? 1.0 : sum;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/ExciteStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | import java.util.Map;
11 |
12 | import edu.memphis.ccrg.lida.framework.shared.ElementFactory;
13 |
14 | /**
15 | * A strategy pattern for exciting Activatibles or Learnables
16 | *
17 | * Implementations should add themselves to {@link ElementFactory} via the
18 | * factoriesData.xml configuration file.
19 | *
20 | *
21 | * @author Javier Snaider
22 | * @author Ryan J. McCall
23 | *
24 | */
25 | public interface ExciteStrategy extends Strategy {
26 |
27 | /**
28 | * Excites the current activation according to some internal excite
29 | * function.
30 | *
31 | * @param currentActivation
32 | * activation of the entity before excite.
33 | * @param excitation
34 | * amount of activation to adds
35 | * @param params
36 | * parameters
37 | * @return new activation amount
38 | */
39 | public double excite(double currentActivation, double excitation,
40 | Object... params);
41 |
42 | /**
43 | * Excites the current activation according to some internal excite
44 | * function.
45 | *
46 | * @param currentActivation
47 | * activation of the entity before excite.
48 | * @param excitation
49 | * amount of activation to adds
50 | * @param params
51 | * parameters
52 | * @return new activation amount
53 | */
54 | public double excite(double currentActivation, double excitation,
55 | Map params);
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/NoDecayStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | import java.util.Map;
11 |
12 | /**
13 | * A {@link DecayStrategy} that never modifies the activation passed to it.
14 | *
15 | * @author Ryan J. McCall
16 | * @author Javier Snaider
17 | */
18 | public class NoDecayStrategy extends StrategyImpl implements DecayStrategy {
19 |
20 | /**
21 | * Default constructor
22 | */
23 | public NoDecayStrategy() {
24 | }
25 |
26 | /**
27 | * Decays the current activation according to some internal decay function.
28 | *
29 | * @param currentActivation
30 | * activation of the entity before decay.
31 | * @param ticks
32 | * The number of ticks to decay.
33 | * @param params
34 | * optional parameters: N/A
35 | * @return new activation
36 | */
37 | @Override
38 | public double decay(double currentActivation, long ticks, Object... params) {
39 | return currentActivation;
40 | }
41 |
42 | /**
43 | * Decays the current activation according to some internal decay function.
44 | *
45 | * @param currentActivation
46 | * activation of the entity before decay.
47 | * @param ticks
48 | * how much time has passed since last decay
49 | * @param params
50 | * parameters: N/A
51 | * @return new activation amount
52 | */
53 | @Override
54 | public double decay(double currentActivation, long ticks,
55 | Map params) {
56 | return currentActivation;
57 | }
58 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/NoExciteStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | import java.util.Map;
11 |
12 | /**
13 | * An {@link ExciteStrategy} that never modifies the activation passed to it.
14 | *
15 | * @author Ryan J. McCall
16 | * @author Javier Snaider
17 | */
18 | public class NoExciteStrategy extends StrategyImpl implements ExciteStrategy {
19 |
20 | /**
21 | * Default constructor
22 | */
23 | public NoExciteStrategy() {
24 | }
25 |
26 | /**
27 | * Excites the current activation according to some internal excite
28 | * function.
29 | *
30 | * @param currentActivation
31 | * activation of the entity before excite.
32 | * @param excitation
33 | * amount of activation to adds
34 | * @param params
35 | * parameters: N/A
36 | * @return new activation amount
37 | */
38 | @Override
39 | public double excite(double currentActivation, double excitation,
40 | Object... params) {
41 | return currentActivation;
42 | }
43 |
44 | /**
45 | * Excites the current activation according to some internal excite
46 | * function.
47 | *
48 | * @param currentActivation
49 | * activation of the entity before excite.
50 | * @param excitation
51 | * amount of activation to adds
52 | * @param params
53 | * parameters: N/A
54 | * @return new activation amount
55 | */
56 | @Override
57 | public double excite(double currentActivation, double excitation,
58 | Map params) {
59 | return currentActivation;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/Strategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.framework.strategies;
12 |
13 | import edu.memphis.ccrg.lida.framework.initialization.Initializable;
14 |
15 | /**
16 | * Generic designation for all types of strategies such as decay, excite, etc.
17 | *
18 | * @author Javier Snaider
19 | */
20 | public interface Strategy extends Initializable {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/StrategyImpl.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | import edu.memphis.ccrg.lida.framework.initialization.InitializableImpl;
11 |
12 | /**
13 | * Abstract implementation of {@link Strategy}
14 | *
15 | * @author Javier Snaider
16 | * @author Ryan J. McCall
17 | */
18 | public abstract class StrategyImpl extends InitializableImpl implements
19 | Strategy {
20 |
21 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/TotalActivationStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.strategies;
9 |
10 | /**
11 | * A strategy that calculates total activation.
12 | *
13 | * @author Ryan J. McCall
14 | */
15 | public interface TotalActivationStrategy extends Strategy {
16 |
17 | /**
18 | * Calculates and returns total activation.
19 | *
20 | * @param bla
21 | * Base-level activation
22 | * @param ca
23 | * current activation
24 | * @return calculated total activation
25 | */
26 | public double calculateTotalActivation(double bla, double ca);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/WeightedTotalActivationStrategy.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.framework.strategies;
2 |
3 |
4 | /**
5 | * Computes total activation as a weighted average of base-level and current.
6 | * @author Ryan J. McCall
7 | */
8 | public class WeightedTotalActivationStrategy extends StrategyImpl implements TotalActivationStrategy {
9 |
10 |
11 | private static final double DEFAULT_BLA_WEIGHT = 0.1;
12 | private double blaWeight;
13 |
14 | @Override
15 | public void init(){
16 | blaWeight = getParam("blaWeight",DEFAULT_BLA_WEIGHT);
17 | }
18 |
19 | @Override
20 | public double calculateTotalActivation(double baseLevelActivation, double currentActivation) {
21 | double sum = (blaWeight*baseLevelActivation + (1-blaWeight)*currentActivation)/2;
22 | return (sum > 1.0)? 1.0 : sum;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/strategies/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains the various strategies (implementors of the strategy design pattern) used in the framework to implement excitation, decay, etc.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/tasks/Codelet.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.framework.tasks;
12 |
13 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
14 | import edu.memphis.ccrg.lida.workspace.workspacebuffers.WorkspaceBuffer;
15 |
16 | /**
17 | * A task that represents a demon-like processor.
18 | *
19 | * @author Javier Snaider
20 | * @author Ryan J. McCall
21 | */
22 | public interface Codelet extends FrameworkTask {
23 |
24 | /**
25 | * @return the sought content
26 | */
27 | public NodeStructure getSoughtContent();
28 |
29 | /**
30 | * @param content
31 | * the content the codelet looks for.
32 | */
33 | public void setSoughtContent(NodeStructure content);
34 |
35 | /**
36 | * Returns true if specified WorkspaceBuffer contains this codelet's sought
37 | * content.
38 | *
39 | * @param buffer
40 | * the WorkspaceBuffer to be checked for content
41 | * @return true, if successful
42 | */
43 | public boolean bufferContainsSoughtContent(WorkspaceBuffer buffer);
44 |
45 | /**
46 | * Returns sought content and related content from specified
47 | * WorkspaceBuffer.
48 | *
49 | * @param buffer
50 | * the buffer
51 | * @return the workspace content
52 | */
53 | public NodeStructure retrieveWorkspaceContent(WorkspaceBuffer buffer);
54 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/tasks/CodeletImpl.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.tasks;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
11 | import edu.memphis.ccrg.lida.framework.shared.NodeStructureImpl;
12 |
13 | /**
14 | * Abstract implementation of {@link Codelet}.
15 | *
16 | * @author Ryan J. McCall
17 | */
18 | public abstract class CodeletImpl extends FrameworkTaskImpl implements Codelet {
19 |
20 | /**
21 | * Content which this codelet responds to.
22 | */
23 | protected NodeStructure soughtContent = new NodeStructureImpl();
24 |
25 | @Override
26 | public NodeStructure getSoughtContent() {
27 | return soughtContent;
28 | }
29 |
30 | @Override
31 | public void setSoughtContent(NodeStructure content) {
32 | soughtContent = content;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/tasks/TaskStatus.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.framework.tasks;
9 |
10 | /**
11 | * Enumeration of the possible statuses of FrameworkTasks.
12 | *
13 | * @author Javier Snaider.
14 | */
15 | public enum TaskStatus {
16 |
17 | /**
18 | * FrameworkTask status value: Task is running
19 | */
20 | RUNNING,
21 |
22 | /**
23 | * FrameworkTask status value: Task is finished, cannot be restarted, and
24 | * cannot have its TaskStatus changed again
25 | */
26 | CANCELED,
27 |
28 | /**
29 | * FrameworkTask status value: Task is finished
30 | */
31 | FINISHED,
32 |
33 | /**
34 | * FrameworkTask status value: Task has finished and has results to process
35 | */
36 | FINISHED_WITH_RESULTS
37 | }
38 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/framework/tasks/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the framework's tasks (small demon-like processes) and their management.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/BroadcastContent.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.globalworkspace;
9 |
10 | /**
11 | * This interface serves as a mark for data which is sent in the conscious
12 | * broadcast.
13 | *
14 | * @author Javier Snaider
15 | */
16 | public interface BroadcastContent {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/BroadcastListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.globalworkspace;
12 |
13 | import edu.memphis.ccrg.lida.framework.ModuleListener;
14 |
15 | /**
16 | * Modules that receive the conscious broadcast must implement this interface.
17 | * Implementers will receive each winning {@link Coalition} from the
18 | * {@link GlobalWorkspace}.
19 | *
20 | * @author Javier Snaider
21 | * @author Ryan J. McCall
22 | */
23 | public interface BroadcastListener extends ModuleListener {
24 |
25 | /**
26 | * Listener must receive a broadcast of a the winning {@link Coalition} This
27 | * method should return as possible in order to not delay the rest of the
28 | * broadcasting.
29 | *
30 | * @param c
31 | * the {@link Coalition} that won the most recent competition for
32 | * consciousness
33 | */
34 | public void receiveBroadcast(Coalition c);
35 |
36 | /**
37 | * A place-holder method to remind implementing classes that they should
38 | * implement learning. LIDA theory says receivers of the broadcast should
39 | * learn from it. This method will not be called directly by the
40 | * {@link GlobalWorkspace} and thus it should be managed by the receiving
41 | * module.
42 | *
43 | * @param c
44 | * the {@link Coalition} that won the most recent competition for
45 | * consciousness
46 | */
47 | public void learn(Coalition c);
48 |
49 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/Coalition.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | /**
9 | *
10 | */
11 | package edu.memphis.ccrg.lida.globalworkspace;
12 |
13 | import edu.memphis.ccrg.lida.attentioncodelets.AttentionCodelet;
14 | import edu.memphis.ccrg.lida.framework.shared.activation.Activatible;
15 |
16 | /**
17 | * An encapsulation of perceptual content and an {@link AttentionCodelet}
18 | * {@link Coalition} objects are created and added to the
19 | * {@link GlobalWorkspace} by {@link AttentionCodelet} objects.
20 | * {@link Coalition} must overwrite correctly {@link Object#equals(Object)} and
21 | * {@link Object#hashCode()} methods.
22 | *
23 | * @author Javier Snaider
24 | * @author Ryan J. McCall
25 | */
26 | public interface Coalition extends Activatible {
27 |
28 | /**
29 | * Gets the content of the coalition.
30 | * @return The {@link BroadcastContent} of the coalition
31 | */
32 | public BroadcastContent getContent();
33 |
34 | /**
35 | * Sets the content of the coalition.
36 | * @param c {@link BroadcastContent}
37 | */
38 | public void setContent(BroadcastContent c);
39 |
40 | /**
41 | * Returns the {@link AttentionCodelet} that created this coalition
42 | * @return The {@link AttentionCodelet} that help form this coalition
43 | */
44 | public AttentionCodelet getCreatingAttentionCodelet();
45 |
46 | /**
47 | * Sets the {@link AttentionCodelet} that created this coalition.
48 | * @param c {@link AttentionCodelet} that created this coalition
49 | */
50 | public void setCreatingAttentionCodelet(AttentionCodelet c);
51 |
52 | /**
53 | * Gets the id.
54 | * @return the unique id of the Coalition
55 | */
56 | public int getId();
57 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the GlobalWorkspace, the module responsible for selecting the most
3 | important part of an Agent's current understanding, at the particular moment, for broadcast to all BroadcastListeners.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/triggers/IndividualCoaltionActivationTrigger.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.globalworkspace.triggers;
9 |
10 | import java.util.Collection;
11 | import java.util.logging.Level;
12 | import java.util.logging.Logger;
13 |
14 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
15 | import edu.memphis.ccrg.lida.globalworkspace.Coalition;
16 | import edu.memphis.ccrg.lida.globalworkspace.GlobalWorkspace;
17 |
18 | /**
19 | * A trigger that fires if any coalition is above a threshold.
20 | *
21 | * @author Javier Snaider
22 | *
23 | */
24 | public class IndividualCoaltionActivationTrigger extends
25 | AggregateCoalitionActivationTrigger {
26 |
27 | private static final Logger logger = Logger
28 | .getLogger(IndividualCoaltionActivationTrigger.class
29 | .getCanonicalName());
30 |
31 | /**
32 | * Triggers a broadcast if any {@link Coalition} object's activation is over
33 | * threshold.
34 | *
35 | * @param coalitions
36 | * {@link Coalition} objects current in the
37 | * {@link GlobalWorkspace}
38 | */
39 | @Override
40 | public void checkForTriggerCondition(Collection coalitions) {
41 | for (Coalition c : coalitions) {
42 | if (c.getActivation() > threshold) {
43 | logger.log(Level.FINE, "Individual Activation trigger fires",
44 | TaskManager.getCurrentTick());
45 | gw.triggerBroadcast(this);
46 | break;
47 | }
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/triggers/NoCoalitionArrivingTrigger.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.globalworkspace.triggers;
9 |
10 | import java.util.Collection;
11 | import java.util.TimerTask;
12 |
13 | import edu.memphis.ccrg.lida.globalworkspace.Coalition;
14 | import edu.memphis.ccrg.lida.globalworkspace.GlobalWorkspace;
15 |
16 | /**
17 | * A trigger that fires when a certain number of ticks have passed without a new
18 | * {@link Coalition} being added to the {@link GlobalWorkspace}. Inherits most
19 | * of its fields and methods from its parent class
20 | * {@link NoBroadcastOccurringTrigger}.
21 | *
22 | * @author Javier Snaider
23 | * @see NoBroadcastOccurringTrigger
24 | */
25 | public class NoCoalitionArrivingTrigger extends NoBroadcastOccurringTrigger {
26 |
27 | /**
28 | * Called each time a new coalition is added to the {@link GlobalWorkspace}.
29 | * Specifically for this trigger {@link NoBroadcastOccurringTrigger#reset()}
30 | * is called which resets the {@link TimerTask} object. Thus this trigger
31 | * fires when a certain number of ticks have passed without a new
32 | * {@link Coalition} entering the {@link GlobalWorkspace}.
33 | *
34 | * @param coalitions
35 | * {@link Coalition} objects the trigger can check
36 | */
37 | @Override
38 | public void checkForTriggerCondition(Collection coalitions) {
39 | reset();
40 | }
41 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/triggers/TriggerListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.globalworkspace.triggers;
9 |
10 | import edu.memphis.ccrg.lida.globalworkspace.GlobalWorkspace;
11 |
12 | /**
13 | * This interface should be implemented by the class that wants to receive
14 | * {@link BroadcastTrigger} notifications. In general, it is the same class that
15 | * implements {@link GlobalWorkspace} interface.
16 | *
17 | * @author Javier Snaider
18 | */
19 | public interface TriggerListener {
20 |
21 | /**
22 | * Listener must trigger a competition for consciousness and a conscious
23 | * broadcast of the winner
24 | *
25 | * @param t
26 | * trigger that is initiating the broadcast
27 | */
28 | public void triggerBroadcast(BroadcastTrigger t);
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/globalworkspace/triggers/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the triggering of the competition for the global conscious broadcast.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/pam/FeelingPamLinkImpl.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.pam;
2 |
3 | import edu.memphis.ccrg.lida.motivation.shared.Valenceable;
4 | import edu.memphis.ccrg.lida.motivation.shared.ValenceableImpl;
5 | import edu.memphis.ccrg.lida.pam.PamLink;
6 | import edu.memphis.ccrg.lida.pam.PamLinkImpl;
7 |
8 | /**
9 | * A {@link PamLink} with a valence.
10 | * @author Ryan J McCall
11 | */
12 | public class FeelingPamLinkImpl extends PamLinkImpl implements Valenceable {
13 |
14 | private ValenceableImpl valence = new ValenceableImpl();
15 |
16 | @Override
17 | public int getValenceSign() {
18 | return valence.getValenceSign();
19 | }
20 |
21 | @Override
22 | public void setValenceSign(int s) {
23 | valence.setValenceSign(s);
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/pam/FeelingPamNodeImpl.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.pam;
2 |
3 | import edu.memphis.ccrg.lida.motivation.shared.FeelingNode;
4 | import edu.memphis.ccrg.lida.motivation.shared.ValenceableImpl;
5 | import edu.memphis.ccrg.lida.pam.PamNode;
6 | import edu.memphis.ccrg.lida.pam.PamNodeImpl;
7 |
8 | /**
9 | * A {@link PamNode} with a valence and a flag signifying whether or not it is a drive feeling.
10 | * @author Ryan J McCall
11 | */
12 | public class FeelingPamNodeImpl extends PamNodeImpl implements FeelingNode {
13 |
14 | private ValenceableImpl valence = new ValenceableImpl();
15 | private boolean isDrive;
16 |
17 | @Override
18 | public int getValenceSign() {
19 | return valence.getValenceSign();
20 | }
21 |
22 | @Override
23 | public void setValenceSign(int s) {
24 | valence.setValenceSign(s);
25 | }
26 |
27 | @Override
28 | public double getAffectiveValence() {
29 | return getValenceSign()*getTotalActivation();
30 | }
31 |
32 | @Override
33 | public boolean isDrive() {
34 | return isDrive;
35 | }
36 |
37 | @Override
38 | public void setDrive(boolean b) {
39 | isDrive = b;
40 | }
41 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/pam/IncentiveSaliencePropagationTask.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.pam;
2 |
3 | import edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemory;
4 | import edu.memphis.ccrg.lida.pam.tasks.PropagationTask;
5 |
6 | /**
7 | * Task for the propagation of current incentive salience, originating from a drive feeling nodes, along an incentive salience link.
8 | * The key key difference with this link is that it transmits current incentive salience to its sink and adds a valence to the
9 | * excitation amount;
10 | * @author Ryan J McCall
11 | */
12 | public class IncentiveSaliencePropagationTask extends PropagationTask {
13 |
14 | /**
15 | * @param tpr ticks per run
16 | * @param lnk a {@link FeelingPamLinkImpl}
17 | * @param a an excitation amount
18 | * @param pam the {@link PerceptualAssociativeMemory} module.
19 | */
20 | public IncentiveSaliencePropagationTask(int tpr,FeelingPamLinkImpl lnk,
21 | double a,PerceptualAssociativeMemory pam) {
22 | super(tpr,lnk,a,pam);
23 | }
24 |
25 | @Override
26 | protected void runThisFrameworkTask() {
27 | link.exciteActivation(excitationAmount);
28 | //
29 | FeelingPamLinkImpl fLink = (FeelingPamLinkImpl) link;
30 | double propagatedIncentiveSalience = excitationAmount*fLink.getValenceSign()*fLink.getBaseLevelActivation();
31 | sink.exciteIncentiveSalience(propagatedIncentiveSalience);
32 | //
33 | runPostExcitation();
34 | }
35 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/proceduralmemory/MotivationProceduralMemoryInitializer.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.proceduralmemory;
2 |
3 | import java.util.Map;
4 | import java.util.logging.Level;
5 | import java.util.logging.Logger;
6 |
7 | import edu.memphis.ccrg.lida.framework.Agent;
8 | import edu.memphis.ccrg.lida.framework.initialization.FullyInitializable;
9 | import edu.memphis.ccrg.lida.framework.initialization.GlobalInitializer;
10 | import edu.memphis.ccrg.lida.framework.initialization.Initializable;
11 | import edu.memphis.ccrg.lida.framework.initialization.Initializer;
12 | import edu.memphis.ccrg.lida.framework.shared.LinkCategory;
13 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
14 | import edu.memphis.ccrg.lida.proceduralmemory.BasicProceduralMemoryInitializer;
15 |
16 | /**
17 | * An {@link Initializer} for the {@link MotivationProceduralMemory}.
18 | * Its only function is to give the Procedural Memory access to the temporal
19 | * {@link LinkCategory}. This must be done in an initializer because the LinkCategory may have not yet
20 | * been created when the procedural memory's {@link Initializable#init()} runs.
21 | * @author Ryan J McCall
22 | */
23 | public class MotivationProceduralMemoryInitializer extends BasicProceduralMemoryInitializer implements Initializer {
24 |
25 | private static final Logger logger = Logger.getLogger(MotivationProceduralMemoryInitializer.class.getCanonicalName());
26 |
27 | @Override
28 | public void initModule(FullyInitializable m, Agent a, Map params) {
29 | super.initModule(m, a, params);
30 | MotivationProceduralMemory pm = (MotivationProceduralMemory) m;
31 | String label = (String) params.get("linkCategory");
32 | GlobalInitializer gi = GlobalInitializer.getInstance();
33 | Object o = gi.getAttribute(label.trim());
34 | if (o instanceof LinkCategory) {
35 | pm.setTemporalLinkCategory((LinkCategory) o);
36 | } else {
37 | logger.log(Level.WARNING,
38 | "Did not get a LinkCategory from GlobalInitializer using name {1}.",
39 | new Object[] {TaskManager.getCurrentTick(), label});
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/shared/FeelingLinkImpl.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.shared;
2 |
3 | import edu.memphis.ccrg.lida.framework.shared.Link;
4 | import edu.memphis.ccrg.lida.framework.shared.LinkImpl;
5 |
6 | /**
7 | * A {@link Link} having a valence.
8 | * @author Ryan J McCall
9 | */
10 | public class FeelingLinkImpl extends LinkImpl implements Valenceable {
11 |
12 | private ValenceableImpl valence = new ValenceableImpl();
13 |
14 | @Override
15 | public int getValenceSign() {
16 | return valence.getValenceSign();
17 | }
18 |
19 | @Override
20 | public void setValenceSign(int s) {
21 | valence.setValenceSign(s);
22 | }
23 |
24 | @Override
25 | public void updateLinkValues(Link l){
26 | super.updateLinkValues(l);
27 | if(l instanceof Valenceable){
28 | Valenceable otherLink = (Valenceable) l;
29 | valence.setValenceSign(otherLink.getValenceSign());
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/shared/FeelingNode.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.shared;
2 |
3 | import edu.memphis.ccrg.lida.framework.shared.Node;
4 |
5 |
6 | /**
7 | * A {@link Node} having a valence. Can be marked a drive feeling or not.
8 | * @author Ryan J McCall
9 | */
10 | public interface FeelingNode extends Valenceable, Node {
11 |
12 | /**
13 | * Gets the current affective valence.
14 | * @return a double value representing the object's affective valence.
15 | */
16 | public double getAffectiveValence();
17 |
18 | /**
19 | * Returns whether this feeling is a drive, i.e., concerning the agent's internal state.
20 | * @return true if the feeling is a drive feeling
21 | */
22 | public boolean isDrive();
23 |
24 | /**
25 | * Sets the flag specifying whether this feeling is a drive, i.e., concerning the agent's internal state.
26 | * @param d true if the feeling is a drive feeling; false otherwise.
27 | */
28 | public void setDrive(boolean d);
29 | }
30 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/shared/FeelingNodeImpl.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.shared;
2 |
3 | import edu.memphis.ccrg.lida.framework.shared.Node;
4 | import edu.memphis.ccrg.lida.framework.shared.NodeImpl;
5 |
6 |
7 | /**
8 | * The default implementation of {@link FeelingNode}.
9 | * @author Ryan J. McCall
10 | */
11 | public class FeelingNodeImpl extends NodeImpl implements FeelingNode {
12 |
13 | private ValenceableImpl valence = new ValenceableImpl();
14 | private boolean isDrive;
15 |
16 | @Override
17 | public int getValenceSign() {
18 | return valence.getValenceSign();
19 | }
20 |
21 | @Override
22 | public void setValenceSign(int s) {
23 | valence.setValenceSign(s);
24 | }
25 |
26 | @Override
27 | public double getAffectiveValence() {
28 | return getValenceSign()*getActivation();
29 | }
30 |
31 | @Override
32 | public boolean isDrive() {
33 | return isDrive;
34 | }
35 |
36 | @Override
37 | public synchronized void setDrive(boolean b) {
38 | isDrive = b;
39 | }
40 |
41 | @Override
42 | public void updateNodeValues(Node n){
43 | super.updateNodeValues(n);
44 | if (n instanceof FeelingNode) {
45 | FeelingNode otherNode = (FeelingNode) n;
46 | isDrive = otherNode.isDrive();
47 | valence.setValenceSign(otherNode.getValenceSign());
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/shared/Valenceable.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.shared;
2 |
3 | /**
4 | * A representation of a valence, either positive or negative.
5 | * @author Ryan J. McCall
6 | */
7 | public interface Valenceable {
8 |
9 | /**
10 | * Sets the sign of this feeling's valence.
11 | * Zero or positive set the sign to positive, otherwise the sign is set to negative.
12 | * @param s a valence sign code
13 | */
14 | public void setValenceSign(int s);
15 |
16 | /**
17 | * Gets the valence sign.
18 | * @return 1 for a positive sign; -1 for a negative sign.
19 | */
20 | public int getValenceSign();
21 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/shared/ValenceableImpl.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.shared;
2 |
3 | /**
4 | * The default implementation of {@link Valenceable}.
5 | * @author Ryan J. McCall
6 | */
7 | public class ValenceableImpl implements Valenceable {
8 |
9 | private static final int POSITIVE_VALENCE_SIGN = 1;
10 | private static final int NEGATIVE_VALENCE_SIGN = -1;
11 | private int valenceSign = POSITIVE_VALENCE_SIGN;
12 |
13 | @Override
14 | public int getValenceSign() {
15 | return valenceSign;
16 | }
17 |
18 | @Override
19 | public synchronized void setValenceSign(int s) {
20 | if(s >= 0){
21 | valenceSign = POSITIVE_VALENCE_SIGN;
22 | }else{
23 | valenceSign = NEGATIVE_VALENCE_SIGN;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/workspace/FeelingStructureBuildingCodelet.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.workspace;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 |
6 | import edu.memphis.ccrg.lida.framework.shared.Node;
7 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
8 | import edu.memphis.ccrg.lida.motivation.shared.FeelingNode;
9 | import edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemoryImpl;
10 | import edu.memphis.ccrg.lida.workspace.structurebuildingcodelets.StructureBuildingCodeletImpl;
11 | import edu.memphis.ccrg.lida.workspace.workspacebuffers.WorkspaceBuffer;
12 |
13 | /**
14 | * Tries to associate feeling nodes with coincidentally active event nodes.
15 | * @author Ryan J. McCall
16 | */
17 | public class FeelingStructureBuildingCodelet extends StructureBuildingCodeletImpl {
18 |
19 | @Override
20 | protected void runThisFrameworkTask() {
21 | NodeStructure bufferContent = writableBuffer.getBufferContent(null);
22 | Collection feelingNodes = new ArrayList();
23 | Collection eventNodes = new ArrayList();
24 | for(Node n: bufferContent.getNodes()){
25 | if(n instanceof FeelingNode){
26 | feelingNodes.add((FeelingNode) n);
27 | }else {
28 | eventNodes.add(n);
29 | }
30 | }
31 | for(Node feelingNode: feelingNodes){
32 | for(Node eventNode: eventNodes){
33 | //Add a link from Feeling to Max active node.
34 | //Runs the risk of connecting Feelings to non-event nodes if such nodes occur.
35 | //Activation is harmonic mean
36 | double linkActivation = 2*feelingNode.getActivation()*eventNode.getActivation()/(feelingNode.getActivation()+eventNode.getActivation());
37 | bufferContent.addDefaultLink(feelingNode, eventNode,
38 | PerceptualAssociativeMemoryImpl.PARENT_LINK_CATEGORY,
39 | linkActivation, 0.0);
40 | }
41 | }
42 | }
43 |
44 | @Override
45 | public NodeStructure retrieveWorkspaceContent(WorkspaceBuffer buffer) {
46 | return null;
47 | }
48 | @Override
49 | public boolean bufferContainsSoughtContent(WorkspaceBuffer buffer) {
50 | return false;
51 | }
52 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/motivation/workspace/MotivationWorkspaceInitializer.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.motivation.workspace;
2 |
3 | import java.util.Map;
4 |
5 | import edu.memphis.ccrg.lida.framework.Agent;
6 | import edu.memphis.ccrg.lida.framework.initialization.FullyInitializable;
7 | import edu.memphis.ccrg.lida.framework.initialization.GlobalInitializer;
8 | import edu.memphis.ccrg.lida.framework.initialization.Initializer;
9 | import edu.memphis.ccrg.lida.framework.shared.LinkCategory;
10 |
11 | /**
12 | * {@link Initializer} for the {@link MotivationWorkspace}.
13 | * @author Ryan J McCall
14 | *
15 | */
16 | public class MotivationWorkspaceInitializer implements Initializer {
17 |
18 | @Override
19 | public void initModule(FullyInitializable m, Agent a, Map params) {
20 | MotivationWorkspace workspace = (MotivationWorkspace)m;
21 | String label = (String) params.get("linkCategory");
22 | Object o = GlobalInitializer.getInstance().getAttribute(label.trim());
23 | if (o instanceof LinkCategory) {
24 | workspace.setTemporalCategory((LinkCategory)o);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/PamLink.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.Link;
11 |
12 | /**
13 | * A {@link Link} in {@link PerceptualAssociativeMemory}
14 | *
15 | * @author Ryan J. McCall
16 | *
17 | */
18 | public interface PamLink extends Link, PamLinkable {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/PamLinkable.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.Linkable;
11 | import edu.memphis.ccrg.lida.framework.shared.activation.Learnable;
12 |
13 | /**
14 | * A {@link Learnable} {@link Linkable}, a {@link PamNode} or {@link PamLink}
15 | *
16 | * @author Ryan J. McCall
17 | * @see PamNode
18 | * @see PamLink
19 | * @see PerceptualAssociativeMemory
20 | */
21 | public interface PamLinkable extends Linkable, Learnable {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/PamListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam;
9 |
10 | import edu.memphis.ccrg.lida.framework.ModuleListener;
11 | import edu.memphis.ccrg.lida.framework.shared.Link;
12 | import edu.memphis.ccrg.lida.framework.shared.Node;
13 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
14 |
15 | /**
16 | * A PamListener receives percepts from {@link PerceptualAssociativeMemory}
17 | * asynchronously.
18 | *
19 | * @author Ryan J. McCall
20 | */
21 | public interface PamListener extends ModuleListener {
22 |
23 | /**
24 | * Receive a {@link NodeStructure} percept.
25 | *
26 | * @param ns
27 | * a NodeStructure
28 | */
29 | public void receivePercept(NodeStructure ns);
30 |
31 | /**
32 | * Receive a {@link Node} percept.
33 | *
34 | * @param n
35 | * a {@link Node}
36 | */
37 | public void receivePercept(Node n);
38 |
39 | /**
40 | * Receive a {@link Link} percept.
41 | *
42 | * @param l
43 | * a {@link Link}
44 | */
45 | public void receivePercept(Link l);
46 |
47 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/PamNode.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.Link;
11 | import edu.memphis.ccrg.lida.framework.shared.LinkCategory;
12 | import edu.memphis.ccrg.lida.framework.shared.Node;
13 |
14 | /**
15 | * A PamNode is a {@link Node} which resides in
16 | * {@link PerceptualAssociativeMemory} and represents a feature or a concept.
17 | * PamNodes are involved in activation passing where Nodes are not. They can
18 | * represent the {@link LinkCategory} of a {@link Link}.
19 | *
20 | * @author Ryan J. McCall
21 | * @author Javier Snaider
22 | * @see PerceptualAssociativeMemory
23 | */
24 | public interface PamNode extends Node, PamLinkable, LinkCategory {
25 |
26 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/PropagationStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam;
9 |
10 | import java.util.Map;
11 |
12 | import edu.memphis.ccrg.lida.framework.strategies.Strategy;
13 |
14 | /**
15 | * A {@link Strategy} that calculates an activation to be propagated.
16 | *
17 | * @author Ryan J. McCall
18 | */
19 | public interface PropagationStrategy extends Strategy {
20 |
21 | /**
22 | * Various parameters can be passed to this method for the calculation of
23 | * activation to propagate.
24 | *
25 | * @param params
26 | * Map of parameters
27 | * @return the calculated activation to propagate
28 | */
29 | public double getActivationToPropagate(Map params);
30 | }
31 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/UpscalePropagationStrategy.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam;
9 |
10 | import java.util.Map;
11 | import java.util.logging.Level;
12 | import java.util.logging.Logger;
13 |
14 | import edu.memphis.ccrg.lida.framework.strategies.StrategyImpl;
15 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
16 |
17 | /**
18 | * Calculates a new activation using an upscale parameter.
19 | *
20 | * @author Ryan J. McCall
21 | */
22 | public class UpscalePropagationStrategy extends StrategyImpl implements
23 | PropagationStrategy {
24 |
25 | private Logger logger = Logger.getLogger(UpscalePropagationStrategy.class
26 | .getCanonicalName());
27 |
28 | /*
29 | * Calculate and return an activation to propagate.
30 | *
31 | * @param params the params
32 | *
33 | * @return the activation to propagate
34 | */
35 | @Override
36 | public double getActivationToPropagate(Map params) {
37 | if (params.containsKey("totalActivation")
38 | && params.containsKey("upscale")) {
39 | return (Double) params.get("totalActivation")
40 | * (Double) params.get("upscale");
41 | } else {
42 | logger.log(Level.WARNING, "Unable to obtain parameters",
43 | TaskManager.getCurrentTick());
44 | return 0.0;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of the Perceptual Associative Memory module and its default implementation.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/tasks/AddLinkToPerceptTask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam.tasks;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.Link;
11 | import edu.memphis.ccrg.lida.framework.shared.Node;
12 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTaskImpl;
13 | import edu.memphis.ccrg.lida.pam.PamLink;
14 | import edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemory;
15 |
16 | /**
17 | * A task to add a {@link PamLink} and its sink to the percept.
18 | *
19 | * @author Ryan J. McCall
20 | * @see ExcitationTask creates this task
21 | * @see PropagationTask creates this task
22 | */
23 | public class AddLinkToPerceptTask extends FrameworkTaskImpl {
24 |
25 | private PerceptualAssociativeMemory pam;
26 | private Link link;
27 |
28 | /**
29 | * Default constructor
30 | *
31 | * @param link
32 | * {@link PamLink}
33 | * @param pam
34 | * {@link PerceptualAssociativeMemory}
35 | */
36 | public AddLinkToPerceptTask(Link link, PerceptualAssociativeMemory pam) {
37 | this.pam = pam;
38 | this.link = link;
39 | }
40 |
41 | /**
42 | * Adds link's sink to the percept and tries to add the link as well then
43 | * finishes.
44 | */
45 | @Override
46 | protected void runThisFrameworkTask() {
47 | pam.addToPercept((Node) link.getSink());
48 | pam.addToPercept(link);
49 | cancel();
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/tasks/AddNodeStructureToPerceptTask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam.tasks;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
11 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTaskImpl;
12 | import edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemory;
13 |
14 | /**
15 | * A task which adds a {@link NodeStructure} to the percept.
16 | *
17 | * @author Ryan J. McCall
18 | */
19 | public class AddNodeStructureToPerceptTask extends FrameworkTaskImpl {
20 |
21 | private NodeStructure ns;
22 | private PerceptualAssociativeMemory pam;
23 |
24 | /**
25 | * Default constructor
26 | *
27 | * @param ns
28 | * {@link NodeStructure}
29 | * @param pam
30 | * {@link PerceptualAssociativeMemory}
31 | */
32 | public AddNodeStructureToPerceptTask(NodeStructure ns,
33 | PerceptualAssociativeMemory pam) {
34 | this.ns = ns;
35 | this.pam = pam;
36 | }
37 |
38 | /**
39 | * Adds {@link NodeStructure} to the percept then finishes.
40 | */
41 | @Override
42 | protected void runThisFrameworkTask() {
43 | pam.addToPercept(ns);
44 | cancel();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/tasks/AddNodeToPerceptTask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam.tasks;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.Node;
11 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTaskImpl;
12 | import edu.memphis.ccrg.lida.pam.PamNode;
13 | import edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemory;
14 |
15 | /**
16 | * A task which adds a {@link PamNode} to the percept.
17 | *
18 | * @author Ryan J. McCall
19 | */
20 | public class AddNodeToPerceptTask extends FrameworkTaskImpl {
21 |
22 | private Node node;
23 | private PerceptualAssociativeMemory pam;
24 |
25 | /**
26 | * Default constructor
27 | *
28 | * @param n
29 | * the {@link Node} to add
30 | * @param pam
31 | * {@link PerceptualAssociativeMemory}
32 | */
33 | public AddNodeToPerceptTask(Node n, PerceptualAssociativeMemory pam) {
34 | node = n;
35 | this.pam = pam;
36 | }
37 |
38 | /**
39 | * Adds {@link Node} to the percept then finishes.
40 | */
41 | @Override
42 | protected void runThisFrameworkTask() {
43 | pam.addToPercept(node);
44 | cancel();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/tasks/DetectionAlgorithm.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.pam.tasks;
9 |
10 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTask;
11 | import edu.memphis.ccrg.lida.pam.PamLinkable;
12 | import edu.memphis.ccrg.lida.pam.PamNode;
13 | import edu.memphis.ccrg.lida.sensorymemory.SensoryMemory;
14 |
15 | /**
16 | * A process which detects a pattern (feature) in {@link SensoryMemory} content
17 | * and excites {@link PamNode}s representing that pattern.
18 | *
19 | * @author Javier Snaider
20 | * @author Ryan J. McCall
21 | * @see BasicDetectionAlgorithm
22 | */
23 | public interface DetectionAlgorithm extends FrameworkTask {
24 |
25 | /**
26 | * Detects a feature.
27 | *
28 | * @return value from 0.0 to 1.0 representing the degree to which the
29 | * feature occurs.
30 | */
31 | public double detect();
32 |
33 | /**
34 | * Returns {@link PamLinkable} this algorithm can detect.
35 | *
36 | * @return the pam nodes
37 | */
38 | public PamLinkable getPamLinkable();
39 |
40 | /**
41 | * Adds {@link PamLinkable} that will be detected by this algorithm.
42 | *
43 | * @param linkable
44 | * s {@link PamLinkable}
45 | */
46 | public void setPamLinkable(PamLinkable linkable);
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/pam/tasks/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes implementing several low-level processes of the default PerceptualAssociativeMemory.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/proceduralmemory/Condition.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.proceduralmemory;
2 |
3 | import edu.memphis.ccrg.lida.actionselection.Behavior;
4 | import edu.memphis.ccrg.lida.framework.shared.activation.Activatible;
5 |
6 | /**
7 | * A requirement for a {@link Behavior} to be selected. Implementors should
8 | * correctly override {@link Object#equals(Object)} and
9 | * {@link Object#hashCode()} since Conditions are used as keys in Maps.
10 | *
11 | * @author Javier Snaider
12 | */
13 | public interface Condition extends Activatible {
14 |
15 | /**
16 | * Gets id. The return object must be unique and it must be able to use as a
17 | * map key i.e. {@link Object#equals(Object)} and {@link Object#hashCode()}
18 | * must be overwritten for this id.
19 | *
20 | * @return Condition's unique id
21 | */
22 | public Object getConditionId();
23 | }
24 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/proceduralmemory/ProceduralMemoryListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 |
9 | package edu.memphis.ccrg.lida.proceduralmemory;
10 |
11 | import edu.memphis.ccrg.lida.actionselection.Behavior;
12 | import edu.memphis.ccrg.lida.framework.ModuleListener;
13 |
14 | /**
15 | * A procedural memory listener receives instantiated schemes which are
16 | * behaviors
17 | *
18 | * @author Ryan J. McCall
19 | */
20 | public interface ProceduralMemoryListener extends ModuleListener {
21 |
22 | /**
23 | * Receive a {@link Behavior}
24 | *
25 | * @param behavior
26 | * - a stream, a partial order, of behaviors
27 | */
28 | public void receiveBehavior(Behavior behavior);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/proceduralmemory/ProceduralUnit.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.proceduralmemory;
2 |
3 | import java.util.Collection;
4 |
5 | import edu.memphis.ccrg.lida.actionselection.Action;
6 | import edu.memphis.ccrg.lida.actionselection.Behavior;
7 | import edu.memphis.ccrg.lida.framework.shared.ElementFactory;
8 | import edu.memphis.ccrg.lida.framework.shared.activation.Activatible;
9 |
10 | /**
11 | * An abstraction of the commonality between {@link Scheme} and {@link Behavior}
12 | * .
13 | *
14 | * @author Ryan J. McCall
15 | * @author Javier Snaider
16 | */
17 | public interface ProceduralUnit extends Activatible {
18 |
19 | /**
20 | * Gets action.
21 | *
22 | * @return the {@link Action} this unit contains
23 | */
24 | public Action getAction();
25 |
26 | /**
27 | * Gets context conditions.
28 | *
29 | * @return the context's conditions
30 | */
31 | public Collection getContextConditions();
32 |
33 | /**
34 | * Gets adding list.
35 | *
36 | * @return the adding list
37 | */
38 | public Collection getAddingList();
39 |
40 | /**
41 | * Gets deleting list.
42 | *
43 | * @return the deleting list
44 | */
45 | public Collection getDeletingList();
46 |
47 | /**
48 | * Gets the label.
49 | *
50 | * @return label of the unit
51 | */
52 | public String getLabel();
53 |
54 | /**
55 | * Sets Scheme's label
56 | *
57 | * @param l
58 | * a String
59 | */
60 | public void setLabel(String l);
61 |
62 | /**
63 | * Sets unique identifier for {@link Scheme}. Should be used by
64 | * {@link ElementFactory} only.
65 | *
66 | * @param id
67 | * unique identifier for this scheme
68 | */
69 | public void setId(int id);
70 |
71 | /**
72 | * Gets scheme's id.
73 | *
74 | * @return unique identifier for this scheme
75 | */
76 | public int getId();
77 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/proceduralmemory/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of the Procedural Memory module and its default implementation.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymemory/SensoryMemory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.sensorymemory;
9 |
10 | import java.util.Map;
11 |
12 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
13 |
14 | /**
15 | * This is the interface to be implemented by sensory memory modules.
16 | * Implementing modules sense the environment, store the sensed data ,and
17 | * process it.
18 | *
19 | * @author Ryan J. McCall
20 | */
21 | public interface SensoryMemory extends FrameworkModule {
22 |
23 | /**
24 | * Adds a listener to this memory. This listener constantly checks for
25 | * information being sent from this memory to other modules (Perceptual
26 | * Associative Memory and Sensory Motor Memory).
27 | *
28 | * @param l
29 | * the listener added to this memory
30 | */
31 | public void addSensoryMemoryListener(SensoryMemoryListener l);
32 |
33 | /**
34 | * Runs all the sensors associated with this memory. The sensors get the
35 | * information from the environment and store in this memory for later
36 | * processing and passing to the perceptual memory module.
37 | */
38 | public void runSensors();
39 |
40 | /**
41 | * Returns content from this SensoryMemory. Intended to be used by feature
42 | * detectors to get specific parts of the sensory memory.
43 | *
44 | * @param modality
45 | * user may optionally use this parameter to specify modality.
46 | * @param params
47 | * optional parameters
48 | * @return content
49 | */
50 | public Object getSensoryContent(String modality, Map params);
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymemory/SensoryMemoryBackgroundTask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.sensorymemory;
9 |
10 | import java.util.logging.Level;
11 | import java.util.logging.Logger;
12 |
13 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
14 | import edu.memphis.ccrg.lida.framework.tasks.FrameworkTaskImpl;
15 | import edu.memphis.ccrg.lida.framework.tasks.TaskManager;
16 |
17 | /**
18 | * Task which operates a Sensory Memory. This class provides a general way to
19 | * control various type of sensory memory -- It is the meaning of "background"
20 | * here.
21 | *
22 | * @author Javier Snaider
23 | */
24 | public class SensoryMemoryBackgroundTask extends FrameworkTaskImpl {
25 |
26 | private static final Logger logger = Logger
27 | .getLogger(SensoryMemoryBackgroundTask.class.getCanonicalName());
28 | private SensoryMemory sm;
29 |
30 | /**
31 | * This method overrides setAssociatedModule() from class FrameworkTaskImpl
32 | * It sets a module passing parameter to SensoryMemory sm
33 | *
34 | * @param module
35 | * The module to be associated
36 | * @param moduleUsage
37 | * It is not used here
38 | */
39 | @Override
40 | public void setAssociatedModule(FrameworkModule module, String moduleUsage) {
41 | if (module instanceof SensoryMemory) {
42 | sm = (SensoryMemory) module;
43 | } else {
44 | logger.log(Level.WARNING, "Cannot add module {1}", new Object[] {
45 | TaskManager.getCurrentTick(), module });
46 | }
47 | }
48 |
49 | /**
50 | * This method overrides runThisFrameworkTask() from class FrameworkTaskImpl
51 | * It executes method runSensors()of SensoryMemory sm
52 | *
53 | */
54 | @Override
55 | protected void runThisFrameworkTask() {
56 | sm.runSensors();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymemory/SensoryMemoryListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.sensorymemory;
9 |
10 | import edu.memphis.ccrg.lida.framework.ModuleListener;
11 |
12 | /**
13 | * This interface should be implemented for receiving and using information
14 | * coming from a {@link SensoryMemory} module.
15 | *
16 | * @author Ryan J. McCall
17 | *
18 | */
19 | public interface SensoryMemoryListener extends ModuleListener {
20 |
21 | /**
22 | * This method is used to receive information from sensory memory.
23 | * Sensory-Motor Memory calls this method and receives the information of
24 | * sensory memory.
25 | *
26 | * @param content
27 | * an Object containing {@link SensoryMemory} content
28 | */
29 | public void receiveSensoryMemoryContent(Object content);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymemory/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of the Sensory Memory module.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymotormemory/SensoryMotorMemory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.sensorymotormemory;
9 |
10 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
11 |
12 | /**
13 | * Sensory Motor Memory is a module which receives selected actions from
14 | * ActionSelection and content from SensoryMemory. It contains the algorithm for
15 | * a selected action. When it executes an algorithm it directly calls a method
16 | * in the environment (doesn't use a listener).
17 | *
18 | * @author Ryan J. McCall
19 | * @author Javier Snaider
20 | *
21 | */
22 | public interface SensoryMotorMemory extends FrameworkModule {
23 |
24 | /**
25 | * Any non-environment communication should use listeners.
26 | *
27 | * @param l
28 | * SensoryMotorMemoryListener
29 | */
30 | public void addSensoryMotorMemoryListener(SensoryMotorMemoryListener l);
31 |
32 | /**
33 | * Executes specified action algorithm
34 | *
35 | * @param command
36 | * algorithm to execute in the agent's actuators or directly in
37 | * the environment.
38 | */
39 | public void sendActuatorCommand(Object command);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymotormemory/SensoryMotorMemoryListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.sensorymotormemory;
9 |
10 | import edu.memphis.ccrg.lida.framework.ModuleListener;
11 |
12 | /**
13 | * Listener of {@link SensoryMotorMemory}
14 | *
15 | * @author Ryan J. McCall
16 | */
17 | public interface SensoryMotorMemoryListener extends ModuleListener {
18 |
19 | /**
20 | * @param command
21 | * Current command being executed.
22 | */
23 | public void receiveActuatorCommand(Object command);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/sensorymotormemory/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of the Sensory Motor Memory module.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/Workspace.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.workspace;
9 |
10 | import edu.memphis.ccrg.lida.episodicmemory.CueListener;
11 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
12 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
13 |
14 | /**
15 | * The workspace collection of submodules where Cues from episodic memories, the
16 | * recent contents of conscious, the perceptual buffer, and the current
17 | * situational model are stored. A workspace should be interfaceable with
18 | * codelets whose job is to operate on the contents of these submodules.
19 | *
20 | * @author Ryan J. McCall
21 | */
22 | public interface Workspace extends FrameworkModule {
23 |
24 | /**
25 | * Add episodic memory that will listen for cues from the Workspace
26 | *
27 | * @param l
28 | * listener
29 | */
30 | public void addCueListener(CueListener l);
31 |
32 | /**
33 | * Adds specified {@link WorkspaceListener}
34 | *
35 | * @param l
36 | * listener of this Workspace
37 | */
38 | public void addWorkspaceListener(WorkspaceListener l);
39 |
40 | /**
41 | * Prompts this Workspace to cue episodic memories with content.
42 | *
43 | * @param ns
44 | * NodeStructure to cue with.
45 | */
46 | public void cueEpisodicMemories(NodeStructure ns);
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/WorkspaceContent.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.workspace;
9 |
10 | import edu.memphis.ccrg.lida.framework.shared.NodeStructure;
11 |
12 | /**
13 | * WorkspaceContent is a general name for the content of the workspace.
14 | * Currently it is a NodeStructure only. In the future it may include Sensory
15 | * Scene layers
16 | *
17 | * @author Ryan J. McCall
18 | */
19 | public interface WorkspaceContent extends NodeStructure {
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/WorkspaceListener.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.workspace;
9 |
10 | import edu.memphis.ccrg.lida.framework.ModuleListener;
11 | import edu.memphis.ccrg.lida.framework.ModuleName;
12 |
13 | /**
14 | * A workspace listener receives content from the workspace. The prime example
15 | * is PAM.
16 | *
17 | * @author Ryan J. McCall
18 | */
19 | public interface WorkspaceListener extends ModuleListener {
20 |
21 | /**
22 | * Receive NodeStructure content from ModuleType originatingBuffer
23 | *
24 | * @param originatingBuffer
25 | * source of content
26 | * @param content
27 | * sent content
28 | */
29 | public void receiveWorkspaceContent(ModuleName originatingBuffer,
30 | WorkspaceContent content);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of the Workspace module and its default implementation.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/structurebuildingcodelets/StructureBuildingCodelet.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.workspace.structurebuildingcodelets;
9 |
10 | import edu.memphis.ccrg.lida.framework.tasks.Codelet;
11 |
12 | /**
13 | * Demon-like process operating on the workspace searching for particular
14 | * content which, when found, triggers its action producing its result. Has
15 | * workspace buffers it can access.
16 | *
17 | * @author Ryan J. McCall
18 | *
19 | */
20 | public interface StructureBuildingCodelet extends Codelet {
21 |
22 | /**
23 | * Returns result of codelet's run
24 | *
25 | * @return Current information about the codelet's progress
26 | */
27 | public Object getCodeletRunResult();
28 |
29 | /**
30 | * Clears this codelet's fields in preparation for reuse. Idea is that the
31 | * same codelet object is reconfigured at runtime after it finishes to be
32 | * run as a different altogether codelet.
33 | */
34 | public void reset();
35 |
36 | }
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/structurebuildingcodelets/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition, default implementation, and management of Structure-Building codelets.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/workspacebuffers/BroadcastQueue.java:
--------------------------------------------------------------------------------
1 | package edu.memphis.ccrg.lida.workspace.workspacebuffers;
2 |
3 | import edu.memphis.ccrg.lida.globalworkspace.BroadcastListener;
4 | import edu.memphis.ccrg.lida.workspace.Workspace;
5 | import edu.memphis.ccrg.lida.workspace.WorkspaceContent;
6 |
7 | /**
8 | * A {@link WorkspaceBuffer} storing the recent contents of consciousness. It is
9 | * a submodule of the {@link Workspace}.
10 | *
11 | * @author Ryan J. McCall
12 | * @author Javier Snaider
13 | *
14 | */
15 | public interface BroadcastQueue extends WorkspaceBuffer, BroadcastListener {
16 |
17 | /**
18 | * Returns content of specified position
19 | *
20 | * @param index
21 | * position in the queue
22 | * @return {@link WorkspaceContent} at index position or null
23 | */
24 | public WorkspaceContent getPositionContent(int index);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/workspacebuffers/WorkspaceBuffer.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2009, 2011 The University of Memphis. All rights reserved.
3 | * This program and the accompanying materials are made available
4 | * under the terms of the LIDA Software Framework Non-Commercial License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://ccrg.cs.memphis.edu/assets/papers/2010/LIDA-framework-non-commercial-v1.0.pdf
7 | *******************************************************************************/
8 | package edu.memphis.ccrg.lida.workspace.workspacebuffers;
9 |
10 | import java.util.Map;
11 |
12 | import edu.memphis.ccrg.lida.framework.FrameworkModule;
13 | import edu.memphis.ccrg.lida.workspace.WorkspaceContent;
14 | import edu.memphis.ccrg.lida.workspace.WorkspaceImpl;
15 | import edu.memphis.ccrg.lida.workspace.structurebuildingcodelets.StructureBuildingCodelet;
16 |
17 | /**
18 | * A submodule of the Workspace. Managed by {@link WorkspaceImpl}.
19 | * {@link StructureBuildingCodelet} read and write from them.
20 | *
21 | * @author Ryan J. McCall
22 | * @author Javier Snaider
23 | */
24 | public interface WorkspaceBuffer extends FrameworkModule {
25 |
26 | /**
27 | * Gets buffer content based on specified parameters.
28 | *
29 | * @param params
30 | * optional parameters to specify what content is returned
31 | * @return {@link WorkspaceContent}
32 | */
33 | public WorkspaceContent getBufferContent(Map params);
34 |
35 | /**
36 | * Adds specified content to this workspace buffer.
37 | *
38 | * @param content
39 | * {@link WorkspaceContent} to add
40 | */
41 | public void addBufferContent(WorkspaceContent content);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/edu/memphis/ccrg/lida/workspace/workspacebuffers/package.html:
--------------------------------------------------------------------------------
1 |
2 | Contains classes related to the definition of of Workspace buffers and their default implementations.
3 |
4 |
5 |
--------------------------------------------------------------------------------
/testData/shortagent.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
11 |
12 | 50
13 | 100
14 |
edu.memphis.ccrg.lida.framework.tasks.TaskSpawnerImpl
15 |
16 | edu.memphis.ccrg.lida.pam.PerceptualAssociativeMemoryImpl
17 | .7
18 | defaultTS
edu.memphis.ccrg.lida.example.framework.initialization.PamInitializer
19 |
20 |
21 | edu.memphis.ccrg.lida.workspace.WorkspaceImpl
22 |
23 |
24 | edu.memphis.ccrg.lida.workspace.workspacebuffers.WorkspaceBufferImpl
0.01
25 | defaultTS
26 |
27 | defaultTS
CueBackgroundTask
15
0.4
28 |
29 |
30 | edu.memphis.ccrg.lida.pam.PamListener
31 | PerceptualAssociativeMemory
32 | Workspace
33 |
34 |
35 |
--------------------------------------------------------------------------------