mipper 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mipper/cbc/model.rb +2 -5
- data/lib/mipper/glpk/model.rb +5 -5
- data/lib/mipper/gurobi/model.rb +4 -5
- data/lib/mipper/lp_solve/model.rb +6 -5
- 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: 7287ac319911c87f47829488284ae00f4025dc90
|
4
|
+
data.tar.gz: 88886036462522fff9ccbb6352df3217bed26ca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13d92ca34c6786899b00dae5a8332e110f6b943504495c9fc54e726708dc1f3bf8f17a24a609b18a4b747374867cb43b0991a564fc293833369e785f91515897
|
7
|
+
data.tar.gz: 9a8c5d65132217994a1532ed8952e163bf07f19d276f28975ec447711ef2e859c8b6111a429ffaa35b776495db6c6033a0698ed31667fc4dc46751c03ab71269
|
data/lib/mipper/cbc/model.rb
CHANGED
@@ -179,13 +179,10 @@ module MIPPeR
|
|
179
179
|
if status == :optimized
|
180
180
|
objective_value = Cbc.Cbc_getObjValue @ptr
|
181
181
|
dblptr = Cbc.Cbc_getColSolution @ptr
|
182
|
-
|
183
|
-
variable_values = Hash[@variables.map do |var|
|
184
|
-
[var.index, values[var.index]]
|
185
|
-
end]
|
182
|
+
variable_values = dblptr.read_array_of_double(@variables.length)
|
186
183
|
else
|
187
184
|
objective_value = nil
|
188
|
-
variable_values =
|
185
|
+
variable_values = []
|
189
186
|
end
|
190
187
|
|
191
188
|
@solution = Solution.new status, objective_value, variable_values
|
data/lib/mipper/glpk/model.rb
CHANGED
@@ -123,13 +123,13 @@ module MIPPeR
|
|
123
123
|
|
124
124
|
if status == :optimized
|
125
125
|
objective_value = GLPK.glp_mip_obj_val @ptr
|
126
|
-
variable_values =
|
127
|
-
|
128
|
-
|
129
|
-
end
|
126
|
+
variable_values = [nil]
|
127
|
+
@variables.each do |var|
|
128
|
+
variable_values << GLPK.glp_mip_col_val(@ptr, var.index)
|
129
|
+
end
|
130
130
|
else
|
131
131
|
objective_value = nil
|
132
|
-
variable_values =
|
132
|
+
variable_values = []
|
133
133
|
end
|
134
134
|
|
135
135
|
@solution = Solution.new status, objective_value, variable_values
|
data/lib/mipper/gurobi/model.rb
CHANGED
@@ -208,16 +208,15 @@ module MIPPeR
|
|
208
208
|
|
209
209
|
if status == :optimized
|
210
210
|
objective_value = gurobi_objective
|
211
|
-
variable_values =
|
211
|
+
variable_values = @variables.map do |var|
|
212
212
|
dblptr = FFI::MemoryPointer.new :pointer
|
213
213
|
Gurobi.GRBgetdblattrarray @ptr, Gurobi::GRB_DBL_ATTR_X,
|
214
214
|
var.index, 1, dblptr
|
215
|
-
|
216
|
-
|
217
|
-
end]
|
215
|
+
dblptr.read_array_of_double(1)[0]
|
216
|
+
end
|
218
217
|
else
|
219
218
|
objective_value = nil
|
220
|
-
variable_values =
|
219
|
+
variable_values = []
|
221
220
|
end
|
222
221
|
|
223
222
|
@solution = Solution.new status, objective_value, variable_values
|
@@ -100,13 +100,14 @@ module MIPPeR
|
|
100
100
|
if status == :optimized
|
101
101
|
objective_value = LPSolve.get_objective @ptr
|
102
102
|
rows = LPSolve.get_Nrows(@ptr)
|
103
|
-
variable_values =
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
variable_values = [nil]
|
104
|
+
@variables.each do |var|
|
105
|
+
variable_values << LPSolve.get_var_primalresult(@ptr,
|
106
|
+
rows + var.index)
|
107
|
+
end
|
107
108
|
else
|
108
109
|
objective_value = nil
|
109
|
-
variable_values =
|
110
|
+
variable_values = []
|
110
111
|
end
|
111
112
|
|
112
113
|
@solution = Solution.new status, objective_value, variable_values
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Mior
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|