Code and Open Source Software¶
I currently enjoy programming, and I’ve developed a number of small programs and several larger ones.
PyCPX is a python wrapper for the CPlex Optimization Suite that focuses on speed, ease of use, and seamless integration with numpy. CPlex is a powerful solver for linear and quadratic programs over real, integer, and boolean variables. PyCPX allows one to naturally express such programs using numpy and natural python constructs.
TreeDict is a dictionary-like, hierarcical python container to simplify the bookkeeping surrounding parameters, variables and data. It aims to be fast, lightweight, intuitive, feature-rich and stable.
While intended for general python development, it includes a number of features particularly useful for scientific programming. It is similar in basic functionality to MATLAB structures in terms of concise syntax and implicit branch creation. In addition, though, TreeDict implements all the methods of regular dictionaries, pickling, fast non-intersecting hashing for efficient caching, manipulations on the tree structure, and a system for forward referencing branches to make lists of parameters more readable
LazyRunner is a framework for organized scientific computing. It aims to make it easy to write properly designed programs as quickly as hacked-together scripts while providing useful features (such as caching of results) that often take a fair bit of effort and planning to implement in most scientific projects.
The development of LazyRunner grew out of my frustration at the length of time often required to write good, reusable scientific code. It seems there are often two options – either throw together some scripts that work but are hard to reuse, or spend a reasonable amount of time on writing boilerplate code. This library was motivated by realizing that most of the boilerplate required to organize scientific code can be abstracted into a common framework. LazyRunner’s workflow – a modular structure with centralized and hierarchical parameter organization – works well for most scientific projects (I use it for all of my coding). In addition, the caching features provide a huge speedup for practical computation with minimal additional coding.
PyLPSolve is an object oriented wrapper for the open source LP solver lpsolve. The focus is on usability and integration with existing python packages used for scientific programming (i.e. numpy/scipy).
It features a convenient bookkeeping system that allows the user to specify blocks of variables by string tags, or other index block methods, then work with these blocks instead of individual indices. All the elements of the LP are cached until solve is called, with memory management and proper sizing of the LP handled automatically. The coding is done in cython for efficiency, and the library is well covered by unit tests.