本文整理汇总了Python中problem.Problem.base方法的典型用法代码示例。如果您正苦于以下问题:Python Problem.base方法的具体用法?Python Problem.base怎么用?Python Problem.base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类problem.Problem
的用法示例。
在下文中一共展示了Problem.base方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate
# 需要导入模块: from problem import Problem [as 别名]
# 或者: from problem.Problem import base [as 别名]
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
示例2: toProblem
# 需要导入模块: from problem import Problem [as 别名]
# 或者: from problem.Problem import base [as 别名]
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