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 +4 -4
- data/lib/ruby-cbc/ilp/term_array.rb +8 -7
- data/lib/ruby-cbc/model.rb +1 -1
- data/lib/ruby-cbc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3bd5e7537787bc26e74fbdbbd3f0bc54eec457
|
4
|
+
data.tar.gz: e0518899941ecdf5a1830bb0a705e79e089dc5fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
14
|
+
new_terms << vars
|
14
15
|
elsif vars.is_a? Ilp::Var
|
15
|
-
|
16
|
+
new_terms << Ilp::Term.new(vars)
|
16
17
|
elsif vars.is_a? Ilp::Term
|
17
|
-
|
18
|
+
new_terms << vars
|
18
19
|
elsif vars.is_a? Ilp::TermArray
|
19
|
-
|
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
|
-
|
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
|
-
|
33
|
-
|
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...
|
data/lib/ruby-cbc/model.rb
CHANGED
data/lib/ruby-cbc/version.rb
CHANGED
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.
|
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:
|
11
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|