rglpk 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -24,15 +24,13 @@ module Rglpk
24
24
  end
25
25
 
26
26
  def [](i)
27
- if i.kind_of?(Numeric)
28
- @array[i]
29
- elsif i.kind_of?(String)
30
- raise RuntimeError if self[1].nil?
27
+ if i.kind_of?(String)
28
+ raise RuntimeError, "no rows" if self[1].nil?
31
29
  idx = Glpk_wrapper.send(glp_find_method, self[1].p.lp, i)
32
- raise ArgumentError if idx == 0
30
+ raise ArgumentError, "no row with name #{i.inspect}" if idx == 0
33
31
  @array[idx - 1]
34
32
  else
35
- raise ArgumentError
33
+ @array[i]
36
34
  end
37
35
  end
38
36
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rglpk}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex Gutteridge", "William Taysom"]
12
- s.date = %q{2010-10-25}
12
+ s.date = %q{2010-11-03}
13
13
  s.description = %q{Rglpk is a package providing a Ruby wrapper to the [GNU GLPK](http://www.gnu.org/software/glpk/) library. The GLPK (GNU Linear Programming Kit) package is intended for solving large-scale linear programming (LP), mixed integer programming (MIP), and other related problems.
14
14
 
15
15
  Rglpk (pronounced as "wriggle-pick") is currently in alpha status and the API should be considered subject to change. Rglpk uses [Swig](http://www.swig.org/) to initially wrap the C GLPK library (using a Swig wrapper originally developed by Nigel Galloway) and then a pure Ruby library to wrap the Swig code in a more friendly OO-style.
@@ -151,6 +151,12 @@ class TestRglpk < Test::Unit::TestCase
151
151
  p.rows[0].name = 'test'
152
152
  assert_equal [1, 2], p.rows['test'].get
153
153
  end
154
+
155
+ def test_get_row_range
156
+ p = Rglpk::Problem.new
157
+ p.add_rows(5)
158
+ assert_equal 2, p.rows[3..-1].size
159
+ end
154
160
 
155
161
  def test_col_get_by_name
156
162
  p = Rglpk::Problem.new
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rglpk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Gutteridge
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-25 00:00:00 +08:00
19
+ date: 2010-11-03 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies: []
22
22