def generate(self, rows, cols, seed=None): npr.seed(seed) problem = Problem() problem.dual = False problem.A = self.__getMatrixA(rows, cols) problem.b = self.__getVectorB(rows) problem.c = self.__getVectorC(cols) problem.base = range(cols, rows + cols) problem.nonBase = range(0, cols) problem.decVarCount = cols return problem
def toProblem(self): # get current state A = self.__getMatrixA() b = self.__forwardSolve(self.b) objVal, c = self.__getObjectiveRow() dual = self.problem.dual # build problem problem = Problem() problem.dual = dual problem.A = A problem.b = b problem.c = c.transpose() problem.z = objVal problem.base = self.base[:] problem.nonBase = self.nonBase[:] return problem