# simplex.py
"""Volume 2B: Simplex.
Problems 1-6 give instructions on how to build the SimplexSolver class.
The grader will test your class by solving various linear optimization
problems and will only call the constructor and the solve() methods directly.
Write good docstrings for each of your class methods and comment your code.
prob7() will also be tested directly.
"""
# Problems 1-6
class SimplexSolver(object):
"""Class for solving the standard linear optimization problem
maximize c^Tx
subject to Ax <= b
x >= 0
via the Simplex algorithm.
"""
def __init__(self, c, A, b):
"""
Parameters:
c (1xn ndarray): The coefficients of the linear objective function.
A (mxn ndarray): The constraint coefficients matrix.
b (1xm ndarray): The constraint vector.
Raises:
ValueError: if the given system is infeasible at the origin.
"""
return NotImplementedError("SimplexSolver Not Started")
def solve(self):
"""Solve the linear optimization problem.
Returns:
(float) The maximum value of the objective function.
(dict): The basic variables and their values.
(dict): The nonbasic variables and their values.
"""
raise NotImplementedError("SimplexSolver Incomplete")
# Problem 7
def prob7(filename='productMix.npz'):
"""Solve the product mix problem for the data in 'productMix.npz'.
Parameters:
filename (str): the path to the data file.
Returns:
The minimizer of the problem (as an array).
"""
raise NotImplementedError("Problem 7 Incomplete")