GLPK/Windows executables

GLPK for Windows edit

The third-party GLPK for Windows (winglpk) project regularly releases pre-compiled Windows executables, based on the official GLPK source files. Executables for both 32-bit and 64-bit operating systems are available. Administrator rights are not needed. The GLPK for Windows distribution also includes GLPK for Java, which provides a binding to the Java programming language.

This project is active and updated executables usually follow an official GLPK release by only a few days. This is the best option for Windows users who do not wish to build and install GLPK by hand.

After downloading the archive from Sourceforge, please, calculate the MD5 and the SHA1 check sums and compare them to the values provided by Sourceforge. You can use Microsoft's File Checksum Integrity Verifier utility[1] for this purpose, e.g.

fciv.exe -both winglpk-4.47.zip

The downloaded archive has to be extracted. This can be done with 7-zip available at http://www.7-zip.org/. You may move the extracted directory (glpk-4.47) to your favorite place e.g to "C:\program files\GLPK".

Directory w32 contains the 32bit binaries and w64 contains the 64bit binaries.

You will typically want to have the GLPK dynamic link library (glpk_4_47.dll) in the search path for binaries. Either change the environment PATH variable accordingly or copy glpk_4_47.dll to "C:\windows\system32\". Open the control center and type "environment" into the search field to find the control to set your environment variables.

This mid-2012 help list posting contains PNG format screenshots for the settings described above in relation to the Microsoft Visual Studio 2010 C++ IDE — users who prefer screenshots will find these images particularly helpful.

Building a C program using the GLPK library edit

The following description describes how to build a first program using the GLPK library. A 32bit system is assumed.

  • open Visual Studio Express 2010 C++
  • create a new "Win32 Console Application"
  • do not choose compiled headers
  • open the Project Properties dialog:
  • under Linker > Input > Additional Dependencies : add "C:\Program Files\GLPK\glpk-4.47\w32\glpk_4_47.lib"
  • under Configuration Properties > VC++ Directories > Include directories : add "C:\Program Files\GLPK\glpk-4.47\src

Enter the following code and then hit F5 to compile and run the test:

#include <stdio.h>
#include <conio.h>
#include "glpk.h"

int main(int argc, char* argv[]) {
    printf ("GLPK version %s\n", glp_version());
    printf ("Press any key\n");
    while (!kbhit()){}
    getch();
    return 0;
}

The program will output the GLPK version, and wait for any key to be hit, e.g.

GLPK version 4.47
Press any key

If you were using precompiled headers test.cpp would be

#include "stdafx.h"
int main(int argc, char* argv[]) {
    printf ("GLPK version %s\n", glp_version());
    printf ("Press any key\n");
    while (!kbhit()){}
    getch();
    return 0;
}

And stdafx.h would be

#pragma once
#include <stdio.h>
#include <conio.h>
#include "glpk.h"

Additional background edit

Andy Trapp's 2009 presentation on GLPK [2] provides a good introduction to the use of GLPK with Windows (although some details are no longer current).

References edit

  1. "Availability and description of the File Checksum Integrity Verifier utility". Microsoft. Retrieved 2011-09-24. {{cite web}}: Unknown parameter |month= ignored (help)
  2. Trapp, Andy (2009). "IE 2082: Introduction to GLPK" (PDF) (presentation). Retrieved 2011-09-24.