I'm going to take a software engineering point of view in this post. To come up with any type of model or simulation, it is a good idea to start with a software framework.
A software framework according to Wikipedia is 'an abstraction in which common code providing generic functionality can be selectively overridden or specialized by user code'. Software frameworks facilitate the development of software, and allow the developer to focus on the software requirements rather than the low level details of providing a working system that allows access to the hardware. This, in turn, reduces development time.
For the short term, it would more than likely increase the development time, as there is a learning curve involved which needs additional time. In the long run, once the framework is learned, future projects can be a lot quicker to complete, as the need to concern ourselves with the low level details is diminished.
There are several types of frameworks available for C++ such as SDL, OpenFrameworks, Qt, etc., I'll focus on OpenFrameworks today. A few projects made using OpenFrameworks is below (clicking on it will take you to the project site on OpenFrameworks):
OpenFrameworks is a library that is designed for 'creative coding'. The library is wrapped with glut which is a windowing library. This wrapping I feel is quite a good choice, as it works really well with OpenGL. The OpenGL red book bases its code on glut as well.
If you've used Processing, OpenFrameworks certainly draws parallels with it. The website that provides the reference to the commands of the framework is also very similar. Processing users would feel right at home, there's also a wiki that provides an orientation to OpenFrameworks that can be quite handy.
What I like about this framework is that it wraps several other libraries to provide a very good interface. OpenGL is used for the graphics, as I mentioned works well with glut. freeImage which is a popular library for image I/O and processing is also included. Even quicktime which is good for playing video.
I currently use SDL, but after having a look at OpenFrameworks, I'm considering using it. Looks like a very good framework to use, and the learning curve doesn't seem too high after having used Processing previously. At the same time, there is already a lot of articles and a whole community available for SDL. I'll discuss SDL in another post. OpenFrameworks does indeed look like a very good software framework indeed.
Wednesday, 17 November 2010
Wednesday, 10 November 2010
The recent tube strike and a discussion with one of my professors has led me to think about micro and macro systems as a whole, and in turn simulations working within these constraints.
First of all, let me say a little about a normal working day and what happens during this time. We have a fully working transport system, a nice sunny day (or mostly grey, in London at least!), a phenomena, if you'd allow me to call it that, takes place i.e., commuting. Individuals work, that's how the economy and you, as an individual survive and provide for yourself, and your family. So, we have people who commute to and from work everyday. What happens during the commute? Each individual, makes an independent decision in order to reach their work destination. How they get there is based on personal choice, which is generally ruled by the amount of time it would take to get to work, the distance to workplace, and the number of changes that are required. This decision gets refined as the individual finds him / her self making the most efficient decision to reach the workplace.
Each individual takes these similar independent decisions becoming routine over time. Aggregating all these independent decisions together, we get people moving around, and a pattern develops as the micro-system stabilises, in which ways people move to commute to and from work. These hundreds of independent decisions are taking place within the constraints of a macro-system. The macro-system in play here is the transport system, and these individuals actually play by the rules set out by the macro-system in place here.
A macro-system can be defined here as a large system within which micro-systems are contained. Therefore, here, we have the transport system as the large macro-system, and the individuals as the micro-systems which are contained within this large system, and taking their independent decisions within the constraints set out by it.
Now, we have a tube strike, like the one on 3 November 2010. What happens here?! The large macro-system changes. Most tube lines don't work, sever delays on lines that do, more buses on routes, cycles being transported more frequently to fill up empty slots. This creates havoc in the micro-system, but it doesn't fail. In fact, what happens is that the micro-system adjusts the way it works within the new constraints set out by the macro-system in play, and then we have the same individuals making their renewed complete independent decisions, again taking into account the most efficient way to get to work by finding the lines / buses / boats that are working, and taking those transport links, or replacing it with cycles or cars. We now have a micro-system changing, but in a way that individuals still get to work, but using the new constraints set out by the macro-system at play, and they work within these constraints. Complaints? Yes....Impossible? No, not at all!
It's the laws of the macro-system here. Micro-systems are contained within it, and they will change in order to work within the constraints of the macro-system, or even be influenced by it. An analogy with Ecological Systems Theory can also be drawn, but I'll leave that for another post!
This is the problem I wonder about when I'm designing my model, I need these micro behaviours to work within the constraints of the macro-system at play. Do I model the macro-system first, or model the micro-system and build a macro-system around it? It's the chicken or egg problem again here!