Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Which language to use for evolution simulation

  1. Feb 2, 2014 #1
    Hi guys, my friend and i are planning on creating an evolution simulation. We are however, trying to balance between the amount of time to write code and the amount of time our simulation will take to run, and how fast it runs(the simulation is in real time). So, what programming language do you guys think we should use?
  2. jcsd
  3. Feb 2, 2014 #2
    I would use C++.

    There is no trade offs here. There is more "design" in this project than implementation. If you can successfully design the logic, then you should be able to implement it in any modern development environment with any modern language.

    So pick a compiled language that you are comfortable with. If you're not comfortable with any compiled language, this is a big enough development project to adopt one.

    Modern compilers are efficient enough, especially in optimizing mode (for the final "release") that there is no reason to go to assembler. I would also advise against Forth - unless you already love Forth.
  4. Feb 2, 2014 #3


    Staff: Mentor

    if your sim requires a fair amount of graphics then you could use Java. Java has the added advantage of easy portability across platforms like windows to linux to maxosx...

    It you're new to programming then you could check out Processing.org and its extensive Java based IDE and Open GL graphics. The IDe was designed for casual programmers and graphic artists who wanted to create interactive art using programming. The Procesing model of a setup() that is run once and a draw() method that is called repeatedly lends itself to evolutionary sims design. Processing also has an export feature for windows, linux and macosx platform executables as well as an android development feature for android sideloading and a javascript development feature for web applications. Processing comes with numerous examples and online support and did I mentions its FREE.

    Lastly, if your sim requires numerically solving differential eqns then you should look at the Open Source Physics to see if you can leverage its library and displays to create your sim. (www.compadre.org/osp
    Last edited: Feb 2, 2014
  5. Feb 2, 2014 #4
    Thank you for the advice jedishrfu and .Scott. Java was a language both me any my friend were leaning towards since we have experience with the language, and for now it seems like that is the one we will use, although we are still in the elementary planning stages.
  6. Feb 4, 2014 #5
    The wikipedia site about genetic programming suggests lisp because it's a tree based language.
    So you could for example use clojure - a lisp dialect for the java virtual machine - because that would make it very easy to write a program that generates programs and compiles them on the fly.
    So basically your program generates different pieces of code representing the different individuals in your world and then compiles all of that to machine code and runs it, all without actually starting a new program. The newly compiled code is injected into the program at runtime.
  7. Feb 4, 2014 #6


    Staff: Mentor

    There are also many java genetic algorithm implementations as well.

    JGAP framework has been used in some implementations:


    Of course, the beauty of clojure is that it can call upon java libraries to accomplish its task and its functional based.

    Some other alternatives also would be groovy (java superset with closures) and scala (better java than java but scala language changes between versions may adversely affect your code as its still a work in progress). Both of these use the jvm and java libraries although for scala you need to think a bit differently as its more expressive.
  8. Feb 5, 2014 #7


    User Avatar

    Staff: Mentor

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Which language to use for evolution simulation