elpee.LinearProblem
Class to represent the linear programming optimization problem with its objective function, constraints and other conditions
Import
from elpee import LinearProblem
Methods
Creates an empty elpee.LinearProblem to be solved with sense either Maximize (True) or Minimize (False).
Parameters
- is_maximizationbool [Default = True]
Sets a maximization LP problem when True. Else sets a minimization LP problem.
- objective_exprstr [Optional]
String expression of the objective function of LP Problem
Example Code
lp_problem = LinearProblem(is_maximization=True)
Define the objective function expression into the linear programming problem. Replaces previous objective function.
Parameters
- objective_exprstr
String expression of the objective function of LP Problem
Exceptions
ValueError is thrown when objective function expression is not valid
Example Code
lp_problem.add_objective("5*x1 + 4*x2")
Add a new constraint to existing LP Problem.
Parameters
- constraint_exprstr`
String expression of a mathematical inequality of equality to represent as a new constraint
Exceptions
ValueError is thrown when objective function expression is not valid
Example Code
lp_problem.add_constraint("6*x1 + 4*x2 <= 24")
lp_problem.add_constraint("x1 + 2*x2 <= 6")
Configures the LP problem to be solved using big M method
Configures the LP problem to be solved using Dual Simplex method
- standardize_problem `elpee.StandardProblem`
Convert the given Linear Programming problem into a Standardized Linear Programming Problem for computation
Returns
elpee.StandardProblem object with LinearProblem converted for computation
Example Code
lp_problem.standardize_problem()