rulp 0.0.18 → 0.0.19
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 +4 -4
- data/lib/rulp/rulp.rb +14 -4
- 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: 474a46d10d853dad8b127e9dd19205983123b71a
|
4
|
+
data.tar.gz: d62b2a6f88905ecf33384520dbdb7234f3fa6e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e3756baae29ca07a12fb8a24256f956a5619175cd0c10825e82b26f49ae64cca8075451a28358e61669147e38056120d8b746eeaf664cba231592127f47b10
|
7
|
+
data.tar.gz: 0bf9980ff63b3c72ce0b14792847406d53d08fdf5d1b25c250436a251da0db5e2378956f7b2fecc866a5f1c0baac8c294ec383e21d30a4efe36526058c175424
|
data/lib/rulp/rulp.rb
CHANGED
@@ -66,10 +66,20 @@ module Rulp
|
|
66
66
|
|
67
67
|
|
68
68
|
def self.exec(command)
|
69
|
-
|
69
|
+
result = ""
|
70
|
+
Open3.popen2e("#{command} #{Rulp::Logger.print_solver_outputs ? "" : "> /dev/null 2>&1"}") do | inp, out, thr|
|
71
|
+
out.each do |line|
|
72
|
+
puts line
|
73
|
+
result << line
|
74
|
+
end
|
75
|
+
end
|
76
|
+
return result
|
70
77
|
end
|
71
78
|
|
72
79
|
class Problem
|
80
|
+
|
81
|
+
attr_accessor :result, :trace
|
82
|
+
|
73
83
|
def initialize(objective, objective_expression)
|
74
84
|
@objective = objective
|
75
85
|
@variables = Set.new
|
@@ -150,7 +160,7 @@ module Rulp
|
|
150
160
|
Rulp.exec("open #{filename}") if options[:open_definition]
|
151
161
|
|
152
162
|
"Solving problem".log(:info)
|
153
|
-
|
163
|
+
self.trace, time = _profile{ solver.solve }
|
154
164
|
|
155
165
|
Rulp.exec("open #{solver.outfile}") if options[:open_solution]
|
156
166
|
|
@@ -159,10 +169,10 @@ module Rulp
|
|
159
169
|
"Parsing result".log(:info)
|
160
170
|
solver.store_results(@variables)
|
161
171
|
|
162
|
-
result = @objective_expression.evaluate
|
172
|
+
self.result = @objective_expression.evaluate
|
163
173
|
|
164
174
|
"Objective: #{result}\n#{@variables.map{|v|[v.name, "=", v.value].join(' ') if v.value}.compact.join("\n")}".log(:debug)
|
165
|
-
return result
|
175
|
+
return self.result
|
166
176
|
end
|
167
177
|
|
168
178
|
def inspect
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rulp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter Coppieters
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple Ruby LP description DSL
|
14
14
|
email: wc@pico.net.nz
|