# Karmarkar's algorithm

Karmarkar's algorithm is an algorithm introduced by Narendra Karmarkar in 1984 for solving linear programming problems. It was the first reasonably efficient algorithm that solves these problems in polynomial time. The ellipsoid method is also polynomial time but proved to be inefficient in practice.

Where ${\displaystyle n}$ is the number of variables and ${\displaystyle L}$ is the number of bits of input to the algorithm, Karmarkar's algorithm requires ${\displaystyle O(n^{3.5}L)}$ operations on ${\displaystyle O(L)}$ digit numbers, as compared to ${\displaystyle O(n^{6}L)}$ such operations for the ellipsoid algorithm. The runtime of Karmarkar's algorithm is thus

${\displaystyle O(n^{3.5}L^{2}\cdot \log L\cdot \log \log L)}$

using FFT-based multiplication (see Big O notation).

Karmarkar's algorithm falls within the class of interior point methods: the current guess for the solution does not follow the boundary of the feasible set as in the simplex method, but it moves through the interior of the feasible region, improving the approximation of the optimal solution by a definite fraction with every iteration, and converging to an optimal solution with rational data.[1]

## The Algorithm

Consider a Linear Programming problem in matrix form:

 maximize cTx subject to Ax ≤ b.

The algorithm determines the next feasible direction toward optimality and scales back by a factor 0 < γ ≤ 1.

Karmarkar's algorithm is rather complicated. Interested readers can refer.[2][3][4] [5] [6] [7] [8] A simplified version, called the affine-scaling method, analyzed by others,[9] can be described succinctly as follows. Note that the affine-scaling algorithm, while applicable to small scale problems, is not a polynomial time algorithm. For large scale and complex problems the original approach needs to be followed. Karmarkar also has extended the methodology [10][11][12][13] to solve problems with integer constraints and non-convex problems.[14] Template:Algorithm-begin

  Input:  A, b, c, ${\displaystyle x^{0}}$, stopping criterion, ${\displaystyle \gamma }$.

  ${\displaystyle k\leftarrow 0}$
do while stopping criterion not satisfied
${\displaystyle v^{k}\leftarrow b-Ax^{k}}$
${\displaystyle D_{v}\leftarrow \operatorname {diag} (v_{1}^{k},\ldots ,v_{m}^{k})}$
${\displaystyle h_{x}\leftarrow (A^{T}D_{v}^{-2}A)^{-1}c}$
${\displaystyle h_{v}\leftarrow -Ah_{x}}$
if ${\displaystyle h_{v}\geq 0}$ then
return unbounded
end if
${\displaystyle \alpha \leftarrow \gamma \cdot \min\{-v_{i}^{k}/(h_{v})_{i}\,\,|\,\,(h_{v})_{i}<0,\,i=1,\ldots ,m\}}$
${\displaystyle x^{k+1}\leftarrow x^{k}+\alpha h_{x}}$
${\displaystyle k\leftarrow k+1}$
end do


## Example

File:Karmarkar.png
Example solution

Consider the linear program

That is, there are 2 variables ${\displaystyle x_{1},x_{2}}$ and 11 constraints associated with varying values of ${\displaystyle p}$. This figure shows each iteration of the algorithm as red circle points. The constraints are shown as blue lines.

## Patent controversy --- "Can Mathematics be patented ?"

At the time he invented the algorithm, Narendra Karmarkar was employed by AT&T. After applying the algorithm to optimizing AT&T 's telephone network,[15] they realized that his invention could be of practical importance. In April 1985, AT&T promptly applied for a patent on Karmarkar's algorithm and that became more fuel for the ongoing controversy over the issue of software patents.[16] This left many mathematicians uneasy, such as Ronald Rivest (himself one of the holders of the patent on the RSA algorithm), who expressed the opinion that research proceeded on the basis that algorithms should be free. Even before the patent was actually granted, it seemed that there was prior art that might have been applicable.[17] Mathematicians who specialize in numerical analysis such as Philip Gill and others claimed that Karmarkar's algorithm is equivalent to a projected Newton barrier method with a logarithmic barrier function, if the parameters are chosen suitably.[18] However, some say Gill's argument is flawed, insofar as the method they describe does not even qualify as an "algorithm", since it requires choices of parameters that don't follow from the internal logic of the method, but rely on external guidance, essentially from Karmarkar's algorithm.[19] Furthermore, Karmarkar's contributions are considered far from obvious in light of all prior work, including Fiacco-McCormick, Gill and others cited by Saltzman.[19][20][21] The patent was debated in the U.S. Senate and granted in recognition of the essential originality of Karmarkar's work, as U.S. Patent 4,744,026: "Methods and apparatus for efficient resource allocation" in May 1988. AT&T supplied the KORBX system[22] [23] based on this patent to the Pentagon,[24][25] which enabled them to solve mathematical programming problems which were previously considered unsolvable. Opponents of software patents have further alleged that the patents ruined the positive interaction cycles that previously characterized the relationship between researchers in linear programming and industry, and specifically it isolated Karmarkar himself from the network of mathematical researchers in his field. [26]

The patent itself expired in April 2006, and the algorithm is presently in the public domain.

## References

1. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
2. http://dl.acm.org/citation.cfm?id=808695
4. http://onlinelibrary.wiley.com/doi/10.1002/j.1538-7305.1989.tb00316.x/abstract
5. Karmarkar N.K., An InteriorPoint Approach to NPComplete Problems Part I, AMS series on Contemporary Mathematics 114, pp. 297308 (June 1990). http://www.ams.org/books/conm/114/conm114-endmatter.pdf
6. Karmarkar, N.K.., Riemannian Geometry Underlying Interior Point Methods for Linear programming, AMS series on Contemporary Mathematics 114, pp. 5175 (June 1990). http://www.ams.org/books/conm/114/conm114-endmatter.pdf
7. Karmarkar N. K., Lagarias, J.C., Slutsman, L., and Wang, P., Power Series Variants of KarmarkarType Algorithm, AT & T technical Journal 68, No. 3, May/June (1989).
9. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
10. Karmarkar, N.K.,Interior Point Methods in Optimization, Proceedings of the Second International Conference on Industrial and Applied Mathematics, SIAM, pp. 160181 (1991)
11. Karmarkar, N. K. and Kamath, A. P., A continuous Approach to Deriving Upper Bounds in Quadratic Maximization Problems with Integer Constraints, Recent Advances in Global Optimization, pp. 125140, Princeton University Press (1992).
12. 26. Karmarkar, N. K., Thakur, S. A., An Interior Point Approach to a Tensor Optimisation Problem with Application to Upper Bounds in Integer Quadratic Optimization Problems, Proceedings of Second Conference on Integer Programming and Combinatorial Optimisation, (May 1992).
13. 27. Kamath, A., Karmarkar, N. K., A Continuous Method for Computing Bounds in Integer Quadratic Optimisation Problems, Journal of Global Optimization (1992).
14. Karmarkar, N. K., Beyond Convexity: New Perspectives in Computational Optimization. Springer Lecture Notes in Computer Science LNCS 6457, Dec 2010
15. Sinha L.P., Freedman, B. A., Karmarkar, N. K., Putcha, A., and Ramakrishnan K.G., Overseas Network Planning, Proceedings of the Third International Network Planning Symposium, NETWORKS' 86, Tarpon Springs, Florida (June 1986).
16. Various posts by Matthew Saltzman, Clemson University
17. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
18. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
19. Mark A. Paley (1995). "The Karmarkar Patent: Why Congress Should “Open the Door” to Algorithms as Patentable Subject Matter". 22 COMPUTER L. REP. 7
20. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
21. {{#invoke:Citation/CS1|citation |CitationClass=journal }}