Difference between revisions of "ApCoCoA1:GLPK.LPSolve"
(Updated example) 

(No difference)

Revision as of 19:45, 17 September 2019
GLPK.LPSolve
Solving linear programmes.
Syntax
GLPK.LPSolve(Objective_f:POLY, EQ_Poly:LIST, LE_Poly:LIST, GE_Poly:LIST, Bounds:LIST, Method:STRING, MinMax:STRING):LIST
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.
@param Objective_f: A linear polynomial which is equivalent to the linear objective function.
@param EQ_Poly: List of linear polynomials, which are equivalent to the equalitypart in the list of conditions.
@param LE_Poly: List of linear polynomials, which are equivalent to the lower or equalpart in the list of conditions.
@param GE_Poly: List of linear polynomials, which are equivalent to the greater or equalpart in the list of conditions.
@param 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).
@param Method: You can choose between the interiorpointmethod ("InterP") or the simplexalgorithm ("Simplex"). Usually you should use the simplexalgorithm.
@param MinMax: Minimization ("Min") or maximization ("Max"), that's the question.
@return List of linear polynomials, the zeros of the polynomials are the points where the optimal value of the objective function is achieved
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.LPSolvefunction. Use S::=QQ[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, <quotes>Simplex</quotes>, <quotes>Max</quotes>);  And we achieve:  Solution Status: OPTIMAL Value of objective function: 5333333333/1000000000 [x  266667/100000, y  4]