rglpk 0.2.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +57 -0
- data/README.md +3 -0
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/lib/rglpk.rb +10 -4
- data/rglpk.gemspec +0 -0
- data/test/helper.rb +2 -2
- data/test/test_basic.rb +5 -5
- data/test/test_brief_example.rb +2 -2
- data/test/test_memory_leaks.rb +2 -2
- data/test/test_problem_kind.rb +4 -4
- metadata +74 -42
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 552dbb84e1fc9a6661666fae09a1b1ae80d226f3
|
4
|
+
data.tar.gz: a9eee0901b2ed3e7372f4e6c329beb989bdb3191
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 21fd4b04d71e47dd9876465ad9ab0e1535a20850c550972ae4433365e10d5be43aa4bf69a56fc3fdb5e4f764bb2955449026c2ec88f283966cfdc4eaa9ad8482
|
7
|
+
data.tar.gz: 5b80ba77d56efc2772e58247a1e02019d12a9afe25aa70960398a572756c6802e46e8d0bd682035c83c0af0aef8db1cc08543f9aaa469284315203fb8a86f3a2
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.7)
|
5
|
+
builder (3.2.2)
|
6
|
+
descendants_tracker (0.0.4)
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
8
|
+
faraday (0.9.1)
|
9
|
+
multipart-post (>= 1.2, < 3)
|
10
|
+
git (1.2.9.1)
|
11
|
+
github_api (0.12.3)
|
12
|
+
addressable (~> 2.3)
|
13
|
+
descendants_tracker (~> 0.0.4)
|
14
|
+
faraday (~> 0.8, < 0.10)
|
15
|
+
hashie (>= 3.3)
|
16
|
+
multi_json (>= 1.7.5, < 2.0)
|
17
|
+
nokogiri (~> 1.6.3)
|
18
|
+
oauth2
|
19
|
+
hashie (3.4.1)
|
20
|
+
highline (1.6.21)
|
21
|
+
jeweler (2.0.1)
|
22
|
+
builder
|
23
|
+
bundler (>= 1.0)
|
24
|
+
git (>= 1.2.5)
|
25
|
+
github_api
|
26
|
+
highline (>= 1.6.15)
|
27
|
+
nokogiri (>= 1.5.10)
|
28
|
+
rake
|
29
|
+
rdoc
|
30
|
+
json (1.8.2)
|
31
|
+
jwt (1.3.0)
|
32
|
+
mini_portile (0.6.2)
|
33
|
+
minitest (5.5.1)
|
34
|
+
multi_json (1.11.0)
|
35
|
+
multi_xml (0.5.5)
|
36
|
+
multipart-post (2.0.0)
|
37
|
+
nokogiri (1.6.6.2)
|
38
|
+
mini_portile (~> 0.6.0)
|
39
|
+
oauth2 (0.9.4)
|
40
|
+
faraday (>= 0.8, < 0.10)
|
41
|
+
jwt (~> 1.0)
|
42
|
+
multi_json (~> 1.3)
|
43
|
+
multi_xml (~> 0.5)
|
44
|
+
rack (~> 1.2)
|
45
|
+
rack (1.6.0)
|
46
|
+
rake (10.4.2)
|
47
|
+
rdoc (4.2.0)
|
48
|
+
json (~> 1.4)
|
49
|
+
thread_safe (0.3.5)
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
ruby
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
jeweler
|
56
|
+
minitest
|
57
|
+
rake
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/wtaysom/rglpk.svg)](https://travis-ci.org/wtaysom/rglpk)
|
2
|
+
|
1
3
|
# Introduction
|
2
4
|
|
3
5
|
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.
|
@@ -16,6 +18,7 @@ A working GLPK library installation is required. Currently, Rglpk is tested wit
|
|
16
18
|
> make
|
17
19
|
> make check
|
18
20
|
> make install
|
21
|
+
> ldconfig # creates the necessary links and cache to the most recent shared libraries
|
19
22
|
|
20
23
|
Rglpk is only available as a gem:
|
21
24
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/rglpk.rb
CHANGED
@@ -101,8 +101,11 @@ module Rglpk
|
|
101
101
|
def add_rows(n)
|
102
102
|
Glpk_wrapper.glp_add_rows(@lp, n)
|
103
103
|
s = @rows.size
|
104
|
-
n.times
|
105
|
-
|
104
|
+
n.times.map do |i|
|
105
|
+
new_row = Row.new(self, s + i + 1)
|
106
|
+
@rows.send(:push, new_row)
|
107
|
+
new_row
|
108
|
+
end
|
106
109
|
end
|
107
110
|
|
108
111
|
def add_col
|
@@ -115,8 +118,11 @@ module Rglpk
|
|
115
118
|
def add_cols(n)
|
116
119
|
Glpk_wrapper.glp_add_cols(@lp, n)
|
117
120
|
s = @cols.size
|
118
|
-
n.times
|
119
|
-
|
121
|
+
n.times.map do |i|
|
122
|
+
new_col = Column.new(self, s + i + 1)
|
123
|
+
@cols.send(:push, new_col)
|
124
|
+
new_col
|
125
|
+
end
|
120
126
|
end
|
121
127
|
|
122
128
|
def del_rows(a)
|
data/rglpk.gemspec
CHANGED
Binary file
|
data/test/helper.rb
CHANGED
data/test/test_basic.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path('helper', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
class TestRglpk < Test
|
3
|
+
class TestRglpk < Minitest::Test
|
4
4
|
|
5
5
|
def test_create
|
6
6
|
assert_instance_of Rglpk::Problem, Rglpk::Problem.new
|
@@ -24,7 +24,7 @@ class TestRglpk < Test::Unit::TestCase
|
|
24
24
|
assert_equal Rglpk::GLP_MIN, p.obj.dir
|
25
25
|
p.obj.dir = Rglpk::GLP_MAX
|
26
26
|
assert_equal Rglpk::GLP_MAX, p.obj.dir
|
27
|
-
|
27
|
+
assert_raises(ArgumentError){p.obj.dir = 3}
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_add_row
|
@@ -107,7 +107,7 @@ class TestRglpk < Test::Unit::TestCase
|
|
107
107
|
def test_set_row
|
108
108
|
p = Rglpk::Problem.new
|
109
109
|
p.add_rows(2)
|
110
|
-
|
110
|
+
assert_raises(RuntimeError){p.rows[1].set([1, 2])}
|
111
111
|
p.add_cols(2)
|
112
112
|
p.rows[1].set([1, 2])
|
113
113
|
assert_equal [1, 2], p.rows[1].get
|
@@ -116,7 +116,7 @@ class TestRglpk < Test::Unit::TestCase
|
|
116
116
|
def test_set_col
|
117
117
|
p = Rglpk::Problem.new
|
118
118
|
p.add_cols(2)
|
119
|
-
|
119
|
+
assert_raises(RuntimeError){p.cols[1].set([1, 2])}
|
120
120
|
p.add_rows(2)
|
121
121
|
p.cols[1].set([1, 2])
|
122
122
|
assert_equal [1, 2], p.cols[1].get
|
@@ -211,4 +211,4 @@ class TestRglpk < Test::Unit::TestCase
|
|
211
211
|
def test_derived
|
212
212
|
D.new.add_rows(10)
|
213
213
|
end
|
214
|
-
end
|
214
|
+
end
|
data/test/test_brief_example.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path('helper', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
class TestBriefExample < Test
|
3
|
+
class TestBriefExample < Minitest::Test
|
4
4
|
include Examples
|
5
5
|
|
6
6
|
def test_brief_example
|
@@ -22,4 +22,4 @@ class TestBriefExample < Test::Unit::TestCase
|
|
22
22
|
p.write_lp("test.lp")
|
23
23
|
assert File.exists?("test.lp")
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
data/test/test_memory_leaks.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path('helper', File.dirname(__FILE__))
|
2
2
|
|
3
|
-
class TestMemoryLeaks < Test
|
3
|
+
class TestMemoryLeaks < Minitest::Test
|
4
4
|
include Examples
|
5
5
|
|
6
6
|
def test_memory_prof
|
@@ -27,4 +27,4 @@ class TestMemoryLeaks < Test::Unit::TestCase
|
|
27
27
|
ensure
|
28
28
|
@change_to_real_memory_in_kb__prev = r
|
29
29
|
end
|
30
|
-
end
|
30
|
+
end
|
data/test/test_problem_kind.rb
CHANGED
@@ -48,7 +48,7 @@ module TestProblemKind
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
class BinaryVariables < Test
|
51
|
+
class BinaryVariables < Minitest::Test
|
52
52
|
include TestProblemKind
|
53
53
|
|
54
54
|
def column_kind
|
@@ -60,7 +60,7 @@ class BinaryVariables < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
class IntegerVariables < Test
|
63
|
+
class IntegerVariables < Minitest::Test
|
64
64
|
include TestProblemKind
|
65
65
|
|
66
66
|
def column_kind
|
@@ -72,7 +72,7 @@ class IntegerVariables < Test::Unit::TestCase
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
class ContinuousVariables < Test
|
75
|
+
class ContinuousVariables < Minitest::Test
|
76
76
|
include TestProblemKind
|
77
77
|
|
78
78
|
def column_kind
|
@@ -82,4 +82,4 @@ class ContinuousVariables < Test::Unit::TestCase
|
|
82
82
|
def test_results
|
83
83
|
verify_results(2.5, 1.5, 3.5)
|
84
84
|
end
|
85
|
-
end
|
85
|
+
end
|
metadata
CHANGED
@@ -1,39 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rglpk
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.2.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Alex Gutteridge
|
9
8
|
- William Taysom
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
date: 2015-05-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jeweler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: minitest
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
18
56
|
description: |-
|
57
|
+
# Introduction
|
58
|
+
|
19
59
|
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.
|
20
|
-
|
60
|
+
|
21
61
|
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.
|
22
|
-
|
23
|
-
See [github](http://github.com/wtaysom/rglpk) for installation instructions. All bug reports, feature requests and patches are welcome. Enjoy!
|
24
|
-
email:
|
62
|
+
email:
|
25
63
|
- alexg@kuicr.kyoto-u.ac.jp
|
26
64
|
- wtaysom@gmail.com
|
27
65
|
executables: []
|
28
|
-
|
29
|
-
extensions:
|
66
|
+
extensions:
|
30
67
|
- ext/extconf.rb
|
31
|
-
|
32
|
-
extra_rdoc_files:
|
68
|
+
extra_rdoc_files:
|
33
69
|
- ChangeLog.md
|
34
70
|
- README.md
|
35
|
-
files:
|
71
|
+
files:
|
72
|
+
- ".travis.yml"
|
36
73
|
- ChangeLog.md
|
74
|
+
- Gemfile
|
75
|
+
- Gemfile.lock
|
37
76
|
- License.txt
|
38
77
|
- README.md
|
39
78
|
- Rakefile
|
@@ -51,36 +90,29 @@ files:
|
|
51
90
|
- test/test_brief_example.rb
|
52
91
|
- test/test_memory_leaks.rb
|
53
92
|
- test/test_problem_kind.rb
|
54
|
-
has_rdoc: true
|
55
93
|
homepage: http://rglpk.rubyforge.org/
|
56
94
|
licenses: []
|
57
|
-
|
95
|
+
metadata: {}
|
58
96
|
post_install_message:
|
59
|
-
rdoc_options:
|
60
|
-
- --exclude
|
61
|
-
- .
|
62
|
-
require_paths:
|
97
|
+
rdoc_options:
|
98
|
+
- "--exclude"
|
99
|
+
- "."
|
100
|
+
require_paths:
|
63
101
|
- lib
|
64
|
-
|
65
|
-
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
69
104
|
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version:
|
72
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
|
74
|
-
requirements:
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
75
109
|
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version:
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
78
112
|
requirements: []
|
79
|
-
|
80
113
|
rubyforge_project: rglpk
|
81
|
-
rubygems_version:
|
114
|
+
rubygems_version: 2.4.6
|
82
115
|
signing_key:
|
83
|
-
specification_version:
|
84
|
-
summary:
|
116
|
+
specification_version: 4
|
117
|
+
summary: "# Introduction"
|
85
118
|
test_files: []
|
86
|
-
|