Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dance858/PSLP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSLP — A Lightweight C Presolver for Linear Programs

License: Apache 2.0 Build and Test Status Language: C Coverage Status

PSLP is a fast, dependency-free presolver for linear programs (LPs) of the form

$$ \begin{array}{ll} \text{minimize} & c^T x \\ \text{subject to} & \underline{b} \leq Ax \leq \overline{b} \\ & \underline{x} \leq x \leq \overline{x}. \end{array} $$

PSLP simplifies LPs before they are passed to a solver by detecting redundant constraints and fixing variables etc. It is written in C99 and is lightweight with no external dependencies. Happy presolving!


Installation

PSLP is built using CMake. If you wish to use PSLP in your own CMake-based project, a simple approach is to do as follows. First, create a folder third_party in your project root and add PSLP as a submodule by running the following command in your terminal:

git submodule add https://github.com/dance858/PSLP.git third_party/PSLP

Next, add PSLP as a subdirectory by adding the following line to your CMakeLists.txt:

add_subdirectory(third_party/PSLP EXCLUDE_FROM_ALL)

Finally, link your project to PSLP by adding the following line to your CMakeLists.txt (replace YOUR_PROJECT with your actual target name):

target_link_libraries(YOUR_PROJECT PRIVATE PSLP)

After this, you should be able to import the public API using #include "PSLP_API.h".


API

The public C API is defined in the header file PSLP_API.h. The other files in that folder contain some trivial public data structures. The API consists of three main operations:

  1. Initialization — performed using new_presolver(), which creates and initializes internal data structures used by the presolver.

  2. Presolve — performed using run_presolver(), which executes the presolve routines to reduce the LP. The reduced LP is available in the struct reduced_prob of the presolver struct.

  3. Postsolve — performed using postsolve(), which recovers a primal-dual solution to the original LP from a primal-dual solution to the reduced problem.

Detailed descriptions of each function and all associated data structures are documented in the PSLP folder. A video tutorial is available here. Note that since the video was recorded, PSLP_inf has been removed. Infinite variable bounds or constraint limits should now be represented using the IEEE-754 encoding. (For example, in C, use INFINITY defined in math.h).


Citation

A paper is under preparation. If you wish to cite this software, you may use the following bibtex.

@software{Cederberg2025,
  author = {Cederberg, Daniel and Boyd, Stephen},
  title = {PSLP — A Lightweight C Presolver for Linear Programs},
  year = {2025},
  url = {https://github.com/dance858/PSLP},
}