A few open source codes

Index

TNC : A Truncated-Newton optimization package

TNC is a C implementation of TNBC, a truncated newton optimization package originally developed by Stephen G. Nash in Fortran.

The original source code can be found at Stephen G. Nash Software Page.

This software aims at minimizing the value of a nonlinear function whose variables are subject to bound constraints. It requires to be able to evaluate the function and its gradient and is especially useful for solving large scale problems.

The C source code and an example, along with license and copyright information are included in the package. This software has been tested on the majority of UNIXes and on Windows.

Since version 1.0.5, a Python interface module is provided. This interface can also be found in SciPy.

You can download it (version 1.3, 1/28/2005) : tnc-1.3.tgz (C source, 23 kb)

PuLP : A Linear Programming modeler in Python

PuLP is an LP modeler written in Python. PuLP can generate .LP and .MPS files and call GLPK, COIN CLP/SBB, CPLEX or XPRESS to solve linear problems.

PuLP provides a nice syntax for the creation of linear problems, and a simple way to call the solvers to perform the optimization.

Multiple examples are provided.

Can download it (version 1.1, 5/3/2004) : pulp-1.1.tgz (C and Python source, 36 ko)

A very simple example :

from pulp import *

prob = LpProblem("test1", LpMinimize)

# Variables
x = LpVariable("x", 0, 4)
y = LpVariable("y", -1, 1)
z = LpVariable("z", 0)

# Objective
prob += x + 4*y + 9*z

# Constraints
prob += x+y <= 5
prob += x+z >= 10
prob += -y+z == 7

GLPK().solve(prob)

# Solution
for v in prob.variables():
print v.name, "=", v.varValue

print "objective=", value(prob.objective)

COBYLA : A derivative free constrained optimization package

This software is a C version of COBYLA2, a contrained optimization by linear approximation package developed by Michael J. D. Powell in Fortran. It's a derivative free non-linear optimizer that can deal with non-linear constraints. It's very useful for small scale problems.

Beside a C friendly interface, this version provide a Python interface, initially designed to ease integration into SciPy.

The original Fortran source code can be found in the NLO constrained section of Hans Mittelmann and Peter Spellucci Decision Tree for Optimization Software, a great ressource for optimization software.

Many thanks to Michael J. D. Powell for allowing free redistribution of his code !

You can download it (version 1.1, 04/18/2004) : cobyla2c-1.1.tgz (C source, 20 kb)

MapKit : A hash table library in C

This is a cross-platform (unix, windows) library to easily create and use hash tables (similar to STL's hash_map or python dictionaries) in C.

Multiple keys and values types are provided (int, double, strings,...), and the ability to optionnaly define a default value which is not stored makes it a good candidate for some sparse vectors and matrices calculations.

You can download it (version 1.4, 04/16/2004) : mapkit-1.4.tgz (C source, 58 kb)

RandomKit : A library to generate random numbers

Randomkit is a thread-safe cross-platform (unix, windows) C library designed to generate random numbers (both uniform and gaussian deviates) using either the Mersenne Twister RNG, Sobol's Quasi-RNG in any dimension, or Bob Jenkins ISAAC cryptographic RNG.

More over, Randomkit provides a portable API to the OS specific random number generation functions (/dev/random under Unix, and the Crypto API undr Windows).

You can download it (1.6 version, 02/20/2006) : randomkit-1.6.tgz (C source, 31 kb)

MDMalloc : A multi-dimensional array allocator in C

MDMalloc is a simple set of C functions to allocate multi-dimensional arrays without requiring multiple malloc and free.

Example with a bi-dimensional array :

double **array;
array = vmdmalloc(sizeof(double), 2, 10, 20);
array[5][17] = 3.0;
free(array);

You can download it (1/25/2003 version) : mdmalloc.tgz (C source, 3 kb)

TextTable : A library to read/write delimited text files

Texttable is a cross-platform (unix, windows) C library designed to easily and efficiently read and write delimited text files (like CSV files).

You can download it (1.2 version, 10/26/2003) : texttable-1.2.tgz (C source, 8 kb)

NetCDFStruct : A library to read/write NetCDF files easily

NetCDFStruct is a simple set of C functions to read/write NetCDF files as C structures. It provides an easy way to perform array input/ouput in a C program. File structure can either be described by hand or generated from an example data file.

You can download it (2/25/2003 version) : netcdfstruct.tgz (C source, 8 kb)

FortranLineReader : Reading Fortran files in Python

A very small python class to read some column formated files (Fortran style).

You can download it : FortranLineReader.py (Python source, 3 kb)

PyCestac : The CESTAC method in Python

A Python module for experimenting the CESTAC method of stochastic arithmetic. Please see the CADNA library home page for a high performance C/C++/Fortran implementation.

You can download it : py-cestac.tgz (C and Python source, 5 kb)

Countdown game : numbers problem solver

A few lines of C to solve the number problem of Armand Jammot's Countdown game.

You can download it : lesChiffres.tgz (C source, 3 kb)

An analog clock

A script-fu GIMP which draws an analog clock (size and time are customizable) exactly like the clock used for Aladdin's movie.

You can download it : horloge-analogique.scm (Script-fu source, 3 kb)

An image to Palm T3/TE agenda background converter

This software converts an image into a Palm Tungsten T3/TE agenda background image. It is necessary to install Khroma or Screen Prefs to set the default color display mode of the T3/TE to 65536 colors. It is also necessary to install F3T3AgendaBG to change the background image of the agenda view.

Version requiring ImageMagick

You can download it : image2agenda.tgz (C source, 178 kb)

Old version only requiring libpng (but only converts 8 bits PNG)

You can download it : png2agenda.tgz (C source, 221 kb)

Example backgrounds

You can also download some example backgrounds (ZIP files, about 200 kb) :