cbc 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: 1d3dcf4c5bbcc2757b6b06c4e15dfcd898bc345b1b15b5633f760e0d3539e607
4
- data.tar.gz: a939b6d0d0b8694c5e6e8d3f8d737a07a263dc1decbb1cc0cedcf3795567fda9
3
+ metadata.gz: b77d0c48415a2615b0bf795b962bee34e7f2265306bdbf621a57fb1351206ecc
4
+ data.tar.gz: ed1ef4406e42333df474c5b1741ffa35a2653ba66f36a792246fa0b84de1419c
5
5
  SHA512:
6
- metadata.gz: 608d2f2389cf608e34be2ad1675016177630c28d95fcc3c6ad2643c7a45bca2cf535cc54319031c1037e79a1d09d86d51e77c7fc42705751ccf98c2f56ba6547
7
- data.tar.gz: 2e54fe9d70908e10d03d22119697f9c72d2589ba32defa1fafcf48244e0f44ef9a8c4416d548a2d6a522180f7371a71eec6f435327f17a0606d4f38a3a2726db
6
+ metadata.gz: 8b3d02b70ffd66a09f23e1694093f1479e0ddffee9117ece84ea641efadad458d6389ed0bafe6403e809f68b68c6f3e440909e4c067918ddec9d7f6feaa7c6e2
7
+ data.tar.gz: 611329db4f441e8717ec7b633b191b5569204b180934dae6e369fe81b0c766fcc2c6b09678dd5f6e5fdcd33a6365fdfb545710f2bc0ba7845a59fc7d55ea8d71
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.1 (2022-06-12)
2
+
3
+ - Fixed status
4
+
1
5
  ## 0.1.0 (2022-04-13)
2
6
 
3
7
  - First release
data/README.md CHANGED
@@ -52,15 +52,15 @@ Solve
52
52
  model.solve
53
53
  ```
54
54
 
55
- Write the problem to an LP or MPS file (LP requires Cbc 2.10.0+)
55
+ Write the problem to an LP or MPS file (LP requires Cbc 2.10+)
56
56
 
57
57
  ```ruby
58
58
  model.write_lp("hello.lp")
59
59
  # or
60
- model.write_mps("hello") # adds mps.gz
60
+ model.write_mps("hello") # adds .mps.gz
61
61
  ```
62
62
 
63
- Read a problem from an LP or MPS file (LP requires Cbc 2.10.0+)
63
+ Read a problem from an LP or MPS file (LP requires Cbc 2.10+)
64
64
 
65
65
  ```ruby
66
66
  model = Cbc.read_lp("hello.lp")
@@ -70,13 +70,13 @@ model = Cbc.read_mps("hello.mps.gz")
70
70
 
71
71
  ## Reference
72
72
 
73
- Set the log level (requires Cbc 2.10.0+)
73
+ Set the log level (requires Cbc 2.10+)
74
74
 
75
75
  ```ruby
76
76
  model.solve(log_level: 1) # 0 = off, 3 = max
77
77
  ```
78
78
 
79
- Set the time limit in seconds (requires Cbc 2.10.0+)
79
+ Set the time limit in seconds (requires Cbc 2.10+)
80
80
 
81
81
  ```ruby
82
82
  model.solve(time_limit: 30)
data/lib/cbc/ffi.rb CHANGED
@@ -66,7 +66,16 @@ module Cbc
66
66
  extern "int Cbc_isProvenOptimal(Cbc_Model *model)"
67
67
  extern "int Cbc_isProvenInfeasible(Cbc_Model *model)"
68
68
  extern "int Cbc_isContinuousUnbounded(Cbc_Model *model)"
69
+ extern "int Cbc_isNodeLimitReached(Cbc_Model * model)"
70
+ extern "int Cbc_isSecondsLimitReached(Cbc_Model * model)"
71
+ extern "int Cbc_isSolutionLimitReached(Cbc_Model * model)"
72
+ extern "int Cbc_isInitialSolveAbandoned(Cbc_Model * model)"
73
+ extern "int Cbc_isInitialSolveProvenOptimal(Cbc_Model * model)"
74
+ extern "int Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model)"
69
75
  extern "double Cbc_getObjValue(Cbc_Model *model)"
76
+ extern "double Cbc_getBestPossibleObjValue(Cbc_Model * model)"
77
+ extern "int Cbc_getNodeCount(Cbc_Model * model)"
78
+ extern "void Cbc_printSolution(Cbc_Model * model)"
70
79
  extern "int Cbc_status(Cbc_Model *model)"
71
80
  extern "int Cbc_secondaryStatus(Cbc_Model *model)"
72
81
 
data/lib/cbc/model.rb CHANGED
@@ -69,10 +69,18 @@ module Cbc
69
69
 
70
70
  ret_status =
71
71
  case status
72
- when :not_started, :finished
73
- if FFI.Cbc_isProvenOptimal(model)
72
+ when :not_started
73
+ if FFI.Cbc_isInitialSolveProvenOptimal(model) != 0
74
74
  :optimal
75
- elsif FFI.Cbc_isProvenInfeasible(model)
75
+ elsif FFI.Cbc_isInitialSolveProvenPrimalInfeasible(model) != 0
76
+ :primal_infeasible
77
+ else
78
+ secondary_status
79
+ end
80
+ when :finished
81
+ if FFI.Cbc_isProvenOptimal(model) != 0
82
+ :optimal
83
+ elsif FFI.Cbc_isProvenInfeasible(model) != 0
76
84
  :infeasible
77
85
  else
78
86
  secondary_status
data/lib/cbc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cbc
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbc
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
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-14 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org