OML syntax highlighting with Notepad++

I recently had to do some modeling with Microsoft Solver Fundation(MSF) and the corresponding Excel plugin.

Although it offers an easy way to use a powerful solver (Gurobi) transparently from Excel, the definition of the model components is a rather arduous task. Firstly because everything has to be done by a sequence of clicks, which is quickly unefficient, secondly because the user interface is not necesarily intuitive and quite buggy.

Nonetheless I found a way to bypass efficiently the interface for the writting of the model, by editing it directly in an external editor and then copying it to the “Model” tab of the plugin. The text is then automatically parsed and the model components (parameters, variables & constraints) appear directly in the interface.

To facilitate the editing, I used Notepad++ for which I created a language highlighting definition for OML (Optimization Modeling Language, the modelling language used by MSF). It can be downloaded here, the installation procedure is the following:

  1. Install Notepad++
  2. Download the language definition file userDefineLang.xml
  3. Copy the file to %APPDATA%\Notepad++\ (copy past the direction in the address bar of windows explorer)

Note that if you already had Notepad++ installed with user defined languages, you need to append the content of the definition file to the end of your own userDefineLang.xml file.

OML highlighting for Notepad++

OML highlighting for Notepad++

Download the above example : example.xlsx and example.oml

If your are interested in creating your own language definition, this post by Jon Galloway gives a usefull tutorial.