ruby-cbc 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d9720edcbf27e226ebe571850b40fbdd0a892c2
4
- data.tar.gz: d60d13f0e8ec7191c321f59c38ddd2c233628ff8
3
+ metadata.gz: 7b3bd5e7537787bc26e74fbdbbd3f0bc54eec457
4
+ data.tar.gz: e0518899941ecdf5a1830bb0a705e79e089dc5fa
5
5
  SHA512:
6
- metadata.gz: ff5c4405211e44c42011661c8717d66ac85c2f73f23f4bf6cfe664bf6f6a675169b81828743b9f28cd2af816c75e70f571354ae9c6791f041b59dbac3306c56d
7
- data.tar.gz: 2fb0b13c92348e333ba5bad7ecddf526ce16b51a34e0354560d337d0f418e49d63004c961fb17d2aa1b77eecf409cde8a7fba3067d35cbe4645d688ca04d657f
6
+ metadata.gz: ee4748bef55aa3068f3142d895dc2fca4278dce5a0da9d1c556a40e10c04c188230d7cbc36daa494130019cd2a66e938a0adad83ad33ed9a1109ba3af4dd8b5d
7
+ data.tar.gz: 6e16c892893fa6a9e07d6ee4e5757362bb7c36d62d42682f1b87be532f3606d3e8519acb8c423de3577f5537f53a8d3223dfcddc561b4d98855455a05da8b4a5
@@ -9,18 +9,19 @@ module Ilp
9
9
  end
10
10
 
11
11
  def +(vars)
12
+ new_terms = terms.dup
12
13
  if vars.is_a? Numeric
13
- @terms << vars
14
+ new_terms << vars
14
15
  elsif vars.is_a? Ilp::Var
15
- @terms << Ilp::Term.new(vars)
16
+ new_terms << Ilp::Term.new(vars)
16
17
  elsif vars.is_a? Ilp::Term
17
- @terms << vars
18
+ new_terms << vars
18
19
  elsif vars.is_a? Ilp::TermArray
19
- @terms += vars.terms
20
+ new_terms.concat(vars.terms)
20
21
  else
21
22
  raise ArgumentError, "Argument is not allowed: #{vars} of type #{vars.class}"
22
23
  end
23
- self
24
+ TermArray.new(*new_terms)
24
25
  end
25
26
 
26
27
  def -(vars)
@@ -29,8 +30,8 @@ module Ilp
29
30
 
30
31
  def *(mult)
31
32
  raise ArgumentError, 'Argument is not numeric' unless mult.is_a? Numeric
32
- @terms.map! { |term| term * mult }
33
- self
33
+ new_terms = terms.map { |term| term * mult }
34
+ TermArray.new(*new_terms)
34
35
  end
35
36
 
36
37
  # cste + nb * var + nb * var...
@@ -29,7 +29,7 @@ module Cbc
29
29
  end
30
30
 
31
31
  def bin_var_array(length, names: nil)
32
- array_var(length, Ilp::Var::BINARY_KIND, range, names)
32
+ array_var(length, Ilp::Var::BINARY_KIND, nil, names)
33
33
  end
34
34
 
35
35
  def cont_var(range = nil, name: nil)
@@ -1,3 +1,3 @@
1
1
  module Cbc
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-cbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Verger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler