Maxima Function
minimize_lp (obj, cond, [pos])
Minimizes a linear objective function obj subject to some linear
constraints cond. cond a list of linear equations or
inequalities. In strict inequalities >
is replaced by >=
and <
by <=
. The optional argument pos is a list
of decision variables which are assumed to be positive.
If the minimum exists, minimize_lp
returns a list which
contains the minimum value of the objective function and a list of
decision variable values for which the minimum is attained. If the
problem is not bounded, minimize_lp
returns "Problem not
bounded!" and if the problem is not feasible, it returns "Ploblem not
feasible!".
The decision variables are not assumed to be nonegative by default. If
all decision variables are nonegative, set nonegative_lp
to
true
. If only some of decision variables are positive, list
them in the optional argument pos (note that this is more
efficient than adding constraints).
minimize_lp
uses the simplex algorithm which is implemented in
maxima linear_program
function.
To use this function first load the simplex
package with
load(simplex);
.
Examples:
(%i1) minimize_lp(x+y, [3*x+y=0, x+2*y>2]); 4 6 2 (%o1) [-, [y = -, x = - -]] 5 5 5 (%i2) minimize_lp(x+y, [3*x+y>0, x+2*y>2]), nonegative_lp=true; (%o2) [1, [y = 1, x = 0]] (%i3) minimize_lp(x+y, [3*x+y=0, x+2*y>2]), nonegative_lp=true; (%o3) Problem not feasible! (%i4) minimize_lp(x+y, [3*x+y>0]); (%o4) Problem not bounded!