opl 2.5.2 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/opl.rb +7 -6
  3. data/lib/string.rb +1 -3
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a772d39a2592f51445d27d838fb5c0fa303e54f874f37171cd2b1357462a3442
4
- data.tar.gz: 8e874232cf7834b8dd2eb898dd10d382988594c957ebdc3fe1bf618494150554
3
+ metadata.gz: fef938a40faedf2591a3fd279c08f8bbf8a191f258f049af67d643f59c352bc2
4
+ data.tar.gz: a0503b49464613cd0d388c331df774cda3120659b0755c76f3ccf01218e81f3d
5
5
  SHA512:
6
- metadata.gz: 6a166aceae348d8505d78a5b338b66758082967504d7770516802ae97c747b9f525a5b993901f7252e6042d6723e8dd70ba5bcfc499e2f2c39d60b18f4ccb64b
7
- data.tar.gz: a423e7cd941be1e9ea65f61fcc29cdc55a397a577acfe112d440be947d490ca3cd6773b083f1b2b06d890beff158398e7fa1a7a7ba2c67586913a7fd728e53b0
6
+ metadata.gz: a0cdcd508d5b5cb1e1385a90c5451cdf82b37121a2d716c5324e25746b2bc271c852389208eb55f3a4f0f16ab3e51efc401ff2f0bee93798de512da5d7549286
7
+ data.tar.gz: a8bc9492fc5baddefdca243da8baedd9bed515af67359d2bfad17493cdd49bfd5cee5c9799ce4dca4e22d34637a27fec60cad8181a90e6a70202ceb3cd26df6f
data/lib/opl.rb CHANGED
@@ -471,8 +471,9 @@ class OPL
471
471
  end
472
472
 
473
473
  def self.sum_indices(constraint)
474
- #pieces_to_sub = constraint.scan(/[a-z]\[\d[\d\+\-]+\]/)
475
- pieces_to_sub = constraint.scan(/[a-z\]]\[\d[\d\+\-]+\]/)
474
+ # pieces_to_sub = constraint.scan(/[a-z]\[\d[\d\+\-]+\]/)
475
+ # pieces_to_sub = constraint.scan(/[a-z\]]\[\d[\d\+\-]+\]/)
476
+ pieces_to_sub = constraint.scan(/\[[\d\+\-]+\]/)
476
477
  pieces_to_sub.each do |piece|
477
478
  characters_to_sum = piece.scan(/[\d\+\-]+/)[0]
478
479
  index_sum = self.sum_constants(characters_to_sum)
@@ -991,7 +992,7 @@ def subject_to(constraints, options=[])
991
992
  end
992
993
  vars = OPL::Helper.variables(lhs, lp)
993
994
  zero_coef_vars = all_vars - vars
994
- row = OPL::Row.new(name, lower_bound, upper_bound, epsilon)
995
+ row = OPL::Row.new("row-#{rand(10000)}", lower_bound, upper_bound, epsilon)
995
996
  row.constraint = constraint
996
997
  coefs = coefs + zero_coef_vars.map{|z|0}
997
998
  vars = vars + zero_coef_vars
@@ -1128,11 +1129,11 @@ def optimize(optimization, objective, lp)
1128
1129
  lp.objective = lp.error_message
1129
1130
  end
1130
1131
  if lp.rglpk_object.status.to_s == "4"
1131
- raise "There is no feasible solution."
1132
+ puts "There is no feasible solution."
1132
1133
  elsif lp.rglpk_object.status.to_s == "6"
1133
- raise "The solution is unbounded."
1134
+ puts "The solution is unbounded."
1134
1135
  elsif lp.rglpk_object.status.to_s == "1"
1135
- raise "The solution is undefined."
1136
+ puts "The solution is undefined."
1136
1137
  end
1137
1138
  lp
1138
1139
  end
data/lib/string.rb CHANGED
@@ -2,9 +2,7 @@ class String
2
2
  def paren_to_array
3
3
  #in: "(2..5)"
4
4
  #out: "[2,3,4,5]"
5
- start = self[1].to_i
6
- stop = self[-2].to_i
7
- (start..stop).map{|i|i}.to_s
5
+ eval(self).map{|i|i}.to_s
8
6
  end
9
7
 
10
8
  def sub_paren_with_array
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Godlove
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-20 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rglpk
@@ -40,7 +40,7 @@ homepage: http://github.com/brg8/opl
40
40
  licenses:
41
41
  - MIT
42
42
  metadata: {}
43
- post_install_message:
43
+ post_install_message:
44
44
  rdoc_options: []
45
45
  require_paths:
46
46
  - lib
@@ -55,8 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  requirements: []
58
- rubygems_version: 3.0.6
59
- signing_key:
58
+ rubygems_version: 3.0.9
59
+ signing_key:
60
60
  specification_version: 4
61
61
  summary: Linear Or Mixed Integer Program Solver
62
62
  test_files: []