Monday, April 13, 2009

IEOR Tools Tutorial: Using GLPK in Windows

The free software Operations Research tool GLPK has been getting more and more recognition. GLPK offers a great linear optimization software toolkit for the Operations Research analyst in a very compact package. The modeling abilities are near limitless. Yet if most Operations Research practitioners are like me they have to work on a Windows system day-to-day without the opportunity of a UNIX-variant workstation like Linux.

Never fear because there are a number of methods to getting GLPK to work on a Windows environment. In this tutorial I will explain some simple ways to get GLPK to work even if you are using Windows. I have listed them in no specific order. These methods are just a number of ways to accomplish the task of getting GLPK working in Windows. I will leave it up to the Operations Research practitioner to figure out which method is best.

1) Command line shell

Perhaps the easiest method to get GLPK working is to invoke GLPK from the command line. Thanks to some help from the free software community there was a Windows binary created for glpsol, aptly called glpsol.exe. Glpsol is the free optimization model engine of GLPK. You can find the work for glpsol.exe at http://winglpk.sourceforge.net/ with some documentation and installation instructions.

Simply use 'cmd' from windows Run to bring up the command line shell. Then use 'glpsol.exe (name of model file)' to execute an optimization model.


2) GLPK for Windows installer

This method makes for a easy way to setup and install GLPK in the Windows environment. It is not necessarily needed but it does bring all of the dependencies together to make sure that GLPK will work from the moment it is installed. You can find more about this project at http://gnuwin32.sourceforge.net/packages/glpk.htm. After this is installed then you can use glpsol.exe from the command line as mentioned above. NOTE: As of writing this blog entry the installer is setup for GLPK version 4.34.


3) Windows IDE like GUSEK

GUSEK is a full feature Windows IDE based solely on GLPK. This method removes a lot of the guesswork with installing GLPK and also creates a full mathematical programming environment on the Windows desktop. The GUI is very familiar to Windows users. The is also a stdout window that allows the model results to be viewed right alongside the GLPK model code. Currently his is my preferred usage of GLPK at the moment.

You can read an IEOR Tools interview with the developer of GUSEK.


4) Develop code with GLPK API

GLPK is technically a software toolkit and it is natively developed in ANSI C. Therefore one could develop modeling software based on the GLPK API. There has been a lot of work already done in this area already for other programming languages that are compatible in th Windows environment. Here are some to name a couple.

Java:
http://bjoern.dapnet.de/glpk/
VBA from Help-glpk mail archive:
http://www.mail-archive.com/help-glpk@gnu.org/msg01645.html


5) Emulate a Unix environment in Windows

Emulating a Unix/Linux environment is basically a bypass to get straight to GLPK since most linux distributions can install GLPK natively or from source easily. There is a number of applications that lets you setup a Linux-variant on a Windows machine. This method is not for the novice computer user. Basically one would install the emulation software on Windows. Then install the Linux distribution within that emulated environment. Once Linux in installed then the user can install GLPK on the system.

Virtualbox
qemu - qemu on Windows
cygwin

1 comment:

Web Design Quote said...

I haven't any idea for the IEOR tools but after reading your post i know some thing about this. That would be an additional information for me.