Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Row#get_stat, Row#get_prim and Row#get_dual

  • Loading branch information...
commit de5eac5dfb906c3df679af5f709b42e9bc0a003a 1 parent 8935fac
@tamc tamc authored
Showing with 19 additions and 1 deletion.
  1. +2 −0  ChangeLog.md
  2. +14 −1 lib/rglpk.rb
  3. +3 −0  test/test_brief_example.rb
View
2  ChangeLog.md
@@ -1,3 +1,5 @@
+* Add Row#get_stat, Row#get_prim Row#get_dual
+
# rglpk 0.2.4 2010-11-04
* Add Rglpk#mip_status.
View
15 lib/rglpk.rb
@@ -211,7 +211,7 @@ def name=(n)
def name
Glpk_wrapper.glp_get_row_name(@p.lp, @i)
end
-
+
def set_bounds(type, lb, ub)
raise ArgumentError unless TypeConstants.include?(type)
lb = 0.0 if lb.nil?
@@ -254,6 +254,19 @@ def get
end
row
end
+
+ def get_stat
+ Glpk_wrapper.glp_get_row_stat(@p.lp,@i)
+ end
+
+ def get_prim
+ Glpk_wrapper.glp_get_row_prim(@p.lp,@i)
+ end
+
+ def get_dual
+ Glpk_wrapper.glp_get_row_dual(@p.lp,@i)
+ end
+
end
class Column
View
3  test/test_brief_example.rb
@@ -52,5 +52,8 @@ def test_example
result = "z = %g; x1 = %g; x2 = %g; x3 = %g" % [z, x1, x2, x3]
assert_equal "z = 733.333; x1 = 33.3333; x2 = 66.6667; x3 = 0", result
+ assert_equal Rglpk::GLP_NU, rows[0].get_stat
+ assert_equal 100, rows[0].get_prim
+ assert_equal 3.333333333333333, rows[0].get_dual
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.