Hacker News new | past | comments | ask | show | jobs | submit login
Java implementation of algorithms from Norvig And Russell's AI (code.google.com)
78 points by zengr on April 4, 2011 | hide | past | favorite | 17 comments



I think Ravi and Ciaran and the other contributors have done a great job with this project, and I thank them for their efforts. If you are interested in AI, and if you program in Java, then probably it will be worth your time to take a look at this project. That is true whether you regard Java as a 60-pound weight or as the greatest thing since sliced bread. Remember, a programming language is just a tool, not a religion.


In case anyone else wants to tinker with it in a Git environment, I've created a clone repo on GitHub at https://github.com/gnufs/aima-java


Not sure why this is interesting. Writing exploratory prototype-level AI code with a 60-pound weight tied to your legs is hardly pleasant. I think most people will find the Python [1] and Lisp [2] versions of the code more useful.

[1] http://code.google.com/p/aima-python/ [2] http://www.eecs.berkeley.edu/~russell/code/doc/install.html


Not to rant, but I don't understand why every mention of a Java project on here gets some kind of snarky response about Java. If you don't like Java, then don't read the article, and don't spam the comment section with "why would anyone want to use Java?"

Obviously if someone is clicking this link, it's because, for whatever personal or work reasons, would like to see a Java implementation of the algorithms, and if they want a discussion of them, would click the comment section. They are not clicking the comment section, however, to hear about how you don't like the language.


Bad craftsmen blame the tools.


Sorry, but this is such an oft-applied aphorism that I feel it needs a corollary:

A good craftsman has the wisdom to select the right tool for the job.


Of course, the "right" tool for a job might, and often does, vary from craftsman to craftsman.

It probably wouldn't be "craft" were that not the case.


As long as it's not Java, right? :P


Hey, you're talking to somebody who's doing almost all of his programming these days in j2me! Sometimes the customer restricts the craftsman's selection of tools... :-)


"Writing exploratory prototype-level AI code with a 60-pound weight tied to your legs is hardly pleasant."

heh! I started the aima java project and was the only contributor for for a long time.I've since handed it over to Ciaran O'Reilly of SRI who is is doing a great job running the project, (and rewriting a lot of my code!) and I no longer code in java. I am still listed as one of the "owners" of the project, though I don't contribute anything these days except the occasional bugfix.

That said, I started writing the code because I was bored out of my skull writing enterprise sw at ThoughtWorks and Eclipse was open anyway. I had no intention to open source it. Then I saw a post by Peter Norvig on a mailing list somewhere saying something to the effect that the authors had tried a few times to get their students to write a Java version but it never worked out. So I thought to myself "hey i have a lot of Java code sitting on my hard disk so why don't I send it to Peter?" And so I did. And that is how the project started. [2]

"I think most people will find the Python and Lisp versions of the code more useful."

That depends on your definition of "useful".

I agree there is a unnecessary cruft thanks to the use of Java [1] and my overly enterprisey coding style, but otoh of all the aima code bases, the java code (a)is the most complete (in terms of number of algorithms implemented)(b) has features like gui demos which don't exist in the other language versions, (c) has the most contributors, (d)moves the fastest in terms of frequent updates and releases, and (e) is relatively bug free (600 ish unit tests iirc).

Most importantly more people are downloading and using the java code more than any other version.

In short, running code that is written in a terrible language beats hypothetical code written in an elegant one ;-).

And I say this as a lover of elegant languages and terse code. My last project was in Haskell, C and Lua for e.g. So yes I feel your pain when you compare Java and python(or lisp). But I don't believe code is worthless just because it is written in Java. The worth of sw is in its utility, not so much its elegance.

And really, I don't want to defend or justify it too much. Aima Java was a "scratch an itch" (and maintain my sanity into the bargain) project for me and it is what it is with all its charms and flaws. It is (MIT licensed) free software . Use it or not as you like.

Interestingly enough the aima code base makes a good testbed for learning a language. I wrote a Clojure version once when I was learning Clojure, but I never released it. Since the algorithms cover a lot of ground, search,logic, probability etc, implementing them in a new language is almost guaranteed to teach you something. (so if anyone here wants to do aima-erlang or aima-haskell ... :-) )

And since we are on HN, I close with an request to any Java devs looking for a good project to work on to consider aima-java. Ciaran and co are most welcoming.

[1] One of my friends wrote a Scala version to learn Scala and you can see the difference between Java and Scala(even when the latter is written by a beginner) by comparing them http://code.google.com/p/aima-scala/ . This project should get more attention and if any one wants a good project to hack on I reccomend this.

[2] Peter ripped my code to shreds and sent back a 36 point(iirc) review on the lines of "Why are you doing X? You should be doing Y instead". I learned more from that email than I had in many years as an "industry" dev. Hey how many people here got their code reviewed by Peter Norvig? :-P


+1 for your interesting perspective.

Wish I could delete my own comment - I was in a grumpy mood :-/


"Wish I could delete my own comment - I was in a grumpy mood :-/"

don't worry about it! ( I am a devoted reader of your blog btw. Great writing)


Any chance you'd be willing to share that 36 point review email? That sounds fascinating.


lost when I moved on from TW . Sorry. :-)


Last I looked, aima-python was quite incomplete. Good project for someone.


Yes. I've been meaning to update the aima-python code to the third edition and finish the unfinished bits. Volunteers to help would be greatly appreciated.


Any reason why you consider this "exploratory" and "prototype level" code? I would have thought it was quite useful to explore around using whatever you feel like and then when you settle on an algorithm, here you have Java implementations ready to use for a high performance implementation.

NB: also, btw, there are plenty of JVM languages that are good for "exploration" anyway. I love using Groovy for this kind of stuff.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: