Click or drag to resize
LinearProgramming Class

The LinearProgramming class represents a data type for solving a linear program of the form { max cx : Ax <= b, x >= 0 }, where A is a M-by-N matrix, b is an M-length vector, and c is an N-length vector. For simplicity, we assume that A is of full rank and that b >= 0 so that x = 0 is a basic feasible soution.

The data type supplies methods for determining the optimal primal and dual solutions.

This is a bare-bones implementation of the Simplex algorithm. It uses Bland's rule to determing the entering and leaving variables. It is not suitable for use on large inputs. It is also not robust in the presence of floating-point roundoff error.

Inheritance Hierarchy
SystemObject
  Algs4NetLinearProgramming

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class LinearProgramming

The LinearProgramming type exposes the following members.

Constructors
  NameDescription
Public methodLinearProgramming
Determines an optimal solution to the linear program { max cx : Ax <= b, x >= 0 }, where A is a M-by-N matrix, b is an M-length vector, and c is an N-length vector.
Top
Properties
  NameDescription
Public propertyValue
Returns the optimal value of this linear program.
Top
Methods
  NameDescription
Public methodDual
Returns the optimal dual solution to this linear program
Public methodStatic memberMainTest
Demo test the LinearProgramming data type.
Public methodPrimal
Returns the optimal primal solution to this linear program.
Top
Remarks

For additional documentation, see Section 6.5Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class LinearProgramming implementation by the respective authors.

See Also