def reaction_fluxes(verbose=False): """ Return the reaction fluxes from the solved FBA model. :param verbose: Print more output :type verbose: bool :return: A dict of reaction ID and flux through that reaction :rtype: dict of str and float """ return lp.col_primal_hash()
def test_primal_hash(self): """Test getting the primals back as a hash""" mat = [ [ 1.0, 1.0, 1.0], [10.0, 4.0, 5.0], [ 2.0, 2.0, 6.0], ] rh = ['a', 'b', 'c'] ch = ['x', 'y', 'z'] lp.load(mat, rh, ch) lp.objective_coefficients([ 10.0, 6.0, 4.0 ]) lp.row_bounds([(None, 100.0), (None, 600.0), (None, 300.0)]) lp.col_bounds([(0, None), (0, None), (0, None)]) status, result = lp.solve() col_pri = {'y': 66.66666666666666, 'x': 33.333333333333336, 'z': 0.0} col_res = lp.col_primal_hash() self.assertEqual(col_pri, col_res)