]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Added the objective_function_value() method to the SimplexIteration class.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 18 Jun 2010 05:44:02 +0000 (01:44 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 18 Jun 2010 05:44:02 +0000 (01:44 -0400)
src/LinearProgramming.py

index ceb2e5fca184f5825720406ef3db6c7a30c6cad4..2e8477d609fac8869cb41e23e14fcc89c2d7a1c9 100644 (file)
@@ -461,6 +461,13 @@ class SimplexIteration(object):
         bm = delete(bm, idxs, axis=1)
         return bm.tolist()
 
+
+    def objective_function_value(self):
+        c = array(self.objective_coefficients)
+        sv = array(self.solution_vector)
+        return dot(sv, c)
+
+
     def reduced_cost(self, idx):
         # Find the reduced cost ofthe variable whose column has index
         # idx.