Simplex method for LP

The simplex method is one of the two most often used linear programming algorithms (another popular approach is the interior point method, which is also included in ALGLIB). ALGLIB implements the so-called revised dual simplex method with several essential performance and stability improvements, which are discussed in the sections below.

This article provides a high-level overview of the ALGLIB implementation of the simplex method. It discusses questions like the algorithm's strong and weak sides and its stability and performance properties. The ALGLIB linear programming API is described in this separate article.

Contents

    1 Revised dual simplex method
           Algorithm
           Improvements
           Comparison with the interior point method
    2 Performance aspects
           C++ vs. C#
           SIMD and parallelism
    3 Working with the simplex solver
    4 Downloads section

Revised dual simplex method

Algorithm

The simplex method is an active set method. Each step of the simplex method deactivates one box constraint and selects another one to be activated (general linear constraints are always satisfied). Typically for an active set method, O(N+M) steps are needed for an N-dimensional problem with M general linear constraints.

The simplex method stops when the solver finds a trial point (uniquely determined by the active set) that is primal/dual feasible. Here, primal feasibility means that the trial point does not violate constraints, and dual feasibility means that there are no descent directions 'leaving' the trial point. A point that is both primal and dual feasible is the solution of the linear programming problem because it is both locally optimal and does not violate constraints.

The primal simplex method starts from a trial point that is primal feasible and iterates until dual feasibility. The dual simplex method starts from a trial point that is dual feasible and iterates until primal feasibility. ALGLIB implements a three-phase dual simplex method with additional degeneracy-breaking perturbation:

Improvements

Our implementation of the simplex method has following improvements over the 'textbook' version:

Comparison with the interior point method

The interior point method, another solver implemented in ALGLIB, solves the linear programming problem by applying Newton's iteration to the linear target function with additional logarithmic barrier terms. The interior point method is, in some sense, dual to the simplex method:

Performance aspects

In this section we review various factors that influence simplex method performance.

C++ vs. C#

Simplex method running time depends on whether you work with native ALGLIB (available from C++, C#, Python, and other languages) or its fully managed version (available from C#, VB.NET, and IronPython). The .NET framework has greatly improved over the last few years, but math-intense C/C++ code is still ~2x faster than equivalent fully managed C# code. This difference is mostly explained by the fact that managed code has to check every array access for array bounds violations.

As a result, working with native computational core is preferable. If you use ALGLIB for C++, you are already on the winning side. C# users may find it beneficial to use a C# wrapper around native core (available in the commercial edition). On the other hand, the fully managed version is still well optimized - we tried to achieve the best result possible under constraint of being fully managed.

SIMD and parallelism

The simplex method is notoriously difficult to parallelize and/or accelerate with SIMD. The algorithm is inherently sequential, with many low-cost interdependent steps and irregular memory access patterns. Thus, the ALGLIB implementation of the simplex method has no SIMD/SMP support.

Working with the simplex solver

Linear programming functionality is provided by the minlp subpackage. The minlpstate class provides a common interface for all solvers (simplex method and interior point method) supported by ALGLIB. This interface is described in this separate article, which explains how to specify and solve linear programming problems with ALGLIB.

This article is licensed for personal use only.

Download ALGLIB for C++ / C# / Java / Python / ...

ALGLIB Project offers you two editions of ALGLIB:

ALGLIB Free Edition:
+delivered for free
+offers full set of numerical functionality
+extensive algorithmic optimizations
-no multithreading
-non-commercial license

ALGLIB Commercial Edition:
+flexible pricing
+offers full set of numerical functionality
+extensive algorithmic optimizations
+high performance (SMP, SIMD)
+commercial license with support plan

Links to download sections for Free and Commercial editions can be found below:

ALGLIB 4.03.0 for C++

C++ library.
Delivered with sources.
Monolithic design.
Extreme portability.
Editions:   FREE   COMMERCIAL

ALGLIB 4.03.0 for C#

C# library with native kernels.
Delivered with sources.
VB.NET and IronPython wrappers.
Extreme portability.
Editions:   FREE   COMMERCIAL

ALGLIB 4.03.0 for Java

Java wrapper around HPC core.
Delivered with sources.
Seamless integration with Java.
Editions:   FREE   COMMERCIAL

ALGLIB 4.03.0 for Delphi

Delphi wrapper around C core.
Delivered as precompiled binary.
Compatible with FreePascal.
Editions:   FREE   COMMERCIAL

ALGLIB 4.03.0 for CPython

CPython wrapper around C core.
Delivered as precompiled binary.
Editions:   FREE   COMMERCIAL