Skip to content

Commit

Permalink
Added Row#get_stat, Row#get_prim and Row#get_dual
Browse files Browse the repository at this point in the history
  • Loading branch information
tamc committed Jun 4, 2011
1 parent 8935fac commit de5eac5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 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.
Expand Down
15 changes: 14 additions & 1 deletion lib/rglpk.rb
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/test_brief_example.rb
Expand Up @@ -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

0 comments on commit de5eac5

Please sign in to comment.