27 |
28 | A Java implementation of the MANIC cognitive architecture
29 |
30 |
31 | Q and A:
32 |
33 |
34 | - What the heck is this? A cognitive architecture is a design for a machine
35 | that attempts to achieve human-like thinking abilities.
36 | A cognitive architecture called MANIC
37 | was designed at University of Arkansas. This is an implementation of that architecture.
38 |
39 |
40 | - Does it work? It passes some tests. More testing is still needed.
41 |
42 | - How does it work? You could start by reading the paper.
43 | After that, the code fills in the rest of the details.
44 |
45 |
46 | - Can you give me an overview of the structure of this code?
47 |
48 | manic
49 | |
50 | +--> docs (You are here.)
51 | |
52 | +--> java (For Java programmers)
53 | | |
54 | | +--> class (Where compiled bytecode goes)
55 | | |
56 | | +--> src (The Java source code)
57 | | |
58 | | +--> agents (Implementations of various agents, including MANIC.)
59 | | | |
60 | | | +---> manic (The implementation of MANIC.
61 | | | | ...what this project is all about.)
62 | | | |
63 | | | +---> randy (An agent that makes random decisions. Basically,
64 | | | this is a straw man for MANIC to destroy.)
65 | | |
66 | | +---> tests (A collection of tests for evaluating the agents.)
67 | | |
68 | | +---> common (Various interfaces and classes that are
69 | | used throughout the project.)
70 | |
71 | +--> cpp (for C++ programmers)
72 | |
73 | +--> bin (Where the binaries go)
74 | |
75 | +--> src (The C++ source code)
76 |
77 |
78 |
79 |
80 | - What do I need to know to add a new test to the Java version of your collection?
81 | First, take a look at the ITest interface in manic/java/src/common.
82 | To make a test, you just need to write a class that implements this interface.
83 | Next, take a look at manic/src/Main.java.
84 | To add your test to the collection, just add it here.
85 | Perhaps, the best way to get started is to copy one of the existing tests,
86 | then modify it to do what you want.
87 | Every test will do the following things:
88 |
89 | - Instatiate a mentor
90 | - Reset the agent
91 | - Call "IAgent.think" several thousand times
92 | - Evaluate how well the agent did (usually without any feedback from the mentor)
93 |
94 |
95 |
96 | - How can you say MANIC is intelligent if it needs a mentor?
97 | You can think of the mentor as part of each test challenge.
98 | The role of the mentor is to help the agent know what it is supposed to do,
99 | not to tell the agent how to do it. Of course, that can be a fuzzy line.
100 | That's why it takes a lot of challenges to make a good test.
101 |
102 |
103 | - How do I make a mentor?
104 | Make a class that implementes the IMentor interface in manic/src/common.
105 |
106 |
107 | - How do I reset the agent, and what does resetting the agent do?
108 | You call the "IAgent.reset" method. This tells the agent what it needs to know to begin performing your test:
109 |
110 | - Which mentor will show it what to do?
111 | - How many values will it sense or observe each time-step?
112 | - How many values does it need to represent state in your world?
113 | - How many values do you expect it to provide for its actions?
114 | - How many time steps into the future to you expect it to plan?
115 |
116 |
117 |
118 | - What does calling "IAgent.think" do?
119 | You call "IAgent.think" to give the agent "life".
120 | When you call this method, you pass in a vector of observations,
121 | and it returns a vector of actions.
122 | Each observed value should be a continuous value between -1 and 1.
123 | Each action value will be a continuous value between 0 and 1.
124 | What do all those values mean? Well, that's up to your test.
125 | Your job is to write a test that uses those vectors in some meaningful way.
126 | The agent's job is to figure out what the values mean and use them intelligently.
127 |
128 |
129 | - How do I evaluate the agent?
130 | Usually, when you are evaluating the agent, you will have the mentor always
131 | return NO_FEEDBACK. This means it is no longer providing the agent with any
132 | useful information. How you evaluate the agent is really up to you.
133 | Your test will return a number that represents how well the agent performed
134 | at your test. Larger numbers are better. Smaller numbers are worse.
135 | Scores should only be used for ranking, so there is no established range for the scores.
136 |
137 |
138 | - What if MANIC doesn't pass my test?
139 | Could a human pass the test? Could a human pass it without utilizing
140 | any knowledge obtained outside the test? If not, it is probably not
141 | reasonable to expect a computer to pass it either. If a human could pass it,
142 | please contribute your test, so we can work to improve our agents until they pass it.
143 | Those are the tests we want most of all!
144 |
145 |
146 | - Can MANIC be persisted to a file? Yes:
147 |
148 | JSONObject obj = agent.marshal();
149 | FileWriter file = new FileWriter("agent.json");
150 | file.write(obj.toJSONString());
151 | file.close();
152 |
153 | And, you can restore it from a file too:
154 |
155 | JSONParser parser = new JSONParser();
156 | JSONObject obj2 = (JSONObject)parser.parse(new FileReader("agent.json"));
157 | ManicAgent agent2 = new ManicAgent(obj2, new Random(1234), new MyMentor());
158 |
159 |
160 |
161 | - What is the license of this code?
162 | The code in manic/src/common/json contains code in the Apache 2.0 license.
163 | The rest was written by myself and other contributors who all agree to release their code under the Creative Commons Zero public domain dedication.
164 | In other words, you can do pretty much whatever you want with this code.
165 |
166 |
167 | - How would one debug the Java version with Eclipse?
168 |
169 | - Launch Eclipse
170 | - If it asks you, choose a default workspace.
171 | - Close the welcome page
172 | - File->New->Project->Java Project->Next
173 | - Uncheck "Use default location", and click Browse
174 | - Find the "manic/src" folder, and click OK, then Finish
175 | - If it asks to open the associated perspective, choose Yes
176 | - In the "Package Explorer" window, right-click on "src", then click "Properties"
177 | - Click Java Compiler->Enable project specific settings, and set the Compiler compliance level to at least 1.7
178 | - Click OK. Yes, it is okay for it to rebuild. Now, it should build without errors.
179 | - Click on the bug icon. Choose Java Application->OK.
180 | - Set a breakpoint somewhere. Yes, it is okay to change the perspective again.
181 | - Rearrange your windows so you can actually see what you are doing.
182 | - Now you know why Eclipse is dying.
183 |
184 |
185 |
186 | - Why is MANIC so slow?
187 | It does a lot of stuff. Your brain has about 100 billion neurons that all run in parallel.
188 | This code is doing it all in serial on the Java Virtual Machine.
189 |
190 |
191 | - Does this implementation include the functional equivalence of sentience that the paper conjectures about?
192 | No. Why not? No one knows how to test for sentience, anyway, so what would be the purpose in implementing it?
193 |
194 |
195 |
196 |
197 | |