Society of Robots - Robot Forum

Software => Software => Topic started by: benji on April 29, 2008, 04:12:30 PM

Title: A.I algorithms implementation
Post by: benji on April 29, 2008, 04:12:30 PM
hey folks, im actually looking for a programming language/environment to implement A.I algorithms
whats the best thing for A.I to use?
any ideas
Title: Re: A.I algorithms implementation
Post by: hgordon on April 29, 2008, 04:24:05 PM
What algorithms ?
Title: Re: A.I algorithms implementation
Post by: benji on April 29, 2008, 04:25:00 PM
any complicated thinking ones, like D* or somthin,,
Title: Re: A.I algorithms implementation
Post by: JesseWelling on April 29, 2008, 04:51:24 PM
C or somethin..  ;)
Title: Re: A.I algorithms implementation
Post by: benji on April 29, 2008, 05:07:15 PM
that would be like hell to build these stuff in c,,
i did use MATLAB and it works great but its not intented to A.I
i have heard about prolog ,,just asking if there is other/easier/most common A.I environments
Title: Re: A.I algorithms implementation
Post by: hgordon on April 29, 2008, 05:17:07 PM
Lisp (and derivatives such as Scheme) has historically been the standard application language for searches and problem solving.  Lisp is not currently in vogue, but there's an interesting article here on how Lisp has been used by JPL on robotic spacecraft -
    http://www.flownet.com/gat/jpl-lisp.html

and another article on use of Lisp in the early days of iRobot -
    http://www.cs.cmu.edu/~chuck/pubpg/LUV-1995.html

and one more on using Lisp with Lego RCX  -
    http://www.encyclopedia.com/doc/1G1-144048027.html
Title: Re: A.I algorithms implementation
Post by: benji on April 30, 2008, 02:49:06 AM
thanks man for the links,, is there a link to a compiler ?
or a tutroial website about Lisp?
Title: Re: A.I algorithms implementation
Post by: JesseWelling on April 30, 2008, 07:03:41 AM
If you think C is a bother you are going to have a real hayday with LISP.

The most widely used is CLISP (http://clisp.cons.org/).
Title: Re: A.I algorithms implementation
Post by: benji on April 30, 2008, 07:10:13 AM
thnks Jesse,, lookslike a link loaded with info
Title: Re: A.I algorithms implementation
Post by: brijesh on April 30, 2008, 09:33:10 AM
LISP has been widely used in AI implementation. But LISP has huge learning curve.

Python and Ruby come close to LISP and are good choices. Specially since they are very easy to learn.

Check out the essays on this page, specially the ones at the bottom.

http://www.paulgraham.com/articles.html

He talks about LISP and python.

Title: Re: A.I algorithms implementation
Post by: benji on April 30, 2008, 10:04:38 AM
thanks brijesh,, but what about prolog guys? nobody mentioned it malthough i see it as the most programming language attached to A.I
Title: Re: A.I algorithms implementation
Post by: hgordon on April 30, 2008, 11:10:42 AM
LISP has been widely used in AI implementation. But LISP has huge learning curve.
...
http://www.paulgraham.com/articles.html
Interesting link - there's a nice summary of his thoughts here -
    http://www.paulgraham.com/icad.html

A Prolog interpreter/compiler can be written in Lisp - here's the code from Peter Norvig's Lisp book - "Paradigms of Artificial Intelligence Programming" -
    http://norvig.com/paip/prolog.lisp

No argument about the Lisp learning curve - I'll vouch for that first-hand.  The best books I've found so far to help with this are Friedman / Felleisen "The Little Schemer" and Touretkzy "Common Lisp - A Gentle Introduction to Symbolic Computation"
Title: Re: A.I algorithms implementation
Post by: brijesh on April 30, 2008, 03:33:47 PM
thanks brijesh,, but what about prolog guys? nobody mentioned it malthough i see it as the most programming language attached to A.I

I don't know anything about Prolog, so I went to wikipedia here is what I found as its description.

"Having its roots in formal logic, and unlike many other programming languages, Prolog is declarative: The program logic is expressed in terms of relations, and execution is triggered by running queries over these relations. Relations and queries are constructed using Prolog's single data type, the term. Relations are defined by clauses. Given a query, the Prolog engine attempts to find a resolution refutation of the negated query. If the negated query can be refuted, i.e., an instantiation for all free variables is found that makes the union of clauses and the singleton set consisting of the negated query false, it follows that the original query, with the found instantiation applied, is a logical consequence of the program. This makes Prolog (and other logic programming languages) particularly useful for database, symbolic mathematics, and language parsing applications. Because Prolog allows impure predicates, checking the truth value of certain special predicates may have some deliberate side effect, such as printing a value to the screen. This permits the programmer to use some amount of conventional imperative programming when the logical paradigm is inconvenient."

Can't say I understood anything in that paragraph. Unless you are planning on doing a PhD in AI, stick to Python/Ruby. They will get the job done. Plus Python has huge libraries for image processing, math, GUI etc. which usually makes ones life much easier.


Title: Re: A.I algorithms implementation
Post by: benji on April 30, 2008, 03:58:25 PM
i actually did post a prolog tutorial link and i did read a little and it doesnt look hard though
...
Title: Re: A.I algorithms implementation
Post by: Tsukubadaisei on May 01, 2008, 08:12:13 PM
I have seen LISP been mentioned a few times in this topic. I agree with everything mentioned above but there is one simple fundamental detail that hasn't been mentioned yet: currently there are no microcontrollers able to interpret LISP(as far as I know). Theoretically it is possible(and practical) but it seems that nobody wants to write one.
Title: Re: A.I algorithms implementation
Post by: JonHylands on May 02, 2008, 06:42:42 AM
Well, lets be perfectly honest here - nobody is going to be doing any really interesting AI algorithms on a microcontroller, so its kind of a moot point. Certainly not the type where it matters what language you use.

One of the main reasons these mentioned languages are good for AI is because they take care of a lot of details for you, and you get to concentrate on the problem at hand, and not silly things like memory management. That's the main reason I use Smalltalk for all my AI-level robotics stuff. Incremental interpreter, garbage collection, polymorphism, inheritance - those are the things you want to solve really hard "thinking" problems.

- Jon
Title: Re: A.I algorithms implementation
Post by: JesseWelling on May 02, 2008, 06:51:30 AM
I guess I come at it the other way. I read tons and tons of Papers and try to make the best implementation I can of the ideas I find and like. Generally I use C or C++ for performance reasons.

But I imagine when I start having 'great' new ideas, i might switch to something more fluid and high level. When I took AI in college my lab partner and I were one of the only ones to use Ruby, and it was a rather good language. It was actually about as fast to run interpreted Ruby as it was to run compiled CLISP, so it makes for a great high level language.
Title: Re: A.I algorithms implementation
Post by: hgordon on May 02, 2008, 02:55:03 PM
I have seen LISP been mentioned a few times in this topic. I agree with everything mentioned above but there is one simple fundamental detail that hasn't been mentioned yet: currently there are no microcontrollers able to interpret LISP(as far as I know). Theoretically it is possible(and practical) but it seems that nobody wants to write one.

I'm working on a version of Lisp that fits on my Blackfin, as discussed here - 
    http://www.surveyor.com/cgi-bin/robot_journal2.cgi/2008/04/12#154

Since that was posted, I have added robot support (motor drive, sensor input), and will soon be supporting basic vision processing.  Honestly, I don't know how far I will get in solving any really "hard" problems, but it seems like a worthwhile effort to try.  Already, I have found some benefits in being able to create new commands that are used in a somewhat "natural language" way.
Title: Re: A.I algorithms implementation
Post by: benji on May 02, 2008, 03:35:39 PM
any ideas of what boards/processors that run lisp programs? what is it used to control a robot with lisp other than a microcontroller or a pc?
Title: Re: A.I algorithms implementation
Post by: hgordon on May 02, 2008, 04:25:30 PM
I'm running on the Blackfin camera board - http://www.surveyor.com/index_blackfin.html

However, any 32-bit processor would work, as most interpreters I've investigated are written in C.  The main thing issue that you need a LOT of memory - I have allocated almost 16MB to the data heap and stack, though I generally won't need more than a few MB.

The code runs on my processor card from memory or interactively via console, though all processing is onboard.  So far, I've only added 2 primitives to the language - "robot" and "rand".  The "robot" primitive is used for commands like "robot forward" "robot stop", as well as queries like "robot range", "robot time".  "rand" is a random number generator that will be useful in developing behaviors.  I'm in the process of adding vision functions, initially just using color, but later adding shape processing, e.g.

define redball (80 160 100 130 125 175)
robot find redball

where the define sets a range of YUV colors and "find" does a search.  Really primitive, but it will be fun to see how far this can go ...
Title: Re: A.I algorithms implementation
Post by: 3v0 on May 08, 2008, 07:17:13 PM
First post!  Hi.

Platform is very important to the question.

I did a good deal of AI in the 80's.  For me the main appeal of lisp was the ability to generate code and execute it from within the same program.  The distinction between data and code blurred. As soon as you move to compiled lisp or any other compiler you loose that.

If you know what you are doing, and what you want to do, you can program AI in most any language.  In a broad sense a procedural language is a procedural language.  If you are working on a microcontroller C is often your best choice.  But AI as I am using it here, is a vague notion and there are going to be exceptions.

No rocks or rotten eggs please.  If one used a micro controller with a decent stack, interpreted forth could be a very good AI tool.  Forth like lisp is very flexible.   If you can not get your head around RPN then never mind. It would be a lot of fun to try.

 
Title: Re: A.I algorithms implementation
Post by: benji on May 09, 2008, 03:26:11 AM
well to be honest with ya i never tried LISP but i did read about PROLOG and it says that this language is different from the others because its
Knowledge-BASED , which is easier and more flexible for AI.
about platforms,,
 well, is there a more advanced language than C in mcu's?
i think most of these complicated algorithms would need a pc , more processing power than the mcu
specially when it comes to saving big matrices in memory
somthin like an image ,,a movie of frames....or a room map,,,maybe face photos for face recognition ,.,,,etc...
Title: Re: A.I algorithms implementation
Post by: Admin on May 23, 2008, 09:26:30 PM
Quote
If you know what you are doing, and what you want to do, you can program AI in most any language.  In a broad sense a procedural language is a procedural language.  If you are working on a microcontroller C is often your best choice.  But AI as I am using it here, is a vague notion and there are going to be exceptions.
I entirely agree. AI to me is just a concept, I don't really believe in it . . . If you know the solution to a problem and can code it, AI is pointless :P

Title: Re: A.I algorithms implementation
Post by: benji on May 24, 2008, 03:43:28 AM
there are some algorithm that would be very hard to implement in just C .
like mapping an area and saving the big map, then using it to navigate a vehicle,,
or a robot that plays chess ,,,,
there are languages made for this purpose,,not just C, im not saying you cant do it in C but why not use better languages for that .
A.I is not just coding a problem ,,it studies how you should start thinking about a problem
maybe its more philosophy than coding but its how to approach a problem
there is a good book

A.I  a modern approach
by stuart russell and peter norvig
Title: Re: A.I algorithms implementation
Post by: Admin on May 24, 2008, 07:10:41 AM
Yea its definitely a philosophy thing . . .

I found this summary of the book you recommended:
http://aima.eecs.berkeley.edu/slides-pdf/

And towards the bottom here lots of links to programming for AI:
http://aima.cs.berkeley.edu/ai.html
Title: Re: A.I algorithms implementation
Post by: benji on May 24, 2008, 07:14:39 AM
thanks for the links, great ones
Title: Re: A.I algorithms implementation
Post by: toborman on May 31, 2008, 08:15:18 PM
It's a good idea to determine what functions or behaviors you want to implement.  High level functions can usually be implemented in any language, low level functions may be constrained by the hardware.

check the human mind map for some ideas.

http://mindmap.iwarp.com