mipper 0.0.8 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d16f46d5a09d8ff89563f7fbb92a54f257dbb901
4
- data.tar.gz: 67f1a0b959ec203c4f27911030d7b41e6db2265a
3
+ metadata.gz: 7287ac319911c87f47829488284ae00f4025dc90
4
+ data.tar.gz: 88886036462522fff9ccbb6352df3217bed26ca4
5
5
  SHA512:
6
- metadata.gz: 168c66e33986ff8822d988992991ea83dabd649ada9a7d7382e7106f041c148e17c711abcd669949729f3684890fc378071149b9c47b7b178b4ccc19fe267bb0
7
- data.tar.gz: ec215186c4ca682f8c7cf1391c8c074fe4e6ce805635b69b1bc393e1d66455d09c9b319485040064689044c53ba483b1402bed1f9357e85cc8452d37d48c8d46
6
+ metadata.gz: 13d92ca34c6786899b00dae5a8332e110f6b943504495c9fc54e726708dc1f3bf8f17a24a609b18a4b747374867cb43b0991a564fc293833369e785f91515897
7
+ data.tar.gz: 9a8c5d65132217994a1532ed8952e163bf07f19d276f28975ec447711ef2e859c8b6111a429ffaa35b776495db6c6033a0698ed31667fc4dc46751c03ab71269
@@ -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
- values = dblptr.read_array_of_double(@variables.length)
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
@@ -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 = Hash[@variables.map do |var|
127
- value = GLPK.glp_mip_col_val(@ptr, var.index)
128
- [var.index, value]
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
@@ -208,16 +208,15 @@ module MIPPeR
208
208
 
209
209
  if status == :optimized
210
210
  objective_value = gurobi_objective
211
- variable_values = Hash[@variables.map do |var|
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
- value = dblptr.read_array_of_double(1)[0]
216
- [var.index, value]
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 = Hash[@variables.map do |var|
104
- value = LPSolve.get_var_primalresult @ptr, rows + var.index
105
- [var.index, value]
106
- end]
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.8
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-10 00:00:00.000000000 Z
11
+ date: 2016-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi