From 3bc9f5d2b4196fce972776f38856da05817e7364 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 9 Jul 2010 21:21:56 -0400 Subject: [PATCH] Added a property for the linear program's epsilon level. --- src/LinearProgramming.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/LinearProgramming.py b/src/LinearProgramming.py index 4211058..7ea144b 100644 --- a/src/LinearProgramming.py +++ b/src/LinearProgramming.py @@ -26,6 +26,12 @@ from lpsolve55 import * MINIMIZE = 0 MAXIMIZE = 1 +# "Epsilon levels" +# Used to control rounding thresholds. +EPS_TIGHT = 0 +EPS_MEDIUM = 1 +EPS_LOOSE = 2 +EPS_BAGGY = 3 class LinearProgram(object): """ @@ -116,6 +122,17 @@ class LinearProgram(object): lpsolve('set_rh_vec', self._lp, self._rhs) + @property + def eps_level(self): + return self._eps_level + + @eps_level.setter + def eps_level(self, value): + self._eps_level = value + + if self._lp != None: + lpsolve('set_epslevel', self._lp, value) + @property def inequalities(self): @@ -253,6 +270,7 @@ class LinearProgram(object): self._solution_upper_bounds = [] self._scale_mode = 0 self._type = MINIMIZE + self._eps_level = EPS_MEDIUM def set_all_lp_properties(self): @@ -277,6 +295,7 @@ class LinearProgram(object): self.solution_upper_bounds = self.solution_upper_bounds self.scale_mode = self.scale_mode self.type = self.type + self.eps_level = self.eps_level -- 2.44.2