mex.simplex.problem_definition.obj

mex.simplex.problem_definition.obj(matrix, eq, memory_prof=False)[source]

Adds the objective function to the problem matrix.

Note

Objective function must be added after constraints have been input.

Parameters
  • matrix (numpy array) – matrix defined with create_matrix.

  • eq (string) – coefficients of objective function.

>>> 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