Sunday, December 5, 2010

How many languages are needed to understand OPUS?


Looks like 6 or so key languages from sources such as this image of the internal ecosystem from \opus\src\opus_core\docs\images\Opus internal ecosystem.png and further study of the OPUS User Guide:

  • Python 2.6.2 - Main source language at this time
  • Tekoa - A custom domain-specific programming language for writing OPUS variable expressions, e.g.
        ln(urbansim.gridcell.population)
    computes the log of an existing variable, population, which is in the urbansim package and applies to the gridcell dataset.
    See the Chapter 13 of the OPUS User Guide for more.
  • C/C++ - Many of the external libraries used (at least originally - much has probably changed over 5 years, e.g. I think the visualisations are now on GraphViz and Imagemagick though I could be wrong)
  • R - The statistical language.
  • SQL - Because much data is persisted in relational databases, the open-source MySQL, PostGreSQL and commercial Microsoft SQL Server are often used.
  • XML - e.g. \opus\src\psrc_parcel\configs\psrc_parcel.xml contains 500 lines of configuration for simple things like the project name, as well as more complex things like a matrix_variable_map dictionary containing banks of strings which appear to represent quantities - e.g. am_pk_period_drive_alone_vehicle_trips or logsum_hbw_am_income_3. Some of this is in the GUI, for example the Scenario XML:
Click to enlarge, XML on the left, OPUS GUI on the right.

I mentioned GraphViz, it has it's own format and syntax. A simple example:

graph G {
1 -- 5;
4 -- 1;
4 -- 2;
2 -- 3;
4 -- 5;
5 -- 2;
}


Here's an example output from an assignment I completed earlier this year, this represented a highly-connected graph of approximately 1,000 vertices and 250,000 edges, which for the instance of our problem it was discovered could be covered with just 6 "Wireless Station Relays" represented by individual colours (most solutions found the equivalent of 8 or 9 easily (around 2700 in Test 7).

And of course many more GraphViz examples are on show at:

So for OPUS, that's a fairly standard assembly of languages, most web projects for example have 5 or so between:
  • PHP (or Python, Perl, Java, C#, Lisp, Erlang, etc)
  • HTML
  • CSS
  • Javascript
  • SQL (or GQL, HQL, or other persistence data languages)
What's different is clearly the libraries and frameworks built on top of these languages. The image of the internal ecosystem is probably one of the best to explain the state 5 years ago - and as I've alluded to much has been built since then!

In any case I think I'll be at home once I figure out a few more of these model semantics and how to combine them effectively. The only languages I have no other experience in are R and Tekoa (which looks very straightforward - as it was designed to make OPUS easier to configure).

No comments:

Post a Comment