Maxima Function
linear_program (A, b, c)
linear_program
is an implementation of the simplex algorithm.
linear_program(A, b, c)
computes a vector x for which
c.x
is minimum possible among vectors for which A.x = b
and x >= 0
. Argument A is a matrix and arguments b
and c are lists.
linear_program
returns a list which contains the minimizing
vector x and the minimum value c.x
. If the problem is not
bounded, it returns "Problem not bounded!" and if the problem is not
feasible, it returns "Problem not feasible!".
To use this function first load the simplex
package with
load(simplex);
.
Example:
(%i2) A: matrix([1,1,-1,0], [2,-3,0,-1], [4,-5,0,0])$ (%i3) b: [1,1,6]$ (%i4) c: [1,-2,0,0]$ (%i5) linear_program(A, b, c); 13 19 3 (%o5) [[--, 4, --, 0], - -] 2 2 2