rams 0.1.5 → 0.1.7
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.
- checksums.yaml +5 -5
- data/lib/rams/numeric.rb +3 -3
- data/lib/rams/solvers/cbc.rb +3 -4
- data/lib/rams/solvers/clp.rb +5 -6
- data/lib/rams/solvers/scip.rb +3 -3
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2698305984dbac218b10cdacc6ae51d400a163824bbe4f589ac6b137515e5294
|
4
|
+
data.tar.gz: daa2eaa37952ad4fdd5e45b80f759a3e3673e66f30768995706c3644fd62e5f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e3e2d8c5db855ce2ada7f400b5208199fec2c81e2ab5037e59aa382311f2019563f66abb072c38e6f5725f60725eee881e2354258987f4d4d5d76af6dcc8db
|
7
|
+
data.tar.gz: 63347ef76f94ca8f162424ac8bdc269041ccbc181a251fd1d49f2751d3dc8040170c85e2796d59146b6b2e67d91580b9cafd00e65e85c8e523a7c5e87658a0b6
|
data/lib/rams/numeric.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# Integer can be added to expressions or variables or multiplied
|
2
2
|
# by them to create expressions:
|
3
3
|
#
|
4
4
|
# 4 - (3 * x)
|
5
5
|
# y / 2
|
6
|
-
class
|
6
|
+
class Integer
|
7
7
|
alias old_add +
|
8
8
|
alias old_sub -
|
9
9
|
alias old_multiply *
|
@@ -30,7 +30,7 @@ class Fixnum
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
# Floats can be treated the same way as
|
33
|
+
# Floats can be treated the same way as Integers.
|
34
34
|
class Float
|
35
35
|
alias old_add +
|
36
36
|
alias old_sub -
|
data/lib/rams/solvers/cbc.rb
CHANGED
@@ -5,7 +5,7 @@ module RAMS
|
|
5
5
|
# Interface to COIN-OR Branch-and-Cut
|
6
6
|
class CBC < Solver
|
7
7
|
def solver_command(model_path, solution_path, args)
|
8
|
-
['cbc', model_path] + args + ['printingOptions', 'all', 'solve', 'solution', solution_path]
|
8
|
+
['coin.cbc', model_path] + args + ['printingOptions', 'all', 'solve', 'solution', solution_path]
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
@@ -22,8 +22,7 @@ module RAMS
|
|
22
22
|
|
23
23
|
def parse_objective(model, lines)
|
24
24
|
return nil if lines.count < 1
|
25
|
-
|
26
|
-
model.sense == :max ? -objective : objective
|
25
|
+
lines.first.split[-1].to_f
|
27
26
|
end
|
28
27
|
|
29
28
|
def parse_primal(model, lines)
|
@@ -36,7 +35,7 @@ module RAMS
|
|
36
35
|
def parse_dual(model, lines)
|
37
36
|
lines[1, model.constraints.count].map do |l|
|
38
37
|
comps = l.split
|
39
|
-
dual =
|
38
|
+
dual = comps[3].to_f
|
40
39
|
[model.constraints[comps[1]], dual]
|
41
40
|
end.to_h
|
42
41
|
end
|
data/lib/rams/solvers/clp.rb
CHANGED
@@ -21,22 +21,21 @@ module RAMS
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def parse_objective(model, lines)
|
24
|
-
return nil if lines.count <
|
25
|
-
|
26
|
-
model.sense == :max ? -objective : objective
|
24
|
+
return nil if lines.count < 1
|
25
|
+
lines[0].split[-1].to_f
|
27
26
|
end
|
28
27
|
|
29
28
|
def parse_primal(model, lines)
|
30
|
-
lines[model.constraints.count +
|
29
|
+
lines[model.constraints.count + 1, model.variables.count].map do |l|
|
31
30
|
comps = l.split
|
32
31
|
[model.variables[comps[1]], comps[2].to_f]
|
33
32
|
end.to_h
|
34
33
|
end
|
35
34
|
|
36
35
|
def parse_dual(model, lines)
|
37
|
-
lines[
|
36
|
+
lines[1, model.constraints.count].map do |l|
|
38
37
|
comps = l.split
|
39
|
-
dual =
|
38
|
+
dual = comps[3].to_f
|
40
39
|
[model.constraints[comps[1]], dual]
|
41
40
|
end.to_h
|
42
41
|
end
|
data/lib/rams/solvers/scip.rb
CHANGED
@@ -28,9 +28,9 @@ module RAMS
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def parse_objective(_model, lines)
|
31
|
-
|
32
|
-
return nil if
|
33
|
-
|
31
|
+
objective = (lines.select { |l| l =~ /^objective value:/ }.first || '').split
|
32
|
+
return nil if objective.size < 3
|
33
|
+
objective[2].to_f
|
34
34
|
end
|
35
35
|
|
36
36
|
def parse_primal(model, lines)
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rams
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan J. O'Neil
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: A library for solving MILPs in Ruby.
|
14
13
|
email:
|
@@ -35,7 +34,6 @@ homepage: https://github.com/ryanjoneil/rams
|
|
35
34
|
licenses:
|
36
35
|
- MIT
|
37
36
|
metadata: {}
|
38
|
-
post_install_message:
|
39
37
|
rdoc_options: []
|
40
38
|
require_paths:
|
41
39
|
- lib
|
@@ -43,16 +41,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
41
|
requirements:
|
44
42
|
- - ">="
|
45
43
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
44
|
+
version: 3.1.0
|
47
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
46
|
requirements:
|
49
47
|
- - ">="
|
50
48
|
- !ruby/object:Gem::Version
|
51
49
|
version: '0'
|
52
50
|
requirements: []
|
53
|
-
|
54
|
-
rubygems_version: 2.4.5.1
|
55
|
-
signing_key:
|
51
|
+
rubygems_version: 3.6.2
|
56
52
|
specification_version: 4
|
57
53
|
summary: Ruby Algebraic Modeling System
|
58
54
|
test_files: []
|