1 @c -----------------------------------------------------------------------------
2 @c File : simplex.de.texi
3 @c License : GNU General Public License (GPL)
7 @c This file is part of Maxima -- GPL CAS based on DOE-MACSYMA
8 @c -----------------------------------------------------------------------------
11 * Introduction to simplex::
12 * Functions and Variables for simplex::
15 @c -----------------------------------------------------------------------------
16 @node Introduction to simplex, Functions and Variables for simplex, simplex, simplex
17 @section Introduction to simplex
19 @code{simplex} is a package for linear optimization using the simplex algorithm.
25 @c minimize_lp(x+y, [3*x+2*y>2, x+4*y>3]);
28 (%i1) load("simplex")$
29 (%i2) minimize_lp(x+y, [3*x+2*y>2, x+4*y>3]);
31 (%o2) [--, [y = --, x = -]]
36 @c @category{Numerical methods} @category{Share packages} @category{Package simplex}
39 @c -----------------------------------------------------------------------------
40 @node Functions and Variables for simplex, , Introduction to simplex, simplex
41 @section Functions and Variables for simplex
43 @c -----------------------------------------------------------------------------
44 @defvr {Option variable} epsilon_lp
45 Default value: @code{10^-8}
47 Epsilon used for numerical computations in @code{linear_program}.
49 See also: @code{linear_program}.
52 @c @category{Package simplex}
56 @c -----------------------------------------------------------------------------
57 @deffn {Function} linear_program (@var{A}, @var{b}, @var{c})
59 @code{linear_program} is an implementation of the simplex algorithm.
60 @code{linear_program(A, b, c)} computes a vector @var{x} for which
61 @code{c.x} is minimum possible among vectors for which @code{A.x = b}
62 and @code{x >= 0}. Argument @var{A} is a matrix and arguments @var{b}
63 and @var{c} are lists.
65 @code{linear_program} returns a list which contains the minimizing
66 vector @var{x} and the minimum value @code{c.x}. If the problem is not
67 bounded, it returns "Problem not bounded!" and if the problem is not
68 feasible, it returns "Problem not feasible!".
70 To use this function first load the @code{simplex} package with
71 @code{load("simplex");}.
76 @c A: matrix([1,1,-1,0], [2,-3,0,-1], [4,-5,0,0])$
79 @c linear_program(A, b, c);
82 (%i2) A: matrix([1,1,-1,0], [2,-3,0,-1], [4,-5,0,0])$
85 (%i5) linear_program(A, b, c);
87 (%o5) [[--, 4, --, 0], - -]
91 See also: @code{minimize_lp}, @code{scale_lp}, and @code{epsilon_lp}.
94 @c @category{Package simplex} @category{Numerical methods}
98 @c -----------------------------------------------------------------------------
99 @deffn {Function} maximize_lp (@var{obj}, @var{cond}, [@var{pos}])
101 Maximizes linear objective function @var{obj} subject to some linear
102 constraints @var{cond}. See @code{minimize_lp} for detailed
103 description of arguments and return value.
106 See also: @code{minimize_lp}.
109 @c @category{Package simplex} @category{Numerical methods}
113 @c -----------------------------------------------------------------------------
114 @deffn {Function} minimize_lp (@var{obj}, @var{cond}, [@var{pos}])
116 Minimizes a linear objective function @var{obj} subject to some linear
117 constraints @var{cond}. @var{cond} a list of linear equations or
118 inequalities. In strict inequalities @code{>} is replaced by @code{>=}
119 and @code{<} by @code{<=}. The optional argument @var{pos} is a list
120 of decision variables which are assumed to be positive.
122 If the minimum exists, @code{minimize_lp} returns a list which
123 contains the minimum value of the objective function and a list of
124 decision variable values for which the minimum is attained. If the
125 problem is not bounded, @code{minimize_lp} returns "Problem not
126 bounded!" and if the problem is not feasible, it returns "Ploblem not
129 The decision variables are not assumed to be nonegative by default. If
130 all decision variables are nonegative, set @code{nonegative_lp} to
131 @code{true}. If only some of decision variables are positive, list
132 them in the optional argument @var{pos} (note that this is more
133 efficient than adding constraints).
135 @code{minimize_lp} uses the simplex algorithm which is implemented in
136 maxima @code{linear_program} function.
138 To use this function first load the @code{simplex} package with
139 @code{load("simplex");}.
144 @c minimize_lp(x+y, [3*x+y=0, x+2*y>2]);
145 @c minimize_lp(x+y, [3*x+y>0, x+2*y>2]), nonegative_lp=true;
146 @c minimize_lp(x+y, [3*x+y=0, x+2*y>2]), nonegative_lp=true;
147 @c minimize_lp(x+y, [3*x+y>0]);
150 (%i1) minimize_lp(x+y, [3*x+y=0, x+2*y>2]);
152 (%o1) [-, [y = -, x = - -]]
154 (%i2) minimize_lp(x+y, [3*x+y>0, x+2*y>2]), nonegative_lp=true;
155 (%o2) [1, [y = 1, x = 0]]
156 (%i3) minimize_lp(x+y, [3*x+y=0, x+2*y>2]), nonegative_lp=true;
157 (%o3) Problem not feasible!
158 (%i4) minimize_lp(x+y, [3*x+y>0]);
159 (%o4) Problem not bounded!
163 See also: @code{maximize_lp}, @code{nonegative_lp}, @code{epsilon_lp}.
166 @c @category{Package simplex} @category{Numerical methods}
170 @c -----------------------------------------------------------------------------
171 @defvr {Option variable} nonegative_lp
172 Default value: @code{false}
174 If @code{nonegative_lp} is true all decision variables to
175 @code{minimize_lp} and @code{maximize_lp} are assumed to be positive.
177 See also: @code{minimize_lp}.
180 @c @category{Package simplex}
184 @c --- End of file simplex.de.texi ---------------------------------------------