Introduction
GLPK for C#/CLI provides a common language interface binding for the GLPK linear programming library. It allows you to use the Gnu Linear Programming Kit with all .NET/Mono languages (C#, F#, Python, J#, Scala, Visual Basic, ...).
The project homepage is http://glpk-cli.sourceforge.net/.
Makefiles for Windows and Linux are provided.
To report problems and suggestions concerning GLPK for C#/CLI, please, send an email to the author at xypron.glpk@gmx.de.
The GNU Linear Programming Kit (GLPK) supplies a solver for large scale linear programming (LP) and mixed integer programming (MIP). The GLPK project is hosted at http://www.gnu.org/software/glpk.
It has two mailing lists:
To subscribe to one of these lists, please, send an empty mail with a Subject: header line of just "subscribe" to the list.
GLPK provides a library written in C and a standalone solver.
The source code provided at ftp://gnu.ftp.org/gnu/glpk/ contains the documentation of the library in file doc/glpk.pdf. This should be your first reference for the usage of the library.
Download
The latest release of "GLPK for C#/CLI" is available at http://sourceforge.net/projects/glpk-cli/
You can download the latest development version from the git repository with
git clone https://github.com/xypron/glpk-cli.git
or view it the repository at https://github.com/xypron/glpk-cli/.
Building from source
Linux
To build the package on Linux execute the following commands.
./configure make make check sudo make install
For building and running your own application you will need to the following files
- /usr/local/lib/libglpk.so - the GLPK native library
- /usr/local/lib/glpk-cli/libglpk-cli.so - the GLPK for C#/CLI native library
- /usr/local/lib/glpk-cli/libglpk-cli.dll - the GLPK for C#/CLI assembly
You will probably want to add /usr/local/lib/glpk-cli to the MONO_PATH and the LD_LIBRARY_PATH environment variables.
The following example shows how to compile a C# application which writes the GLPK version number to the console.
export MONO_PATH=/usr/local/lib/glpk-cli export LD_LIBRARY_PATH=/usr/local/lib/glpk-cli cat > version.cs << EOF using System; using org.gnu.glpk; class Program { static void Main(string[] args) { Console.WriteLine("GLPK " + GLPK.glp_version()); } } EOF mcs -r:libglpk-cli -lib:/usr/local/lib/glpk-cli/ version.cs ./version.exe
The following example shows how to compile a Visual Basic application which writes the GLPK version number to the console.
export MONO_PATH=/usr/local/lib/glpk-cli export LD_LIBRARY_PATH=/usr/local/lib/glpk-cli cat > version.vb << EOF Imports System Imports org.gnu.glpk Public Module module1 Sub Main() Console.WriteLine ("GLPK " + GLPK.glp_version()) End Sub End Module EOF vbnc -r:libglpk-cli.dll -libpath:/usr/local/lib/glpk-cli/ version.vb chmod 755 version.exe ./version.exe
Windows
To build the package on Windows:
- Copy file glpk.h to new directory src.
- Copy files glpk_?_??.* to directory w64.
- Cd to directory w64.
- Verify the paths in Build_CLI.bat.
- Execute Build_CLI.bat
For building and running your own application you will need the following files from the w64 directory:
- glpk_?_??.dll - the GLPK native library
- libglpk_cli_native.dll - the GLPK for C#/CLI native library
- libglpk_cli.dll - the GLPK for C#/CLI assembly
License
GLPK for C#/CLI is licensed under the GNU Public License 3.0.
You may obtain a copy of the license at http://www.gnu.org/licenses/gpl-3.0.en.html.