mex.simplex.problem_definition.maxz¶
-
mex.simplex.problem_definition.
maxz
(matrix, aux=True)[source]¶ Creates maximization function. Determines if 1 extra pivot is required, locates the pivot element, pivots about it and continues the process until all negative elements have been removed from the last column and row.
- Parameters
matrix (numpy array) – problem matrix with constraints and objective function added.
- Returns
(dict) A dictionary with Max and variables.
>>> problem_matrix = create_matrix(2,3) # 2 variables and 3 constraints >>> constrain(problem_matrix,'1,L,4') # x_1 <= 4 >>> constrain(problem_matrix,'0,2,L,12') # 2x_2 <= 12 >>> constrain(problem_matrix,'4,2,G,18') # 4x_1 + 2x_2 >= 18 >>> obj(problem_matrix,'3,5,0') # 3x_1 + 5x_2 >>> maxz(problem_matrix) {'x1': 4.0, 'x2': 6.0, 'max': 42.0}