Chemical equation balancing: An integer programming approach
Presented here is an integer linear program (ILP) formulation for automatic balancing of a chemical equation. Also described is a integer nonlinear programming (INP) algorithm for balancing. This special algorithm is polynomial time O(n(3)), unlike the ILP approach, and uses the widely available conventional floating-point arithmetic, obviating the need for both rational arithmetic and multiple modulus residue arithmetic. The rational arithmetic is unsuitable due to intermediate number growth, while the residue arithmetic suffers from the lack of a priori knowledge of the set of prime bases that avoids a possible failure due to division by zero. Further, unlike the floating point arithmetic, both arithmetics are not built-in/standard and hence additional programming effort is needed. The INP algorithm has been tested on several typical chemical equations and found to be very successful for most problems in our extensive balancing experiments. This algorithm also has the capability to determine the feasibility of a new chemical reaction and, if it is feasible, then it will balance the equation and also provide the information if two or more linearly independent balancings exist through the rank information. Any general method to solve the ILP is fail-proof, but it is not polynomial time. Since we have not encountered truly large chemical equations having, say, 1000 products and reactants in a real-world situation, a non-polynomial ILP solver is also useful. A justification for the objective functions for ILP and INP algorithms, each of which produces a unique solution, is provided. (c) 2006 Elsevier Ltd. All rights reserved.
integer program floating-point arithmetic balancing chemical equations linear system minimum-norm least-squares solution np-complete problems