Collective Intelligence

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Little Richie
Posts: 127
Joined: Tue Feb 05, 2008 3:02 am UTC
Location: Orlando, Florida

Collective Intelligence

Postby Little Richie » Thu Feb 07, 2008 3:53 am UTC

I am indulged to write a collective intelligence program, for now i will start in matlab.
is there a better program to do this in.?


What i was thinking about would have each 'critter' have things that make them happy and not happy, also things they need, over time. mainly the ability to 'talk' to each other, give them some memory. Verry basic. Then introduce them to an inviornment with all of the above. That is just for starters.
With man gone, will there be hope for gorilla?
Check out my blog, my mission to save the world.

User avatar
evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: Collective Intelligence

Postby evilbeanfiend » Thu Feb 07, 2008 1:47 pm UTC

the only problems you may get with using matlab is execution speed, but if you keep things simple it should be fine. other wise you are looking at c++, c or asm.

from the sound of it though you may have dramatically underestimated the complexity of the task. if i were you id start with some very simple non-communicating, memoryless automata and see how that goes.
in ur beanz makin u eveel

User avatar
Little Richie
Posts: 127
Joined: Tue Feb 05, 2008 3:02 am UTC
Location: Orlando, Florida

Re: Collective Intelligence

Postby Little Richie » Thu Feb 07, 2008 6:04 pm UTC

That would be a great idea, starting with somthing easy, I am getting ahead of myself a bit. communicating would be hard to code (well i dont know how (yet)) the memory I believe i can deal with, at least letting it remember the last 5 places it was at, and the "happyness" value at each. Starting with only one affecting factor(or two one good one bad), having it output a table to test if it is working. Then go back and fox my code.

On the speed of the program, what would the limit be? I was not aware of a limit, being the only things I have done have been to draw non moving points and functions.
With man gone, will there be hope for gorilla?
Check out my blog, my mission to save the world.

User avatar
evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: Collective Intelligence

Postby evilbeanfiend » Fri Feb 08, 2008 10:31 am UTC

iirc matlab can export to c or c++ but as with most automatic translation its not 100% efficient so you will probably be slightly slower than coding it natively in a close-to-the-metal language, however i reckon it probably will be 'fast enough' as long as you don't have to many 'creatures' alive at a time.

for the absolute simplest thing like this you may want to look at conway's game of life
in ur beanz makin u eveel

User avatar
Mortabis
Posts: 50
Joined: Fri Feb 08, 2008 12:24 am UTC

Re: Collective Intelligence

Postby Mortabis » Sat Feb 09, 2008 2:44 am UTC

This would be easiest in an object-oriented language, where you can instantiate objects of the 'critter' class and use message passing for the communication and stuff. I've never really used message passing, but I think I know how it's done.

Though I am a huge fan of procedural programming, you would definitely want to use objects for this.
Image

User avatar
Little Richie
Posts: 127
Joined: Tue Feb 05, 2008 3:02 am UTC
Location: Orlando, Florida

Re: Collective Intelligence

Postby Little Richie » Sat Feb 09, 2008 3:43 am UTC

What would you suggest as a good object code? I am inexperansed, would somthing like VB do?
With man gone, will there be hope for gorilla?
Check out my blog, my mission to save the world.

User avatar
xyzzy
Meta-Titled
Posts: 263
Joined: Sun Mar 18, 2007 10:02 pm UTC
Location: Colossal Cave
Contact:

Re: Collective Intelligence

Postby xyzzy » Sat Feb 09, 2008 12:57 pm UTC

Smalltalk is the original OO language, and considered one of the best. I haven't used it though, so YMMV and all that.
"Wile E. Coyote was a theoretical mathematician." - Leliel
"Modern life can be so boring without elements of the bizarre or the fantastical. Hence, we have steampunk." - Me

User avatar
Mortabis
Posts: 50
Joined: Fri Feb 08, 2008 12:24 am UTC

Re: Collective Intelligence

Postby Mortabis » Sat Feb 09, 2008 2:32 pm UTC

Python I think would be neat. Right now the only OOP language that I know well is Java, but I'm trying to switch to C. I happen to prefer procedural programming, as I said before, so...

Java isn't a hard language to learn, and if you don't need lots of performance, it should work. But be aware that because, understandably, your main method has to be static (which means instanced objects can't use it), and you can't call instance (non-static) methods from it, the only way to call instance methods is to defer to a class constructor. For example, this snippet from my recent recreation of the stars screensaver:

Code: Select all

   StarFire() /* LOTS OF MAGIC CODE HERE, beware! */
   {
      setBackground(new Color(0,0,0)); //black
      setForeground(Color.white);
      setSize(Toolkit.getDefaultToolkit().getScreenSize().width, //little hack to get width and height of whole screen
         Toolkit.getDefaultToolkit().getScreenSize().height);
      setTitle("StarFire");
      getContentPane().setLayout(new FlowLayout());
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //the x button thing actually does stuff now I think
      setVisible(true); //go to Paint method
   }//end constructor method
//==============================
   public static void main(String[] args)
   {
      initArray();
      StarFire frame = new StarFire(); //go to StarFire constructor
   }//end main method


EDIT: Oh, and by the way, this is all in the StarFire class. I wrote this procedurally but you need a paint() method for all graphics apps in Java, which must be non-static. And you *can* call non-static methods through instanced objects with main, since it's sort of going through a constructor.
Image

maafy6
Posts: 102
Joined: Wed Aug 22, 2007 10:43 pm UTC

Re: Collective Intelligence

Postby maafy6 » Sat Feb 16, 2008 2:47 am UTC

Mortabis wrote:But be aware that because, understandably, your main method has to be static (which means instanced objects can't use it), and you can't call instance (non-static) methods from it, the only way to call instance methods is to defer to a class constructor. For example, this snippet from my recent recreation of the stars screensaver:


Not exactly. Instance methods must be called in assocation with an instance, so the following is just as legal.

Code: Select all

StarFire() /* LOTS OF MAGIC CODE HERE, beware! */
   {   }//empty
//==============================
   public static void main(String[] args)
   {
      initArray();
      StarFire frame = new StarFire(); //go to StarFire constructor
      frame.setBackground(new Color(0,0,0)); //black
      frame.setForeground(Color.white);
      frame.setSize(Toolkit.getDefaultToolkit().getScreenSize().width, //little hack to get width and height of whole screen
         Toolkit.getDefaultToolkit().getScreenSize().height);
      frame.setTitle("StarFire");
      frame.getContentPane().setLayout(new FlowLayout());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //the x button thing actually does stuff now I think
      frame.setVisible(true); //go to Paint method
   }//end main method


Of course, I'd have probably had all of that particular stuff in the constructor, but the point is you aren't limited to just calling constructors over and over again.

EDIT: Okay, you must have cheated and snuck your edit in while I was throwing this out. And, to be picky, it's not that your "going through the constructor" to do that, it's that you have an object and so you are allowed to call its methods. It took a little bit for me to come around to this way, because early intuition says that if you are in the main method of the StarFire class, then you must be in an instance of the StarFire class, which isn't true.

User avatar
tetsujin
Posts: 426
Joined: Thu Nov 15, 2007 8:34 pm UTC
Location: Massachusetts
Contact:

Re: Collective Intelligence

Postby tetsujin » Tue Feb 19, 2008 7:00 pm UTC

evilbeanfiend wrote:the only problems you may get with using matlab is execution speed, but if you keep things simple it should be fine. other wise you are looking at c++, c or asm.


How's that?

I mean, most of what you do in Matlab is call operations that are already pretty well optimized, in a scripting language that itself is pretty well optimized as I understand... Is there something about the problem that makes it rely more heavily on the scripting rather than the operations provided by Matlab itself?
---GEC
I want to create a truly new command-line shell for Unix.
Anybody want to place bets on whether I ever get any code written?

User avatar
evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: Collective Intelligence

Postby evilbeanfiend » Wed Feb 20, 2008 11:10 am UTC

err no, i was talking in general, matlab can be slower than optimised low level code, i would expect for this project it would be fast enough provided you weren't trying to cope with too many agents simultaneously.
in ur beanz makin u eveel

User avatar
Bruce
Posts: 447
Joined: Tue Feb 12, 2008 11:44 am UTC
Location: Melbourne

Re: Collective Intelligence

Postby Bruce » Wed Feb 20, 2008 11:19 am UTC

I do not have real statistics, but in my experience Matlab is significantly slower as large processing jobs. I suggest some reading on existing intelligent systems such as back propagation and genetic algorithms. It will give you a leg up and save reinventing the wheel.
COMFORT, n.
A state of mind produced by contemplation of a neighbor's uneasiness.

Dakman
Posts: 50
Joined: Sat Jul 07, 2007 7:49 am UTC

Re: Collective Intelligence

Postby Dakman » Wed Feb 20, 2008 3:35 pm UTC

I had thought of an idea like this before. It was a grid like system with resources placed in diffrent parts of the grid and lifeforms would wander around and could remember where resources are, like food and water, and would also remember things like other lifeforms that could harm them so they would avoid those areas, and when lifeforms were near each other they would share information about grid contents. The goal was basically to see how efficient they could live their lifes.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 7 guests