cbc-wrapper 2.9.7
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE +239 -0
- data/README.md +397 -0
- data/Rakefile +38 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/cbc-wrapper.gemspec +34 -0
- data/ext/cbc-wrapper/cbc.i +15 -0
- data/ext/cbc-wrapper/cbc_wrap.c +4618 -0
- data/ext/cbc-wrapper/extconf.rb +51 -0
- data/ext/cbc-wrapper/install/.gitignore +4 -0
- data/lib/cbc-wrapper.rb +5 -0
- data/lib/cbc-wrapper/version.rb +3 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3176d8dfba6c230a803fb332c3cfd5bbe99e3490
|
4
|
+
data.tar.gz: a04e0e5ca7f307e43708ca1bfd5756a430dc0434
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3d0431ee7a3871cd7ef72097c998a987b5a7811d7983cc7b376470567f9f4bd77caeb64052d4db22c7299bf8db889791ffabf301fb881358b7c9de5f7d0948d1
|
7
|
+
data.tar.gz: 6c4d00bfebab09ac0197ab6d60e1c7d7e37b7c2e01d36a84a692e8edf3536554ce5e5b69056ba14a69cd2c39ca29f603cb78d52a3f8263a4d26bb04c664873af
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,239 @@
|
|
1
|
+
Eclipse Public License - v 1.0
|
2
|
+
|
3
|
+
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
|
4
|
+
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
|
5
|
+
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
6
|
+
|
7
|
+
1. DEFINITIONS
|
8
|
+
|
9
|
+
"Contribution" means:
|
10
|
+
|
11
|
+
a) in the case of the initial Contributor, the initial code and
|
12
|
+
documentation distributed under this Agreement, and
|
13
|
+
|
14
|
+
b) in the case of each subsequent Contributor:
|
15
|
+
|
16
|
+
i) changes to the Program, and
|
17
|
+
|
18
|
+
ii) additions to the Program;
|
19
|
+
|
20
|
+
where such changes and/or additions to the Program originate
|
21
|
+
from and are distributed by that particular Contributor. A
|
22
|
+
Contribution 'originates' from a Contributor if it was added to
|
23
|
+
the Program by such Contributor itself or anyone acting on such
|
24
|
+
Contributor's behalf. Contributions do not include additions to
|
25
|
+
the Program which: (i) are separate modules of software
|
26
|
+
distributed in conjunction with the Program under their own
|
27
|
+
license agreement, and (ii) are not derivative works of the
|
28
|
+
Program.
|
29
|
+
|
30
|
+
"Contributor" means any person or entity that distributes the
|
31
|
+
Program.
|
32
|
+
|
33
|
+
"Licensed Patents" mean patent claims licensable by a Contributor
|
34
|
+
which are necessarily infringed by the use or sale of its
|
35
|
+
Contribution alone or when combined with the Program.
|
36
|
+
|
37
|
+
"Program" means the Contributions distributed in accordance with
|
38
|
+
this Agreement.
|
39
|
+
|
40
|
+
"Recipient" means anyone who receives the Program under this
|
41
|
+
Agreement, including all Contributors.
|
42
|
+
|
43
|
+
2. GRANT OF RIGHTS
|
44
|
+
|
45
|
+
a) Subject to the terms of this Agreement, each Contributor hereby
|
46
|
+
grants Recipient a non-exclusive, worldwide, royalty-free copyright
|
47
|
+
license to reproduce, prepare derivative works of, publicly display,
|
48
|
+
publicly perform, distribute and sublicense the Contribution of such
|
49
|
+
Contributor, if any, and such derivative works, in source code and
|
50
|
+
object code form.
|
51
|
+
|
52
|
+
b) Subject to the terms of this Agreement, each Contributor hereby
|
53
|
+
grants Recipient a non-exclusive, worldwide, royalty-free patent
|
54
|
+
license under Licensed Patents to make, use, sell, offer to sell,
|
55
|
+
import and otherwise transfer the Contribution of such Contributor,
|
56
|
+
if any, in source code and object code form. This patent license
|
57
|
+
shall apply to the combination of the Contribution and the Program
|
58
|
+
if, at the time the Contribution is added by the Contributor, such
|
59
|
+
addition of the Contribution causes such combination to be covered
|
60
|
+
by the Licensed Patents. The patent license shall not apply to any
|
61
|
+
other combinations which include the Contribution. No hardware per
|
62
|
+
se is licensed hereunder.
|
63
|
+
|
64
|
+
c) Recipient understands that although each Contributor grants the
|
65
|
+
licenses to its Contributions set forth herein, no assurances are
|
66
|
+
provided by any Contributor that the Program does not infringe the
|
67
|
+
patent or other intellectual property rights of any other
|
68
|
+
entity. Each Contributor disclaims any liability to Recipient for
|
69
|
+
claims brought by any other entity based on infringement of
|
70
|
+
intellectual property rights or otherwise. As a condition to
|
71
|
+
exercising the rights and licenses granted hereunder, each Recipient
|
72
|
+
hereby assumes sole responsibility to secure any other intellectual
|
73
|
+
property rights needed, if any. For example, if a third party patent
|
74
|
+
license is required to allow Recipient to distribute the Program, it
|
75
|
+
is Recipient's responsibility to acquire that license before
|
76
|
+
distributing the Program.
|
77
|
+
|
78
|
+
d) Each Contributor represents that to its knowledge it has
|
79
|
+
sufficient copyright rights in its Contribution, if any, to grant
|
80
|
+
the copyright license set forth in this Agreement.
|
81
|
+
|
82
|
+
3. REQUIREMENTS
|
83
|
+
|
84
|
+
A Contributor may choose to distribute the Program in object code
|
85
|
+
form under its own license agreement, provided that:
|
86
|
+
|
87
|
+
a) it complies with the terms and conditions of this Agreement;
|
88
|
+
and
|
89
|
+
|
90
|
+
b) its license agreement:
|
91
|
+
|
92
|
+
i) effectively disclaims on behalf of all Contributors all
|
93
|
+
warranties and conditions, express and implied, including
|
94
|
+
warranties or conditions of title and non-infringement, and
|
95
|
+
implied warranties or conditions of merchantability and
|
96
|
+
fitness for a particular purpose;
|
97
|
+
|
98
|
+
ii) effectively excludes on behalf of all Contributors all
|
99
|
+
liability for damages, including direct, indirect, special,
|
100
|
+
incidental and consequential damages, such as lost profits;
|
101
|
+
|
102
|
+
iii) states that any provisions which differ from this
|
103
|
+
Agreement are offered by that Contributor alone and not by
|
104
|
+
any other party; and
|
105
|
+
|
106
|
+
iv) states that source code for the Program is available
|
107
|
+
from such Contributor, and informs licensees how to obtain
|
108
|
+
it in a reasonable manner on or through a medium customarily
|
109
|
+
used for software exchange.
|
110
|
+
|
111
|
+
When the Program is made available in source code form:
|
112
|
+
|
113
|
+
a) it must be made available under this Agreement; and
|
114
|
+
|
115
|
+
b) a copy of this Agreement must be included with each copy of
|
116
|
+
the Program.
|
117
|
+
|
118
|
+
Contributors may not remove or alter any copyright notices contained
|
119
|
+
within the Program.
|
120
|
+
|
121
|
+
Each Contributor must identify itself as the originator of its
|
122
|
+
Contribution, if any, in a manner that reasonably allows subsequent
|
123
|
+
Recipients to identify the originator of the Contribution.
|
124
|
+
|
125
|
+
4. COMMERCIAL DISTRIBUTION
|
126
|
+
|
127
|
+
Commercial distributors of software may accept certain
|
128
|
+
responsibilities with respect to end users, business partners and
|
129
|
+
the like. While this license is intended to facilitate the
|
130
|
+
commercial use of the Program, the Contributor who includes the
|
131
|
+
Program in a commercial product offering should do so in a manner
|
132
|
+
which does not create potential liability for other
|
133
|
+
Contributors. Therefore, if a Contributor includes the Program in a
|
134
|
+
commercial product offering, such Contributor ("Commercial
|
135
|
+
Contributor") hereby agrees to defend and indemnify every other
|
136
|
+
Contributor ("Indemnified Contributor") against any losses, damages
|
137
|
+
and costs (collectively "Losses") arising from claims, lawsuits and
|
138
|
+
other legal actions brought by a third party against the Indemnified
|
139
|
+
Contributor to the extent caused by the acts or omissions of such
|
140
|
+
Commercial Contributor in connection with its distribution of the
|
141
|
+
Program in a commercial product offering. The obligations in this
|
142
|
+
section do not apply to any claims or Losses relating to any actual
|
143
|
+
or alleged intellectual property infringement. In order to qualify,
|
144
|
+
an Indemnified Contributor must: a) promptly notify the Commercial
|
145
|
+
Contributor in writing of such claim, and b) allow the Commercial
|
146
|
+
Contributor to control, and cooperate with the Commercial
|
147
|
+
Contributor in, the defense and any related settlement
|
148
|
+
negotiations. The Indemnified Contributor may participate in any
|
149
|
+
such claim at its own expense.
|
150
|
+
|
151
|
+
For example, a Contributor might include the Program in a commercial
|
152
|
+
product offering, Product X. That Contributor is then a Commercial
|
153
|
+
Contributor. If that Commercial Contributor then makes performance
|
154
|
+
claims, or offers warranties related to Product X, those performance
|
155
|
+
claims and warranties are such Commercial Contributor's
|
156
|
+
responsibility alone. Under this section, the Commercial Contributor
|
157
|
+
would have to defend claims against the other Contributors related
|
158
|
+
to those performance claims and warranties, and if a court requires
|
159
|
+
any other Contributor to pay any damages as a result, the Commercial
|
160
|
+
Contributor must pay those damages.
|
161
|
+
|
162
|
+
5. NO WARRANTY
|
163
|
+
|
164
|
+
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
|
165
|
+
PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
166
|
+
ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
|
167
|
+
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
|
168
|
+
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient
|
169
|
+
is solely responsible for determining the appropriateness of using
|
170
|
+
and distributing the Program and assumes all risks associated with
|
171
|
+
its exercise of rights under this Agreement , including but not
|
172
|
+
limited to the risks and costs of program errors, compliance with
|
173
|
+
applicable laws, damage to or loss of data, programs or equipment,
|
174
|
+
and unavailability or interruption of operations.
|
175
|
+
|
176
|
+
6. DISCLAIMER OF LIABILITY
|
177
|
+
|
178
|
+
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
|
179
|
+
NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
|
180
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
181
|
+
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON
|
182
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
183
|
+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
184
|
+
THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
|
185
|
+
GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
186
|
+
DAMAGES.
|
187
|
+
|
188
|
+
7. GENERAL
|
189
|
+
|
190
|
+
If any provision of this Agreement is invalid or unenforceable under
|
191
|
+
applicable law, it shall not affect the validity or enforceability
|
192
|
+
of the remainder of the terms of this Agreement, and without further
|
193
|
+
action by the parties hereto, such provision shall be reformed to
|
194
|
+
the minimum extent necessary to make such provision valid and
|
195
|
+
enforceable.
|
196
|
+
|
197
|
+
If Recipient institutes patent litigation against any entity
|
198
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
199
|
+
the Program itself (excluding combinations of the Program with other
|
200
|
+
software or hardware) infringes such Recipient's patent(s), then
|
201
|
+
such Recipient's rights granted under Section 2(b) shall terminate
|
202
|
+
as of the date such litigation is filed.
|
203
|
+
|
204
|
+
All Recipient's rights under this Agreement shall terminate if it
|
205
|
+
fails to comply with any of the material terms or conditions of this
|
206
|
+
Agreement and does not cure such failure in a reasonable period of
|
207
|
+
time after becoming aware of such noncompliance. If all Recipient's
|
208
|
+
rights under this Agreement terminate, Recipient agrees to cease use
|
209
|
+
and distribution of the Program as soon as reasonably
|
210
|
+
practicable. However, Recipient's obligations under this Agreement
|
211
|
+
and any licenses granted by Recipient relating to the Program shall
|
212
|
+
continue and survive.
|
213
|
+
|
214
|
+
Everyone is permitted to copy and distribute copies of this
|
215
|
+
Agreement, but in order to avoid inconsistency the Agreement is
|
216
|
+
copyrighted and may only be modified in the following manner. The
|
217
|
+
Agreement Steward reserves the right to publish new versions
|
218
|
+
(including revisions) of this Agreement from time to time. No one
|
219
|
+
other than the Agreement Steward has the right to modify this
|
220
|
+
Agreement. The Eclipse Foundation is the initial Agreement
|
221
|
+
Steward. The Eclipse Foundation may assign the responsibility to
|
222
|
+
serve as the Agreement Steward to a suitable separate entity. Each
|
223
|
+
new version of the Agreement will be given a distinguishing version
|
224
|
+
number. The Program (including Contributions) may always be
|
225
|
+
distributed subject to the version of the Agreement under which it
|
226
|
+
was received. In addition, after a new version of the Agreement is
|
227
|
+
published, Contributor may elect to distribute the Program
|
228
|
+
(including its Contributions) under the new version. Except as
|
229
|
+
expressly stated in Sections 2(a) and 2(b) above, Recipient receives
|
230
|
+
no rights or licenses to the intellectual property of any
|
231
|
+
Contributor under this Agreement, whether expressly, by implication,
|
232
|
+
estoppel or otherwise. All rights in the Program not expressly
|
233
|
+
granted under this Agreement are reserved.
|
234
|
+
|
235
|
+
This Agreement is governed by the laws of the State of New York and
|
236
|
+
the intellectual property laws of the United States of America. No
|
237
|
+
party to this Agreement will bring a legal action under this
|
238
|
+
Agreement more than one year after the cause of action arose. Each
|
239
|
+
party waives its rights to a jury trial in any resulting litigation.
|
data/README.md
ADDED
@@ -0,0 +1,397 @@
|
|
1
|
+
# Cbc-Wrapper
|
2
|
+
|
3
|
+
This gem wraps the Coin-Or Cbc Mixed Integer Linear Programming Library.
|
4
|
+
It uses the version 2.9.7 of Cbc.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'cbc-wrapper'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install cbc-wrapper
|
21
|
+
|
22
|
+
The gem includes a version of the Coin-Or Cbc library. It downloads the library sources and
|
23
|
+
recompiles them at installation. (curl, make and some gcc tools are needed)
|
24
|
+
|
25
|
+
It also works on Heroku.
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
All functions defined in Cbc_C_interface.h are wrapped. You can use any function named
|
30
|
+
`func_name` with
|
31
|
+
```ruby
|
32
|
+
Cbc_wrapper.func_name
|
33
|
+
```
|
34
|
+
|
35
|
+
You can find an example on how to use it at https://github.com/gverger/ruby-cbc.
|
36
|
+
|
37
|
+
Below is the Cbc_C_interface.h file:
|
38
|
+
|
39
|
+
```c
|
40
|
+
/**@name Constructors and destructor
|
41
|
+
This is a "C" interface to Cbc.
|
42
|
+
The user does not need to know structure of Cbc_Model.
|
43
|
+
*/
|
44
|
+
/*@{*/
|
45
|
+
|
46
|
+
/** Default Cbc_Model constructor */
|
47
|
+
COINLIBAPI Cbc_Model * COINLINKAGE
|
48
|
+
Cbc_newModel(void)
|
49
|
+
;
|
50
|
+
/** Cbc_Model Destructor */
|
51
|
+
COINLIBAPI void COINLINKAGE
|
52
|
+
Cbc_deleteModel(Cbc_Model * model)
|
53
|
+
;
|
54
|
+
/** Current version of Cbc */
|
55
|
+
COINLIBAPI const char* COINLINKAGE Cbc_getVersion(void)
|
56
|
+
;
|
57
|
+
/*@}*/
|
58
|
+
|
59
|
+
/**@name Getting and setting model data
|
60
|
+
Note that problem access and modification methods,
|
61
|
+
such as getColLower and setColLower,
|
62
|
+
are *not valid* after calling Cbc_solve().
|
63
|
+
Therefore it is not recommended to reuse a Cbc_Model
|
64
|
+
object for multiple solves. A workaround is to call Cbc_clone()
|
65
|
+
before solving.
|
66
|
+
* */
|
67
|
+
/*@{*/
|
68
|
+
/** Loads a problem (the constraints on the
|
69
|
+
rows are given by lower and upper bounds). If a pointer is NULL then the
|
70
|
+
following values are the default:
|
71
|
+
<ul>
|
72
|
+
<li> <code>colub</code>: all columns have upper bound infinity
|
73
|
+
<li> <code>collb</code>: all columns have lower bound 0
|
74
|
+
<li> <code>rowub</code>: all rows have upper bound infinity
|
75
|
+
<li> <code>rowlb</code>: all rows have lower bound -infinity
|
76
|
+
<li> <code>obj</code>: all variables have 0 objective coefficient
|
77
|
+
</ul>
|
78
|
+
|
79
|
+
The constraint matrix is
|
80
|
+
given in standard compressed sparse column (without gaps).
|
81
|
+
<ul>
|
82
|
+
<li> <code>start[i]</code> stores the starting index of the ith column
|
83
|
+
<li> <code>index[k]</code> stores the row index of the kth nonzero element
|
84
|
+
<li> <code>value[k]</code> stores the coefficient of the kth nonzero element
|
85
|
+
</ul>
|
86
|
+
*/
|
87
|
+
COINLIBAPI void COINLINKAGE
|
88
|
+
Cbc_loadProblem (Cbc_Model * model, const int numcols, const int numrows,
|
89
|
+
const CoinBigIndex * start, const int* index,
|
90
|
+
const double* value,
|
91
|
+
const double* collb, const double* colub,
|
92
|
+
const double* obj,
|
93
|
+
const double* rowlb, const double* rowub)
|
94
|
+
;
|
95
|
+
/** Read an mps file from the given filename */
|
96
|
+
COINLIBAPI int COINLINKAGE
|
97
|
+
Cbc_readMps(Cbc_Model * model, const char *filename)
|
98
|
+
;
|
99
|
+
/** Write an mps file from the given filename */
|
100
|
+
COINLIBAPI void COINLINKAGE
|
101
|
+
Cbc_writeMps(Cbc_Model * model, const char *filename)
|
102
|
+
;
|
103
|
+
/** Provide an initial feasible solution to accelerate branch-and-bound
|
104
|
+
Note that feasibility of the solution is *not* verified.
|
105
|
+
*/
|
106
|
+
COINLIBAPI void COINLINKAGE
|
107
|
+
Cbc_setInitialSolution(Cbc_Model *model, const double * sol)
|
108
|
+
;
|
109
|
+
/** Fills in array with problem name */
|
110
|
+
COINLIBAPI void COINLINKAGE
|
111
|
+
Cbc_problemName(Cbc_Model * model, int maxNumberCharacters, char * array)
|
112
|
+
;
|
113
|
+
/** Sets problem name.
|
114
|
+
|
115
|
+
\p array must be a null-terminated string.
|
116
|
+
*/
|
117
|
+
COINLIBAPI int COINLINKAGE
|
118
|
+
Cbc_setProblemName(Cbc_Model * model, const char * array)
|
119
|
+
;
|
120
|
+
|
121
|
+
/** Number of nonzero elements in constraint matrix */
|
122
|
+
COINLIBAPI int COINLINKAGE
|
123
|
+
Cbc_getNumElements(Cbc_Model * model)
|
124
|
+
;
|
125
|
+
/** "Column start" vector of constraint matrix. Same format as Cbc_loadProblem() */
|
126
|
+
COINLIBAPI const CoinBigIndex * COINLINKAGE
|
127
|
+
Cbc_getVectorStarts(Cbc_Model * model)
|
128
|
+
;
|
129
|
+
/** "Row index" vector of constraint matrix */
|
130
|
+
COINLIBAPI const int * COINLINKAGE
|
131
|
+
Cbc_getIndices(Cbc_Model * model)
|
132
|
+
;
|
133
|
+
/** Coefficient vector of constraint matrix */
|
134
|
+
COINLIBAPI const double * COINLINKAGE
|
135
|
+
Cbc_getElements(Cbc_Model * model)
|
136
|
+
;
|
137
|
+
|
138
|
+
/** Maximum lenght of a row or column name */
|
139
|
+
COINLIBAPI size_t COINLINKAGE
|
140
|
+
Cbc_maxNameLength(Cbc_Model * model)
|
141
|
+
;
|
142
|
+
/** Fill in first maxLength bytes of name array with a row name */
|
143
|
+
COINLIBAPI void COINLINKAGE
|
144
|
+
Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength)
|
145
|
+
;
|
146
|
+
/** Fill in first maxLength bytes of name array with a column name */
|
147
|
+
COINLIBAPI void COINLINKAGE
|
148
|
+
Cbc_getColName(Cbc_Model * model, int iColumn, char * name, size_t maxLength)
|
149
|
+
;
|
150
|
+
/** Set the name of a column */
|
151
|
+
COINLIBAPI void COINLINKAGE
|
152
|
+
Cbc_setColName(Cbc_Model * model, int iColumn, const char * name)
|
153
|
+
;
|
154
|
+
/** Set the name of a row */
|
155
|
+
COINLIBAPI void COINLINKAGE
|
156
|
+
Cbc_setRowName(Cbc_Model * model, int iRow, const char * name)
|
157
|
+
;
|
158
|
+
/** Number of constraints in the model */
|
159
|
+
COINLIBAPI int COINLINKAGE
|
160
|
+
Cbc_getNumRows(Cbc_Model * model)
|
161
|
+
;
|
162
|
+
/** Number of variables in the model */
|
163
|
+
COINLIBAPI int COINLINKAGE
|
164
|
+
Cbc_getNumCols(Cbc_Model * model)
|
165
|
+
;
|
166
|
+
/** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
|
167
|
+
COINLIBAPI void COINLINKAGE
|
168
|
+
Cbc_setObjSense(Cbc_Model * model, double sense)
|
169
|
+
;
|
170
|
+
/** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
|
171
|
+
COINLIBAPI double COINLINKAGE
|
172
|
+
Cbc_getObjSense(Cbc_Model * model)
|
173
|
+
;
|
174
|
+
/** Constraint lower bounds */
|
175
|
+
COINLIBAPI const double* COINLINKAGE
|
176
|
+
Cbc_getRowLower(Cbc_Model * model)
|
177
|
+
;
|
178
|
+
/** Set the lower bound of a single constraint */
|
179
|
+
COINLIBAPI void COINLINKAGE
|
180
|
+
Cbc_setRowLower(Cbc_Model * model, int index, double value)
|
181
|
+
;
|
182
|
+
/** Constraint upper bounds */
|
183
|
+
COINLIBAPI const double* COINLINKAGE
|
184
|
+
Cbc_getRowUpper(Cbc_Model * model)
|
185
|
+
;
|
186
|
+
/** Set the upper bound of a single constraint */
|
187
|
+
COINLIBAPI void COINLINKAGE
|
188
|
+
Cbc_setRowUpper(Cbc_Model * model, int index, double value)
|
189
|
+
;
|
190
|
+
/** Objective vector */
|
191
|
+
COINLIBAPI const double * COINLINKAGE
|
192
|
+
Cbc_getObjCoefficients(Cbc_Model * model)
|
193
|
+
;
|
194
|
+
/** Set the objective coefficient of a single variable */
|
195
|
+
COINLIBAPI void COINLINKAGE
|
196
|
+
Cbc_setObjCoeff(Cbc_Model * model, int index, double value)
|
197
|
+
;
|
198
|
+
/** Variable lower bounds */
|
199
|
+
COINLIBAPI const double * COINLINKAGE
|
200
|
+
Cbc_getColLower(Cbc_Model * model)
|
201
|
+
;
|
202
|
+
/** Set the lower bound of a single variable */
|
203
|
+
COINLIBAPI void COINLINKAGE
|
204
|
+
Cbc_setColLower(Cbc_Model * model, int index, double value)
|
205
|
+
;
|
206
|
+
/** Variable upper bounds */
|
207
|
+
COINLIBAPI const double * COINLINKAGE
|
208
|
+
Cbc_getColUpper(Cbc_Model * model)
|
209
|
+
;
|
210
|
+
/** Set the upper bound of a single variable */
|
211
|
+
COINLIBAPI void COINLINKAGE
|
212
|
+
Cbc_setColUpper(Cbc_Model * model, int index, double value)
|
213
|
+
;
|
214
|
+
/** Determine whether the ith variable is integer restricted */
|
215
|
+
COINLIBAPI int COINLINKAGE
|
216
|
+
Cbc_isInteger(Cbc_Model * model, int i)
|
217
|
+
;
|
218
|
+
/** Set this variable to be continuous */
|
219
|
+
COINLIBAPI void COINLINKAGE
|
220
|
+
Cbc_setContinuous(Cbc_Model * model, int iColumn)
|
221
|
+
;
|
222
|
+
/** Set this variable to be integer */
|
223
|
+
COINLIBAPI void COINLINKAGE
|
224
|
+
Cbc_setInteger(Cbc_Model * model, int iColumn)
|
225
|
+
;
|
226
|
+
/** Add SOS constraints to the model using row-order matrix */
|
227
|
+
COINLIBAPI void COINLINKAGE
|
228
|
+
Cbc_addSOS(Cbc_Model * model, int numRows, const int * rowStarts,
|
229
|
+
const int * colIndices, const double * weights, const int type)
|
230
|
+
;
|
231
|
+
/** Print the model */
|
232
|
+
COINLIBAPI void COINLINKAGE
|
233
|
+
Cbc_printModel(Cbc_Model * model, const char * argPrefix)
|
234
|
+
;
|
235
|
+
/** Return a copy of this model */
|
236
|
+
COINLIBAPI Cbc_Model * COINLINKAGE
|
237
|
+
Cbc_clone(Cbc_Model * model)
|
238
|
+
;
|
239
|
+
/*@}*/
|
240
|
+
/**@name Solver parameters */
|
241
|
+
/*@{*/
|
242
|
+
/** Set parameter "name" to value "value". Note that this
|
243
|
+
* translates directly to using "-name value" as a
|
244
|
+
* command-line argument to Cbc.*/
|
245
|
+
COINLIBAPI void COINLINKAGE
|
246
|
+
Cbc_setParameter(Cbc_Model * model, const char * name, const char * value)
|
247
|
+
;
|
248
|
+
|
249
|
+
|
250
|
+
/*@}*/
|
251
|
+
/**@name Message handling. Call backs are handled by ONE function */
|
252
|
+
/*@{*/
|
253
|
+
/** Pass in Callback function.
|
254
|
+
Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */
|
255
|
+
COINLIBAPI void COINLINKAGE
|
256
|
+
Cbc_registerCallBack(Cbc_Model * model,
|
257
|
+
cbc_callback userCallBack)
|
258
|
+
;
|
259
|
+
/** Unset Callback function */
|
260
|
+
COINLIBAPI void COINLINKAGE
|
261
|
+
Cbc_clearCallBack(Cbc_Model * model)
|
262
|
+
;
|
263
|
+
|
264
|
+
/*@}*/
|
265
|
+
|
266
|
+
|
267
|
+
/**@name Solving the model */
|
268
|
+
/*@{*/
|
269
|
+
/* Solve the model with Cbc (using CbcMain1).
|
270
|
+
*/
|
271
|
+
COINLIBAPI int COINLINKAGE
|
272
|
+
Cbc_solve(Cbc_Model * model)
|
273
|
+
;
|
274
|
+
/*@}*/
|
275
|
+
|
276
|
+
|
277
|
+
/**@name Accessing the solution and solution status */
|
278
|
+
/*@{*/
|
279
|
+
|
280
|
+
/** Sum of primal infeasibilities */
|
281
|
+
COINLIBAPI double COINLINKAGE
|
282
|
+
Cbc_sumPrimalInfeasibilities(Cbc_Model * model)
|
283
|
+
;
|
284
|
+
/** Number of primal infeasibilities */
|
285
|
+
COINLIBAPI int COINLINKAGE
|
286
|
+
Cbc_numberPrimalInfeasibilities(Cbc_Model * model)
|
287
|
+
;
|
288
|
+
|
289
|
+
/** Just check solution (for external use) - sets sum of
|
290
|
+
infeasibilities etc */
|
291
|
+
COINLIBAPI void COINLINKAGE
|
292
|
+
Cbc_checkSolution(Cbc_Model * model)
|
293
|
+
;
|
294
|
+
|
295
|
+
/** Number of iterations */
|
296
|
+
COINLIBAPI int COINLINKAGE
|
297
|
+
Cbc_getIterationCount(Cbc_Model * model)
|
298
|
+
;
|
299
|
+
/** Are there a numerical difficulties? */
|
300
|
+
COINLIBAPI int COINLINKAGE
|
301
|
+
Cbc_isAbandoned(Cbc_Model * model)
|
302
|
+
;
|
303
|
+
/** Is optimality proven? */
|
304
|
+
COINLIBAPI int COINLINKAGE
|
305
|
+
Cbc_isProvenOptimal(Cbc_Model * model)
|
306
|
+
;
|
307
|
+
/** Is infeasiblity proven (or none better than cutoff)? */
|
308
|
+
COINLIBAPI int COINLINKAGE
|
309
|
+
Cbc_isProvenInfeasible(Cbc_Model * model)
|
310
|
+
;
|
311
|
+
/** Was continuous solution unbounded? */
|
312
|
+
COINLIBAPI int COINLINKAGE
|
313
|
+
Cbc_isContinuousUnbounded(Cbc_Model * model)
|
314
|
+
;
|
315
|
+
/** Node limit reached? */
|
316
|
+
COINLIBAPI int COINLINKAGE
|
317
|
+
Cbc_isNodeLimitReached(Cbc_Model * model)
|
318
|
+
;
|
319
|
+
/** Time limit reached? */
|
320
|
+
COINLIBAPI int COINLINKAGE
|
321
|
+
Cbc_isSecondsLimitReached(Cbc_Model * model)
|
322
|
+
;
|
323
|
+
/** Solution limit reached? */
|
324
|
+
COINLIBAPI int COINLINKAGE
|
325
|
+
Cbc_isSolutionLimitReached(Cbc_Model * model)
|
326
|
+
;
|
327
|
+
/** Are there numerical difficulties (for initialSolve) ? */
|
328
|
+
COINLIBAPI int COINLINKAGE
|
329
|
+
Cbc_isInitialSolveAbandoned(Cbc_Model * model)
|
330
|
+
;
|
331
|
+
/** Is optimality proven (for initialSolve) ? */
|
332
|
+
COINLIBAPI int COINLINKAGE
|
333
|
+
Cbc_isInitialSolveProvenOptimal(Cbc_Model * model)
|
334
|
+
;
|
335
|
+
/** Is primal infeasiblity proven (for initialSolve) ? */
|
336
|
+
COINLIBAPI int COINLINKAGE
|
337
|
+
Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model)
|
338
|
+
;
|
339
|
+
/** "row" solution
|
340
|
+
* This is the vector A*x, where A is the constraint matrix
|
341
|
+
* and x is the current solution. */
|
342
|
+
COINLIBAPI const double * COINLINKAGE
|
343
|
+
Cbc_getRowActivity(Cbc_Model * model)
|
344
|
+
;
|
345
|
+
/** Best feasible solution vector */
|
346
|
+
COINLIBAPI const double * COINLINKAGE
|
347
|
+
Cbc_getColSolution(Cbc_Model * model)
|
348
|
+
;
|
349
|
+
/** Objective value of best feasible solution */
|
350
|
+
COINLIBAPI double COINLINKAGE
|
351
|
+
Cbc_getObjValue(Cbc_Model * model)
|
352
|
+
;
|
353
|
+
/** Best known bound on the optimal objective value */
|
354
|
+
COINLIBAPI double COINLINKAGE
|
355
|
+
Cbc_getBestPossibleObjValue(Cbc_Model * model)
|
356
|
+
;
|
357
|
+
/** Number of nodes explored in B&B tree */
|
358
|
+
COINLIBAPI int COINLINKAGE
|
359
|
+
Cbc_getNodeCount(Cbc_Model * model)
|
360
|
+
;
|
361
|
+
/** Print the solution */
|
362
|
+
COINLIBAPI void COINLINKAGE
|
363
|
+
Cbc_printSolution(Cbc_Model * model)
|
364
|
+
;
|
365
|
+
/** Final status of problem
|
366
|
+
Some of these can be found out by is...... functions
|
367
|
+
-1 before branchAndBound
|
368
|
+
0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
|
369
|
+
(or check value of best solution)
|
370
|
+
1 stopped - on maxnodes, maxsols, maxtime
|
371
|
+
2 difficulties so run was abandoned
|
372
|
+
(5 event user programmed event occurred)
|
373
|
+
*/
|
374
|
+
COINLIBAPI int COINLINKAGE
|
375
|
+
Cbc_status(Cbc_Model * model)
|
376
|
+
;
|
377
|
+
/** Secondary status of problem
|
378
|
+
-1 unset (status_ will also be -1)
|
379
|
+
0 search completed with solution
|
380
|
+
1 linear relaxation not feasible (or worse than cutoff)
|
381
|
+
2 stopped on gap
|
382
|
+
3 stopped on nodes
|
383
|
+
4 stopped on time
|
384
|
+
5 stopped on user event
|
385
|
+
6 stopped on solutions
|
386
|
+
7 linear relaxation unbounded
|
387
|
+
8 stopped on iteration limit
|
388
|
+
*/
|
389
|
+
COINLIBAPI int COINLINKAGE
|
390
|
+
Cbc_secondaryStatus(Cbc_Model * model)
|
391
|
+
;
|
392
|
+
```
|
393
|
+
|
394
|
+
## Contributing
|
395
|
+
|
396
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gverger/cbc-wrapper.
|
397
|
+
|