marknabil / aima-python Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/aima-python
Automatically exported from code.google.com/p/aima-python
What steps will reproduce the problem?
1. $ cd aima-python
2. $ python
3. >>> import agents
4. >>> v = VacuumEnvironment()
5. >>> e = EnvGUI(v)
What is the expected output?
Some Tkinkter window with the Environment
What do you see instead?
An empty Tkinkter window and an error message at the repl:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/rickard/devel/ArtificialIntelligence/aima/aima-python/agents.py", line 617, in
__init__
canvas = EnvCanvas(self, env, cellwidth, n)
NameError: global name 'EnvCanvas' is not defined
What version of the product are you using? On what operating system?
Svn revision 29 from Google Code on Mac OS X 10.4.11
Please provide any additional information below.
The commentary at the top of the agents.py file mentions the EnvCanvas class
but the file
doesn't contain a definition of it. Perhaps it is left as an excercise for the
reader.. :-)
Original issue reported on code.google.com by [email protected]
on 29 Jan 2008 at 1:57
What steps will reproduce the problem?
1. copy files (utils.py and search.py) into Python 3.2 standard window editor,
etc.
2. fix the print() syntax issues
3. run search.py
4. get this traceback:
Traceback (most recent call last):
File "C:\Python32\myscripts\search.py", line 469, in <module>
U=Dict(V=142)))
File "C:\Python32\myscripts\search.py", line 428, in UndirectedGraph
return Graph(dict=dict, directed=False)
File "C:\Python32\myscripts\search.py", line 396, in __init__
if not directed: self.make_undirected()
File "C:\Python32\myscripts\search.py", line 400, in make_undirected
for a in self.dict.keys():
RuntimeError: dictionary changed size during iteration
>>> Traceback (most recent call last):
File "C:\Python32\myscripts\search.py", line 469, in <module>
U=Dict(V=142)))
File "C:\Python32\myscripts\search.py", line 428, in UndirectedGraph
return Graph(dict=dict, directed=False)
File "C:\Python32\myscripts\search.py", line 396, in __init__
if not directed: self.make_undirected()
File "C:\Python32\myscripts\search.py", line 400, in make_undirected
for a in self.dict.keys():
RuntimeError: dictionary changed size during iteration
>>>
What is the expected output? What do you see instead?
I am a student in new on-line aima class.
I am new to python .. naturally downloaded 3.2 and worked through tutorial. I
rather expected these programs to run properly, not to have to spend much time
fixing them. By studying the actual data structures, I can really understand
how to implement the pseudo-codes (if the program worked!) .. looked at sources
for this run-time error on Internet and this seems to be rather tricky error
... Can you provide a fix? Thank you.
What version of the product are you using? On what operating system?
I am trying to run the aima class example codes using Python 3.2 (evidently a
mistake) on Windows XP PC. In particular I am trying to run the search.py astar
program.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 18 Oct 2011 at 9:26
* What are the steps to reproduce the problem?
It is often quite convenient to manipulate propositional sentences in string
format
and then pass them to dpll_satisfiable to be solved.
If you pass a string argument to dpll_satisfiable, it sometimes works correctly
(in the cases when no choice is required), but other times gives an obscure
"out of index" error.
* What is the expected output? What do you see instead?
Running:
>>> import logic
>>> logic.dpll_satisfiable("A")
{A: True}
Expected result would be {A: True}
But then the following behaviour:
>>> logic.dpll_satisfiable("A | B")
Traceback from previous calls
...
P, symbols = symbols[0], symbols[1:]
IndexError: list index out of range
I would expect to get either
{A: True}
or an error that the type of the argument should be Expr.
* What version of the product are you using? On what operating system?
The problem is in r202 (and earlier revisions) from the repository.
* Please provide any additional information below.
The debugging can be made much simpler by adding the following line to logic.py:
@@ -643,6 +643,7 @@
>>> dpll_satisfiable(P&~P)
False
"""
+ assert isinstance(s, Expr), "The argument 's' must be an instance of the
Expr type. Use logic.expr(string) to convert a string to Expr instance."
clauses = conjuncts(to_cnf(s))
symbols = prop_symbols(s)
return dpll(clauses, symbols, {})
The code in this project is wonderful for learning and teaching purposes and
adding clutter is generally not a good idea. In this case the little additional
clutter is justified to save time in debugging and ease understanding.
Original issue reported on code.google.com by [email protected]
on 7 Dec 2013 at 1:16
What steps will reproduce the problem?
1. Running doctests
2.
3.
What is the expected output? What do you see instead?
Find file and test its code
What version of the product are you using? On what operating system?
2008.08.24
Please provide any additional information below.
Doctests is not looking into subdirectories under data. Like is missed
wordlist because it was in EN_TEXT, resolved it by moving all contents from
EN_TEXT in data. Now it can't find flat11.txt
It can't be seen http://aima-data.googlecode.com/svn/trunk/README.txt
Original issue reported on code.google.com by [email protected]
on 29 Jul 2012 at 6:44
If I try to run the tests
$ python doctests.py -v *.py
some fail because they can't find the data directory or the files in it.
These are the lines that originate the problems:
search.py:
BoggleFinder.wordlist = Wordlist("../data/wordlist")
(should be EN-text/wordlist)
text.py:
mandir = '../data/man/'
(should be MAN)
flatland = DataFile("flat11.txt").read() # there are two of these!
(should be EN-text/flatland.txt)
Finally, after replacing all the "../data/" with my "../aima-data/"
(checked out from the SVN repository), the tests were all successful (apart
from the one I mentioned in the other report).
--
Now I'll get back to try to understand the code, which is obviously much
more interesting. :-)
Thanks for releasing these programs with a free license, they're very
useful educational tools.
Best regards,
Matteo
Original issue reported on code.google.com by [email protected]
on 1 Oct 2007 at 3:04
1) What steps will reproduce the problem?
$ python2.4 doctests.py -v utils.py
or
$ python2.5 doctests.py -v utils.py
2) What is the expected output? What do you see instead?
Failed example:
histogram(vals, 1)
Expected:
[(200, 3), (110, 2), (160, 2), (220, 1), (100, 1)]
Got:
[(200, 3), (160, 2), (110, 2), (100, 1), (220, 1)]
3) What version of the product are you using? On what operating system?
* Code from SVN repository.
* Debian GNU/Linux (Sid, up-to-date).
4) Please provide any additional information below.
It looks like python's sorted in 2.4 or 2.5 doesn't work exactly as the one
supplied (but I can't try that because I haven't got 2.3, and on 2.4 it
doesn't work).
I'm sure this is not a bug, but maybe you're interested in having
successful tests also on python >= 2.4.
Sorry for such a useless report, otherwise. :-)
Original issue reported on code.google.com by [email protected]
on 1 Oct 2007 at 2:23
Reproduce:
$ python
>>> from csp import *
>>> backtracking_search(australia, mcv=True, fc=True)
-> Results in wrong coloring
Several issues:
- Forward checking and Arc Consistency are severely broken. The most severe
issue is in line 86, where information about pruned domains from previous
steps is wrongly discarded.
- Most constrained variable-heuristic has it backwards and orders the least
constrained variable first
- Least constraining value-heuristic fails to compile on modern python
- The map of USA is wrong (New York adjacent to California), some borders
missing
The included patch fixes the described issues plus adds
- The map of France by Regions
- Formulation of the Sudoku-Problem
- Some trivial testing code
Otherwise great book!
Original issue reported on code.google.com by [email protected]
on 6 Jul 2009 at 12:17
Attachments:
What steps will reproduce the problem?
1. Run best_first_graph_search() which implements frontier as a PriorityQueue
as defined in utils.py
uniform_cost_search() also uses best_first_graph_search() so it demonstrates
the same problem.
What is the expected output? What do you see instead?
I expect the "in" operator of PriorityQueue to operate in O(n) time, as
explained on AIMA page 84: "The data structure for frontier needs to support
efficient membership testing, so it should combine the capabilities of a
priority queue and a hash table."
It is used e.g. in best_first_graph_search: "child not in frontier".
Instead, when the frontier gets big (thousands of Nodes) it runs like a dog.
ipython's %prun is good for testing this, pointing out over ten million
executions of three functions.
ncalls tottime percall cumtime percall filename:lineno(function)
14715773 19.519 0.000 38.611 0.000 utils.py:747(<lambda>)
17112459 18.401 0.000 21.727 0.000 search.py:105(__eq__)
13780 9.214 0.001 47.825 0.003 utils.py:338(some)
17121581 3.334 0.000 3.334 0.000 {isinstance}
4660 2.314 0.000 4.942 0.001 utils.py:748(__getitem__)
The reason is clear when we look at the code and note this member function of
class PriorityQueue:
def __contains__(self, item):
return some(lambda (_, x): x == item, self.A)
What version of the product are you using? On what operating system?
svn revision r201
Please provide any additional information below.
The Python Queue.PriorityQueue class might be a good thing to build on.
Original issue reported on code.google.com by [email protected]
on 19 Jul 2012 at 5:07
The collections.defaultdict class:
http://docs.python.org/library/collections.html#collections.defaultdict
could be used for Python 2.5+ rather than the method in utils.py:228
import collections
try:
collections.defaultdict ## set builtin introduced in 2.5
except NameError:
class DefaultDict(dict):
.
.
.
Original issue reported on code.google.com by [email protected]
on 15 Sep 2009 at 3:00
The following definition is present in the MDP class:
def T(self,state, action):
"""Transition model. From a state and an action, return a list
of (result-state, probability) pairs."""
the value iteration procedure, though, expects the transition model to return a
list of (probability,result-state) pairs. I haven't looked at what other
algorithms might be expecting.
Original issue reported on code.google.com by [email protected]
on 21 Apr 2011 at 6:26
What steps will reproduce the problem?
Tried to use the learning.NearestNeighborLearner on the Sex Classification
dataset from this Wikipedia article on Naive Bayes classifiers:
http://en.wikipedia.org/wiki/Naive_Bayes_classifier#Sex_Classification
What is the expected output? What do you see instead?
Program wouldn't run due to bugs in the implementation of NNLearner
What version of the product are you using?
Bug exists in r30
Please provide any additional information below.
Here's my sample code:
import learning
examples =
[[6,180,12,'male'],[5.92,190,11,'male'],[5.58,170,12,'male'],[5,100,6,'female'],
[5.5,150,8,'female'],[5.42,130,7,'female'],[5.75,150,9,'female']]
ds = learning.DataSet(examples)
nnl = learning.NearestNeighborLearner(2)
nnl.train(ds)
print nnl.predict([5.1,105,6.3])
And I would expect it to print 'female'.
I believe the following fixes should work:
old learning.py, lines 217 - 231
else:
## Maintain a sorted list of (distance, example) pairs.
## For very large k, a PriorityQueue would be better
best = []
for e in examples:
d = self.distance(e, example)
if len(best) < k:
e.append((d, e))
elif d < best[-1][0]:
best[-1] = (d, e)
best.sort()
return mode([e[self.dataset.target] for (d, e) in best])
def distance(self, e1, e2):
return mean_boolean_error(e1, e2)
new learning.py:
else:
## Maintain a sorted list of (distance, example) pairs.
## For very large k, a PriorityQueue would be better
best = []
for e in self.dataset.examples:
d = self.distance(e, example)
if len(best) < self.k:
best.append((d, e))
elif d < best[-1][0]:
best[-1] = (d, e)
best.sort()
return mode([e[self.dataset.target] for (d, e) in best])
def distance(self, e1, e2):
return mean_error(e1, e2)
Specifically:
1) changed 'examples' to self.dataset.examples.
2) changed e.append((d,e)) to best.append((d, e))
3) and I could be wrong, but I believe you wanted mean_error, not
mean_boolean_error in your distance function.
For the gender classification example, it seems to work great. Thanks!
Original issue reported on code.google.com by [email protected]
on 19 Oct 2010 at 5:21
What steps will reproduce the problem?
1. Open file: http://aima.cs.berkeley.edu/python/csp.py
2. Look at data for NY: "NY: VT MA CA NJ"
3. Notice that the third neighbor should be CT, not CA
What is the expected output? What do you see instead?
As above.
What version of the product are you using? On what operating system?
Latest from web.
Please provide any additional information below.
N/A
Original issue reported on code.google.com by [email protected]
on 12 Nov 2007 at 9:47
Examples are checked via: map(self.check_example, self.examples).
self.check_example makes reference to self.attrs and self.attrnames, both
of which have not been initialized prior to making the map call.
Moving the map call to the end of the constructor fixes the problem.
Original issue reported on code.google.com by [email protected]
on 6 Dec 2007 at 1:52
What steps will reproduce the problem?
1. Run value_iteration for GridMDP with gamma = 1 (just like on Fig 17.3 of
AI:MA second edition)
2. You'll get an infinite loop because of check @ line 101 after 58'th
iteration because left-hand side is 0 and right-hand side is 0 too, so you get
0 < 0 which is always false.
What is the expected output? What do you see instead?
Expected output is stop on step 59
What version of the product are you using? On what operating system?
Python 2.7.1 on Mac OS X 10.7.2
Please provide any additional information below.
Most likely you should change < to <=
Also, there is no need to re-calculate this statement "epsilon * (1 - gamma) /
gamma" each time in the loop, it does not depend on any loop variable.
Original issue reported on code.google.com by [email protected]
on 12 Nov 2011 at 1:00
Resolve a stylistic incoherence by modifying Fig52Game's utility function so as
it makes use of if_, as TicTacToe's utility function does.
Original issue reported on code.google.com by Franck.Dernoncourt
on 13 Mar 2012 at 1:00
Attachments:
Many methods use "abstract" instead of raising NotImplementError when they are
destined to be implemented by a child class.
Fun fact, upon research. I end up in
http://norvig.com/python-iaq.html
finding an explanation for this.
Still, I think that, to avoid confusion, it should be fixed to either
abstract() as in the FAQ or just RaiseNotImplementedError.
Otherwise, it will raise NameError which is confusing (and abstract could
potentially be defined globally)
Original issue reported on code.google.com by [email protected]
on 11 Oct 2011 at 6:13
What steps will reproduce the problem?
1. Attempt to use the policy iteration algorithm
What is the expected output? What do you see instead?
Policy iteration should iterate several times before converging to a
solution. Instead, it converges after exactly one iteration.
What version of the product are you using? On what operating system?
The version posted on http://aima.cs.berkeley.edu/python/mdp.html, using
Python 2.6
Please provide any additional information below.
I've attached a fixed version of the file. The only line that changes
is 139:
U[s] = R(s) + gamma * sum([p * U[s1] for (p, s1) in T(s, pi[s])])
Original issue reported on code.google.com by [email protected]
on 29 Apr 2010 at 5:54
Attachments:
What steps will reproduce the problem?
1. For failing test in mdp.py, the doctest output was wrong. Fixed the doctest
output.
2. For 5 failing tests for the stochastic processes, the tests were failing
because the expected output from ignoring the results was "Nothing" but the
tests were still printing out results. This was because the test
'present_results' was actually printing to standard output and the "ignore"
method does not work in suppressing the output.
The fix was to test the 'query' method instead of the 'present_results' method.
What is the expected output? What do you see instead?
Expected: All tests should pass
Saw: 6 Tests failed - one in mdp.py and 5 in text.py
What version of the product are you using? On what operating system?
Using the latest from svn as of 07/24/2010.
OS: Ubuntu 10.04
Please provide any additional information below.
The files with fixes are attached below.
Original issue reported on code.google.com by [email protected]
on 25 Jul 2010 at 6:02
Attachments:
What steps will reproduce the problem?
1. python doctests.py -v *.py
What is the expected output? What do you see instead?
Traceback (most recent call last):
File "doctests.py", line 42, in <module>
for name in sys.argv if name != "-v"]
ImportError: No module named *
What version of the product are you using? On what operating system?
python 2.5
OS: windows xp
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 18 Oct 2007 at 1:30
What steps will reproduce the problem?
1. download of aima-data.2008.08.24.zip
2. scan with ClamTK
What is the expected output? What do you see instead?
Expect no virus. Instead contains - Worm.Sircam
What version of the product are you using? On what operating system?
Found using Ubuntu 10.04.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 17 May 2010 at 2:22
Attachments:
[deleted issue]
What steps will reproduce the problem?
1. Download and install code from /trunk and get test /data:
svn checkout http://aima-python.googlecode.com/svn/trunk/ python svn checkout http://aima-data.googlecode.com/svn/trunk/ data
2. Run the unit tests from the shell: $ python doctests.py -v *.py
...
/python/csp.py
Failed example: len(min_conflicts(NQueensCSP(8)))
...
3. Run the code analysis tool from the shell: $ pylint csp.py
...
Messages shows lots of errors. 35 occurrences of error id E1101 -
http://www.logilab.org/card/pylintfeatures - Used when a variable is accessed
for an unexistent member. 1 occurrence of error id E1121 - Used when a function
call passes too many positional arguments.
4. Download and installed code snapshot (instead of taking directly from /trunk
which is usually under active - unstable - development!) to see if that is more
stable -
http://code.google.com/p/aima-python/downloads/detail?name=aima-python.2007.06.1
5.zip
5. Download and installed data snapshot (and not from data /trunk) just in case
this test data is meant to be stable against python.2001.06.15.zip code base -
http://code.google.com/p/aima-data/downloads/detail?name=aima-data.2008.08.24.zi
p&can=2&q=
6. Run test cases relating to these 2 snapshots above: /python.2007.06.15$
python doctests.py -v *.py ... Get lots of different errors (e.g. missing file
../data/wordlist), so this snapshot does not pass the test cases either.
7. Also ran the above snapshot test against latest trunk /data and same errors.
What is the expected output? What do you see instead?
The last line printed should be "Test passed."
What version of the product are you using? On what operating system?
1. Latest code & data from respective /trunks, Python 2.7.1+, Ubuntu 11.04
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 25 Aug 2011 at 3:07
What steps will reproduce the problem?
>>> from logic import *
>>> expr("a") == expr("a")
True
>>> expr("a") != expr("a")
True
>>>
What is the expected output? What do you see instead?
The expected output is that expr("a") != expr("a") will return False
What version of the product are you using? On what operating system?
Tested on pyhton 2.6.3 and 2.5.2 on linux
Please provide any additional information below.
Easy fix - add this method to the Expr class:
def __ne__(self, other):
return not self.__eq__(other)
Original issue reported on code.google.com by [email protected]
on 3 Dec 2009 at 1:15
To reproduce the problem try running the following script:
import logic
print logic.dpll_satisfiable(logic.expr("A & ~B & C & (A | ~D) & (~E | ~D) & (C
| ~D) & (~A | ~F) & (E | ~F) & (~D | ~F) & (B | ~C | D) & (A | ~E | F) & (~A |
E | D)"))
It will produce "False" as an answer while there actually exists a model i.e.
the expected output should be:
{B: False, C: True, A: True, F: False, D: True, E: False}
The problem occurs in v193 of logic.py from SVN that arrives with v201 of the
overall package.
The problem is due to a missed case in find_unit_clause function in logic.py.
When searching for new unit clauses after assigning True to A, False to B, True
to C and False to F, the algorithm mistakenly assigns False to D due to clause
(A | ~D). The problem is due to missing check on whether the clause is already
true or not. A possible fixed version of the find_unit_clause function is below:
def find_unit_clause(clauses, model):
"""A unit clause has only 1 variable that is not bound in the model.
>>> find_unit_clause([A|B|C, B|~C, A|~B], {A:True})
(B, False)
"""
for clause in clauses:
num_not_in_model = 0
clause_true=False
for literal in disjuncts(clause):
sym = literal_symbol(literal)
if sym not in model:
num_not_in_model += 1
P, value = sym, (literal.op != '~')
else:
clause_true = clause_true | (model[sym] == (literal.op != '~' ))
if ((num_not_in_model == 1) and not(clause_true)):
return P, value
return None, None
Original issue reported on code.google.com by [email protected]
on 10 Dec 2012 at 10:34
Need to implement the missing algorithms.
Original issue reported on code.google.com by [email protected]
on 15 Jun 2007 at 7:39
What steps will reproduce the problem?
1. Run the following
from games import *
ttt = TicTacToe(3,3,3)
play_game(ttt,alphabeta_player,alphabeta_player)
2. Note that X always win, and that O seems to help X to win
What is the expected output? What do you see instead?
Expected is that there will always be a draw.
What version of the product are you using? On what operating system?
Ubuntu 10.10
Here is a patch to solve the problem.
Check which player is making the move and negate the utility when the player is
O.
class TicTacToe(Game):
...
def utility(self, state, player):
"Return the value to X; 1 for win, -1 for loss, 0 otherwise."
if player=="O":
return -state.utility
else:
return state.utility
Original issue reported on code.google.com by [email protected]
on 28 Feb 2011 at 6:55
What steps will reproduce the problem?
1. use of a minimaxplay, or alphabeta player on ConnectFour
2. running play_game
3.
What is the expected output? What do you see instead?
argmax() first argument is an empty list which will not have set[0] position
What version of the product are you using? On what operating system?
current, windows
Please provide any additional information below.
The simple fix of changing line: 293 list comprehension: y == 1 instead of 0
[(x, y) for (x, y) in state.moves if y == 1 or (x, y-1) in state.board]
the initial board is defined to not contain moves that have a y of zero
therefor making any initial move impossible. This will return an empty list and
cause a traceback
Original issue reported on code.google.com by [email protected]
on 16 Oct 2013 at 5:42
What steps will reproduce the problem?
import logic
logic.to_cnf("A | (B | (C | (D & E)))")
What is the expected output? What do you see instead?
expected: (D | A | B | C) & (E | A | B | C)
got this instead: (A | B | C | (D & E))
i.e. no effect except that that Nary correctly raised the '|' operations.
What version of the product are you using? On what operating system?
latest as of Oct 5th 2009
running on ubuntu linux, but it's likely not related to my OS.
Please provide any additional information below.
The issue is likely in the distribute_and_over_or procedure.
to_cnf("A | (B | (C & D))") produces the correct output, so it's not
properly recursing.
Original issue reported on code.google.com by [email protected]
on 6 Oct 2009 at 1:49
The current version of agents.py appears to have been truncated.
It is missing the EnvCanvas class and a set of tests for the gui environment.
Earlier versions of the code contain these.
Original issue reported on code.google.com by [email protected]
on 23 Jul 2010 at 12:56
What steps will reproduce the problem?
1. call random_player(game,state) in games.py
2.
3.
What is the expected output? What do you see instead?
Expected: A valid move returned
Unexpected Outcome:
Traceback (most recent call last):
File "<pyshell#28>", line 1, in <module>
games.random_player(game,gamestate)
File "/aima-python-read-only/games.py", line 121, in random_player
return random.choice(game.legal_moves(state))
TypeError: legal_moves() takes exactly 2 arguments (1 given)
What version of the product are you using? On what operating system?
Py 2.5.2 /linux latest aima code from svn
Please provide any additional information below.
To fix change line 121
from:
return random.choice(game.legal_moves())
to:
return random.choice(game.legal_moves(state))
Original issue reported on code.google.com by [email protected]
on 30 Jun 2008 at 1:55
Firstly it does not have a player argument so none of the search algorithms
work on it.
def utility(self, state, player):
"Return the value to X; 1 for win, -1 for loss, 0 otherwise."
if player == 'X':
return state.utility
if player == 'O':
return -state.utility
Does seem to work.
Tom Hall
Original issue reported on code.google.com by [email protected]
on 11 Aug 2011 at 6:55
The constructor param "udpate_state" should be "update_state".
Original issue reported on code.google.com by [email protected]
on 17 Sep 2008 at 4:41
just a minor typo,
line 49: NP = 'Pronoun | Noun | Article Noun | Digit Digit | NP PP | NP
RelClause',
Original issue reported on code.google.com by eriksilkensen
on 11 Oct 2010 at 5:38
"best" is described as a sorted list of (distance, example) pairs.
Yet when looping over "examples" and filling this list, we simply append
while the count is less than "k", which violates the sorting condition. We
only start sorting once the list is full and the new example has a distance
less than the top of the list.
As an example, take k=5, and imagine a dataset where the first four
instances are the furthest from the example we want to predict. Then
imagine that the fifth example happens to be the closest. Then when we
evaluate the rest of the examples, none will be added to the list "best"
since the condition on line 225 is never met.
Original issue reported on code.google.com by [email protected]
on 13 Dec 2009 at 2:04
Hi,
I'm currently trying to code algorithms provided in AIMA, but I don't
understand why the Agent class isn't used in chapter 3 and 4, where agent
programs are implemented as functions outside classes, and not as Agent's
methods.
For instance, instead of "def SimpleReflexAgentProgram(rules,
interpret_input):", why not
class SimpleReflexAgent(Agent):
def __init__(self, rules):
...
def simple_reflex_agent_program(percept):
...
Agent.__init__(self, simple_reflex_agent_program)
I guess there's a good reason for that, because previous versions of the code
were actually doing that. Could someone please explain to me ?
Original issue reported on code.google.com by [email protected]
on 19 Jul 2012 at 12:23
the use of argmax() for the first max node in the alpha beta pruning searches
will not allow alpha pruning to be updated among the min successors of the
initial max mode. code in question:
# Body of alphabeta_search:
return argmax(game.actions(state),
lambda a: min_value(game.result(state, a),
-infinity, infinity))
alpha will always be -infinity instead of a value discovered in a previous min
child/successor.
Original issue reported on code.google.com by [email protected]
on 22 Nov 2012 at 10:16
I was playing with the Criminal(West) example and the new fol_bc_ask()
stuff, couldn't get it to work unless I changed conjuncts() as follows:
def conjuncts(s):
if isinstance(s, Expr) and s.op == '&':
r = []
for arg in s.args:
r.extend (conjuncts (arg))
return r
else:
return [s]
Without this change, conjuncts() will do this:
>>> conjuncts (sar.args[0])
[((American(v_1) & Weapon(v_2)) & Sells(v_1, v_2, v_3)), Hostile(v_3)]
Original issue reported on code.google.com by [email protected]
on 2 Mar 2009 at 6:53
maxim@maxim-desktop:~$ date
Tue Oct 11 11:55:33 IST 2011
maxim@maxim-desktop:~$ svn checkout
http://aima-python.googlecode.com/svn/trunk/ aima-python-read-only
A aima-python-read-only/doctests.py
A aima-python-read-only/nlp.py
A aima-python-read-only/games.py
A aima-python-read-only/rl.py
A aima-python-read-only/logic.py
A aima-python-read-only/images
A aima-python-read-only/images/dirt.svg
A aima-python-read-only/images/wall-icon.jpg
A aima-python-read-only/images/vacuum-icon.jpg
A aima-python-read-only/images/dirt05-icon.jpg
A aima-python-read-only/images/IMAGE-CREDITS
A aima-python-read-only/images/makefile
A aima-python-read-only/images/vacuum.svg
A aima-python-read-only/learning.py
A aima-python-read-only/utils.py
A aima-python-read-only/probability.py
A aima-python-read-only/mdp.py
A aima-python-read-only/agents.py
A aima-python-read-only/text.py
A aima-python-read-only/csp.py
A aima-python-read-only/search.py
A aima-python-read-only/planning.py
Checked out revision 120.
maxim@maxim-desktop:~$ cd aima-python-read-only/
maxim@maxim-desktop:~/aima-python-read-only$ python --version
Python 2.7.1+
maxim@maxim-desktop:~/aima-python-read-only$ python doctests.py *.py
Traceback (most recent call last):
File "doctests.py", line 18, in <module>
for arg in args if arg != "-v" for name in glob.glob(arg)]
File "/home/maxim/aima-python-read-only/learning.py", line 490, in <module>
attrnames="Rings Distressed Temp Pressure Flightnum")
File "/home/maxim/aima-python-read-only/learning.py", line 44, in __init__
self.examples = parse_csv(DataFile(name+'.csv').read())
File "/home/maxim/aima-python-read-only/utils.py", line 649, in DataFile
return AIMAFile(['..', 'data', name], mode)
File "/home/maxim/aima-python-read-only/utils.py", line 645, in AIMAFile
return open(apply(os.path.join, [dir] + components), mode)
IOError: [Errno 2] No such file or directory:
'/home/maxim/aima-python-read-only/../data/orings.csv'
Original issue reported on code.google.com by [email protected]
on 11 Oct 2011 at 9:56
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.