rams 0.1.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d4517c505465b19e574e3cc95c74f2752e2f86c6
4
- data.tar.gz: 8a89edf255ae13faecef79b088405fa4585f0bcd
2
+ SHA256:
3
+ metadata.gz: 2698305984dbac218b10cdacc6ae51d400a163824bbe4f589ac6b137515e5294
4
+ data.tar.gz: daa2eaa37952ad4fdd5e45b80f759a3e3673e66f30768995706c3644fd62e5f0
5
5
  SHA512:
6
- metadata.gz: 057e75b5aed5a80b4522becfe96377c80c3f55c635db61dad3e53a7a22586b6774935e8d339c8acb81906e4de9817d6dbe555d2a207a4d57927632400cfe3a3e
7
- data.tar.gz: 543e206a28a6b83918b1dd9edb390b55986a1f25cbec295f49251abcec9c1af5f3a7d41b4b8e2a3c0059d05459bc6ba1e2f9efe25b93cfa8938ac636a0970512
6
+ metadata.gz: 06e3e2d8c5db855ce2ada7f400b5208199fec2c81e2ab5037e59aa382311f2019563f66abb072c38e6f5725f60725eee881e2354258987f4d4d5d76af6dcc8db
7
+ data.tar.gz: 63347ef76f94ca8f162424ac8bdc269041ccbc181a251fd1d49f2751d3dc8040170c85e2796d59146b6b2e67d91580b9cafd00e65e85c8e523a7c5e87658a0b6
data/lib/rams/numeric.rb CHANGED
@@ -30,7 +30,7 @@ class Integer
30
30
  end
31
31
  end
32
32
 
33
- # Floats can be treated the same way as Fixnums.
33
+ # Floats can be treated the same way as Integers.
34
34
  class Float
35
35
  alias old_add +
36
36
  alias old_sub -
@@ -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
- objective = lines.first.split[-1].to_f
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 = model.sense == :max ? -comps[3].to_f : comps[3].to_f
38
+ dual = comps[3].to_f
40
39
  [model.constraints[comps[1]], dual]
41
40
  end.to_h
42
41
  end
@@ -21,22 +21,21 @@ module RAMS
21
21
  end
22
22
 
23
23
  def parse_objective(model, lines)
24
- return nil if lines.count < 2
25
- objective = lines[1].split[-1].to_f
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 + 2, model.variables.count].map do |l|
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[2, model.constraints.count].map do |l|
36
+ lines[1, model.constraints.count].map do |l|
38
37
  comps = l.split
39
- dual = model.sense == :max ? -comps[3].to_f : comps[3].to_f
38
+ dual = comps[3].to_f
40
39
  [model.constraints[comps[1]], dual]
41
40
  end.to_h
42
41
  end
@@ -28,9 +28,9 @@ module RAMS
28
28
  end
29
29
 
30
30
  def parse_objective(_model, lines)
31
- status = (lines.select { |l| l =~ /^objective value:/ }.first || '').split
32
- return nil if status.size < 3
33
- status[2].to_f
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.6
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: 2017-02-05 00:00:00.000000000 Z
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: 2.4.0
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
- rubyforge_project:
54
- rubygems_version: 2.6.8
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: []