Difference between revisions of "ApCoCoA-1:GLPK.LPSolve"
m |
|||
Line 10: | Line 10: | ||
<itemize> | <itemize> | ||
<item><em>Objective_f</em>: A linear polynomial which is equivalent to the linear objective function.</item> | <item><em>Objective_f</em>: A linear polynomial which is equivalent to the linear objective function.</item> | ||
− | |||
<item><em>EQ_Poly</em>: List of linear polynomials, which are equivalent to the equality-part in the list of conditions.</item> | <item><em>EQ_Poly</em>: List of linear polynomials, which are equivalent to the equality-part in the list of conditions.</item> | ||
− | |||
<item><em>LE_Poly</em>: List of linear polynomials, which are equivalent to the lower or equal-part in the list of conditions.</item> | <item><em>LE_Poly</em>: List of linear polynomials, which are equivalent to the lower or equal-part in the list of conditions.</item> | ||
− | |||
<item><em>GE_Poly</em>: List of linear polynomials, which are equivalent to the greater or equal-part in the list of conditions.</item> | <item><em>GE_Poly</em>: List of linear polynomials, which are equivalent to the greater or equal-part in the list of conditions.</item> | ||
− | |||
<item><em>Bounds</em>: List of lists with two elements. Each List contains the lower and upper bounds for each variable. You can choose between INT or RAT for the type of each bound, if you type in a (empty) string, then it means minus infinity (first place) or plus infinity (second place).</item> | <item><em>Bounds</em>: List of lists with two elements. Each List contains the lower and upper bounds for each variable. You can choose between INT or RAT for the type of each bound, if you type in a (empty) string, then it means minus infinity (first place) or plus infinity (second place).</item> | ||
− | |||
<item><em>Method</em>: You can choose between the interior-point-method ("InterP") or the simplex-algorithm ("Simplex"). Usually you should use the simplex-algorithm.</item> | <item><em>Method</em>: You can choose between the interior-point-method ("InterP") or the simplex-algorithm ("Simplex"). Usually you should use the simplex-algorithm.</item> | ||
− | |||
<item><em>MinMax</em>: Minimization ("Min") or maximization ("Max"), that's the question.</item> | <item><em>MinMax</em>: Minimization ("Min") or maximization ("Max"), that's the question.</item> | ||
</itemize> | </itemize> | ||
− | |||
<example> | <example> | ||
-- We want to maximize the Function y = - 1/2x, | -- We want to maximize the Function y = - 1/2x, | ||
Line 44: | Line 37: | ||
Value of objective function: 5333333333/1000000000 | Value of objective function: 5333333333/1000000000 | ||
[x[1] - 266667/100000, x[2] - 4] | [x[1] - 266667/100000, x[2] - 4] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</example> | </example> | ||
Line 174: | Line 43: | ||
<type>cocoaserver</type> | <type>cocoaserver</type> | ||
</types> | </types> | ||
+ | <see>latte.Minimize</see> | ||
+ | <see>latte.Maximize</see> | ||
<key>lpsolve</key> | <key>lpsolve</key> | ||
<key>solve linear programm</key> | <key>solve linear programm</key> |
Revision as of 11:26, 21 April 2009
GLPK.LPSolve
solve linear programms
Syntax
GLPK.LPSolve(Objective_f:POLYNOM, EQ_Poly:LIST, LE_Poly:LIST, GE_Poly:LIST, Bounds:LIST, Method:STRING, MinMax:STRING)
Description
Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use
it/them.
Objective_f: A linear polynomial which is equivalent to the linear objective function.
EQ_Poly: List of linear polynomials, which are equivalent to the equality-part in the list of conditions.
LE_Poly: List of linear polynomials, which are equivalent to the lower or equal-part in the list of conditions.
GE_Poly: List of linear polynomials, which are equivalent to the greater or equal-part in the list of conditions.
Bounds: List of lists with two elements. Each List contains the lower and upper bounds for each variable. You can choose between INT or RAT for the type of each bound, if you type in a (empty) string, then it means minus infinity (first place) or plus infinity (second place).
Method: You can choose between the interior-point-method ("InterP") or the simplex-algorithm ("Simplex"). Usually you should use the simplex-algorithm.
MinMax: Minimization ("Min") or maximization ("Max"), that's the question.
Example
-- We want to maximize the Function y = - 1/2x, -- with the two conditions y ≤ 6 - 3/4x and y ≥ 1 - x and the bounds 0 ≤ x ≤ 6 and 1/3 ≤ y ≤ 4. -- We prename the input of GLPK.LPSol-function. Use S::=Q[x,y]; OF := 1/2x + y; LE := [3/4x + y - 6]; GE := [x + y - 1]; Bounds:=[[0,6], [1/3,4]]; -- Then we compute the solution with $GLPK.LPSolve(OF, [], LE, GE, Bounds, "Simplex", "Max"); -- And we achieve: ------------------------------------- Solution Status: OPTIMAL Value of objective function: 5333333333/1000000000 [x[1] - 266667/100000, x[2] - 4]