How to bootstrap Framsticks through Python? 

Hello all,

I am a doctoral student specializing in artificial intelligence, am trying to do a project that requires some control of Framsticks through Python. I am running Linux Mint 17.1. I am therefore wondering if there is an effective way to bootstrap Framsticks in Python, and, if so, what methods have been used successfully. Your help is greatly appreciated. I am sorry if my question is vague, but since my project will be original research, I would prefer not to give away additional details at this time.

Forums: 
Maciej Komosinski's picture

We do lots of Framsticks research projects all the time and we love Python! Since you do not mention exactly what you want to do (and if you need "real-time", step by step control or not), I will outline a few possibilities.

First, learning and using FramScript will be most useful. It will let you control the way Framsticks works and design an interface with other (e.g. Python-based) scripts used to prepare input data (if needed) and to analyze output/results (if needed). Going through and completing the entire tutorial is highly recommended; the last section of the tutorial also addresses your question.
http://www.framsticks.com/common/tutorial/index.html

  • To read and write Framsticks files in Python (in particular, genotypes), use the "framsfiles" module from https://www.framsticks.com/svn/framsticks/framspy/
  • To perform evolutionary experiments controlled from a Python script (the logic of the algorithm is implemented in Python, while the Framsticks library is used to perform mutation, crossover, and evaluate genotypes), use FramsticksLib.py from https://www.framsticks.com/svn/framsticks/framspy/ This way you can not only perform evolution, but even design and use your own genetic representation implemented entirely in python.
  • If you don't want to implement the optimization logic in python yourself, you can use FramsticksEvolution.py from https://www.framsticks.com/svn/framsticks/framspy/ and have easy access to a multitude of evolutionary architectures.
  • Controlling Framsticks more fully (e.g. real-time access to properties and fields within the simulator) is possible as in FramsticksLib.py – see frams-test.py for examples.
  • Another option is to use Framsticks server. Then you communicate with the Framsticks engine (just like you would control a CLI) using any programming language/tool by following a simple text protocol.
    http://www.framsticks.com/common/server.html
  • Python is integrated with Framsticks as well as a language that can be used within Framsticks. So you can, for example, call a Python function or write a piece of code in Python that will be called from a FramScript script.
  • Another option is to use https://bitbucket.org/mack0/pythonidas/src/master/ but this will require some software development skills.

Use the newest version for your experiments:
http://www.framsticks.com/apps-devel

and feel free to contact us with more specific questions that will let you progress faster with your research.

Thank you very much. That helps me a lot.