def solve(filename, method): s = CyClpSimplex() s.readMps(filename) s.preSolve(feasibilityTolerance=10 ** -8) #s.useCustomPrimal(1) if method == 'd': pivot = DantzigPivot(s) elif method == 'l': pivot = LIFOPivot(s) elif method == 'm': pivot = MostFrequentPivot(s) elif method == 'p': pivot = PositiveEdgePivot(s) else: print('Unkown solution method.') sys.exit(1) s.setPivotMethod(pivot) #s.setPerturbation(50) start = clock() s.primal() print('Problem solved in %g seconds.' % (clock() - start)) return s.objectiveValue
def __init__(self, clpModel, bucketSize=1, EPSILON=10**(-7)): PositiveEdgePivot.__init__(self, clpModel, bucketSize, EPSILON) self.banList = []
def test_PE(self): #pivot = PositiveEdgePivot(self.s) self.s.setPivotMethod(PositiveEdgePivot(self.s)) self.s.primal() self.assertEqual(round(self.s.objectiveValue, 4), 2520.5717)
def __init__(self, clpModel, bucketSize=1, EPSILON=10 ** (-7)): PositiveEdgePivot.__init__(self, clpModel, bucketSize, EPSILON) self.banList = []