cbc 0.1.0 → 0.1.1
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/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/lib/cbc/ffi.rb +9 -0
- data/lib/cbc/model.rb +11 -3
- data/lib/cbc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b77d0c48415a2615b0bf795b962bee34e7f2265306bdbf621a57fb1351206ecc
|
4
|
+
data.tar.gz: ed1ef4406e42333df474c5b1741ffa35a2653ba66f36a792246fa0b84de1419c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b3d02b70ffd66a09f23e1694093f1479e0ddffee9117ece84ea641efadad458d6389ed0bafe6403e809f68b68c6f3e440909e4c067918ddec9d7f6feaa7c6e2
|
7
|
+
data.tar.gz: 611329db4f441e8717ec7b633b191b5569204b180934dae6e369fe81b0c766fcc2c6b09678dd5f6e5fdcd33a6365fdfb545710f2bc0ba7845a59fc7d55ea8d71
|
data/CHANGELOG.md
CHANGED
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
|
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
|
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
|
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
|
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
|
73
|
-
if FFI.
|
72
|
+
when :not_started
|
73
|
+
if FFI.Cbc_isInitialSolveProvenOptimal(model) != 0
|
74
74
|
:optimal
|
75
|
-
elsif FFI.
|
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
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.
|
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-
|
11
|
+
date: 2022-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: andrew@ankane.org
|