clp 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: d6e2766ba9c5090563dd6534448cafcddb24affc2914cfe428671c1974ab7a07
4
- data.tar.gz: 98d8951377b92b09c6df285e55117b7ac4d81c1836b54dcf9912b1ed059849de
3
+ metadata.gz: 1c01ab7d7209bb40c13fe725a54180e7001bd3eff8c406c83e9edb8fa0d686f9
4
+ data.tar.gz: 9a82639091ecc4cfb4029c7c4ff60ff3913b57cd010e2e21a67580a94b98e6ca
5
5
  SHA512:
6
- metadata.gz: dbe28bb36c4c55ed5d39d2f6be0c3a2302ff069662c03e3aff4b197a7a63db82cf1c7cac1b8e7ebb6ef9f6d5a840e9b7f964ff3fa8421b1d8b468d1d33eada48
7
- data.tar.gz: 5379acb441756aaec7d2c12e3685203c992cb4f14430a75c382fb8bca0e4fd5556012af71ff80f9f2c4cbfa0c77bae29e98cbfc3718e7c8599a0262823a04d6a
6
+ metadata.gz: e267c07368a63e59e45eceba7dc008b7192fd65ef33e8fe87ba2517f490a7727388414ad9640ccd1f6adc04613440513b77c911440e9205c7489234bc1ec4c8d
7
+ data.tar.gz: 21578e3dcd102e122ba217adfa41a1c6b6302d13cc26cb13ea054c64ea6c1181f7ae3200090884d24aa04914a284e476b8a13c8446dd0d0b8c3ff6b29f0241ab
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.1 (2022-04-06)
2
+
3
+ - Fixed shared library detection on Linux
4
+ - Fixed error with Clp < 1.17.2
5
+
1
6
  ## 0.1.0 (2022-04-05)
2
7
 
3
8
  - First release
data/README.md CHANGED
@@ -18,7 +18,7 @@ And for Ubuntu, use:
18
18
  sudo apt-get install coinor-libclp1
19
19
  ```
20
20
 
21
- Add this line to your application’s Gemfile:
21
+ Then add this line to your application’s Gemfile:
22
22
 
23
23
  ```ruby
24
24
  gem "clp"
@@ -51,7 +51,7 @@ Solve
51
51
  model.solve
52
52
  ```
53
53
 
54
- Write the problem to an MPS file
54
+ Write the problem to an MPS file (requires Clp 1.17.2+)
55
55
 
56
56
  ```ruby
57
57
  model.write_mps("hello.mps")
data/lib/clp/ffi.rb CHANGED
@@ -33,7 +33,9 @@ module Clp
33
33
  # load models
34
34
  extern "void Clp_loadProblem(Clp_Simplex *model, int numcols, int numrows, CoinBigIndex *start, int *index, double *value, double *collb, double *colub, double *obj, double *rowlb, double *rowub)"
35
35
  extern "int Clp_readMps(Clp_Simplex *model, char *filename, int keepNames, int ignoreErrors)"
36
- extern "int Clp_writeMps(Clp_Simplex *model, char *filename, int formatType, int numberAcross, double objSense)"
36
+ if Gem::Version.new(FFI.Clp_Version.to_s) >= Gem::Version.new("1.17.2")
37
+ extern "int Clp_writeMps(Clp_Simplex *model, char *filename, int formatType, int numberAcross, double objSense)"
38
+ end
37
39
 
38
40
  # getters and setters
39
41
  extern "int Clp_numberRows(Clp_Simplex *model)"
data/lib/clp/model.rb CHANGED
@@ -28,6 +28,9 @@ module Clp
28
28
  end
29
29
 
30
30
  def write_mps(filename)
31
+ unless FFI.respond_to?(:Clp_writeMps)
32
+ raise Error, "This feature requires Clp 1.17.2+"
33
+ end
31
34
  check_status FFI.Clp_writeMps(model, filename, 0, 1, 0)
32
35
  end
33
36
 
data/lib/clp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Clp
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/clp.rb CHANGED
@@ -13,13 +13,16 @@ module Clp
13
13
  end
14
14
  lib_name =
15
15
  if Gem.win_platform?
16
- "clp.dll"
16
+ # TODO test
17
+ ["Clp.dll"]
17
18
  elsif RbConfig::CONFIG["host_os"] =~ /darwin/i
18
- "libclp.dylib"
19
+ ["libClp.dylib"]
19
20
  else
20
- "libclp.so"
21
+ # coinor-libclp-dev has libClp.so
22
+ # coinor-libclp1 has libClp.so.1
23
+ ["libClp.so", "libClp.so.1"]
21
24
  end
22
- self.ffi_lib = [lib_name]
25
+ self.ffi_lib = lib_name
23
26
 
24
27
  # friendlier error message
25
28
  autoload :FFI, "clp/ffi"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane