NMath User's Guide

TOC | Previous | Next | Index

Chapter 29. Linear Programming (.NET, C#, CSharp, VB, Visual Basic, F#)

A linear programming (LP) problem optimizes a linear objective function subject to a set of linear constraints, and optionally subject to a set of variable bounds. For example:

Z = X1 + 4 X2 + 9 X3

Subject To
X1 + X2 <= 5
X1 + X3 >= 10
-X2 + X3 = 7

0 <= X1 <= 4
0 <= X2 <= 1

In NMath, class LinearProgrammingProblem encapsulates an LP problem. MixedIntegerLinearProgrammingProblem encapsulates an LP problem which may contain integral or binary constraints.

Class PrimalSimplexSolverORTools solves linear programming problems using the primal simplex method. The class DualSimplexSolverORTools uses the dual simplex method. The simplex method solves LP problems by constructing an initial solution at a vertex of a simplex, then walking along edges of the simplex to vertices with successively higher values of the objective function until the optimum is reached. These two classes use the Google OR Tools computational engine for solving both LP and MIP problems.

This chapter describes how to solve LP problems using NMath.