cbc-wrapper 2.9.9.3 → 2.9.9.4

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
  SHA256:
3
- metadata.gz: c8f75c7d0096c67f7831288ba4d3980472064b6522a10bdd573b234399160963
4
- data.tar.gz: 43eaa1c4a90af199583b684b8c31518fe5a194f4f8407a93e5564d16baf4ef8f
3
+ metadata.gz: bca684c17d92a3b6d542eee04439dc74acbade2d919781dd6271ec1e414a86bf
4
+ data.tar.gz: cb864b4a0a3069b1601eb0e57e42ef51f80f01ea5553a584d27e03d9033687da
5
5
  SHA512:
6
- metadata.gz: 25012ff30d3ad3a30a66f8df6bbddb46af8b9d6b34621edd0e2f69aa737fc46966773f3c1e7eef312a67b580f6283276bcdbdf2872e713dfc808f7f751d2dc1b
7
- data.tar.gz: 3548e2ef4c6c41f8d4df0b47314c8edb2897815899525cc1339aae5321567a2f6f740fc37bf97068add46aa2f180d568bcd096083db720bf92488a2fd83d7a63
6
+ metadata.gz: 9d99b8c6f5caa89fe61647ed34239e22529776eb05eebe6194da68ddbadc80ef53921d1947ee1dc25d31cfc10ff47b89bec2961c3d34572f751ab7991107da2a
7
+ data.tar.gz: 668e7b649e8ba559caef3192f77892f8bdcebf915001f39e12817e4fd7a377af96c5af8689aecbd2fd86d01dec1421db7a7fb8adc6a89f7769fa34532ebc30a5
data/.gitignore CHANGED
@@ -7,3 +7,8 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /ext/cbc-wrapper/Makefile
11
+ /ext/cbc-wrapper/mkmf.log
12
+ ext/cbc-wrapper/*.o
13
+ ext/cbc-wrapper/*.so
14
+ ext/cbc-wrapper/*.bundle
data/README.md CHANGED
@@ -5,6 +5,8 @@ It uses the version 2.9.9 of Cbc.
5
5
 
6
6
  ## Installation
7
7
 
8
+ This gem requires you to have Cbc installed on your system first.
9
+
8
10
  Add this line to your application's Gemfile:
9
11
 
10
12
  ```ruby
@@ -19,10 +21,8 @@ Or install it yourself as:
19
21
 
20
22
  $ gem install cbc-wrapper
21
23
 
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.
24
+ WARNING: if you want the gem to download and compile the library sources when installing the gem,
25
+ you will need to use a lesser version of it (2.9.9.3).
26
26
 
27
27
  ## Usage
28
28
 
@@ -4,12 +4,12 @@
4
4
  %include "carrays.i"
5
5
 
6
6
  %{
7
- #include "Coin_C_defines.h"
8
- #include "Cbc_C_Interface.h"
7
+ #include "coin/Coin_C_defines.h"
8
+ #include "coin/Cbc_C_Interface.h"
9
9
  %}
10
10
 
11
11
  %array_class(int, IntArray)
12
12
  %array_class(double, DoubleArray)
13
13
 
14
- %include "Coin_C_defines.h"
15
- %include "Cbc_C_Interface.h"
14
+ %include "coin/Coin_C_defines.h"
15
+ %include "coin/Cbc_C_Interface.h"
@@ -1851,8 +1851,8 @@ struct timeval rb_time_timeval(VALUE);
1851
1851
  #endif
1852
1852
 
1853
1853
 
1854
- #include "Coin_C_defines.h"
1855
- #include "Cbc_C_Interface.h"
1854
+ #include "coin/Coin_C_defines.h"
1855
+ #include "coin/Cbc_C_Interface.h"
1856
1856
 
1857
1857
 
1858
1858
  typedef int IntArray;
@@ -0,0 +1,381 @@
1
+ /* $Id$ */
2
+ /*
3
+ Copyright (C) 2004 International Business Machines Corporation and others.
4
+ All Rights Reserved.
5
+
6
+ This code is licensed under the terms of the Eclipse Public License (EPL).
7
+ */
8
+ #ifndef CbcModelC_H
9
+ #define CbcModelC_H
10
+
11
+ /* include all defines and ugly stuff */
12
+ #include "Coin_C_defines.h"
13
+ #include <stddef.h>
14
+
15
+ /*
16
+ * Original verison contributed by Bob Entriken,
17
+ * significantly updated by Miles Lubin.
18
+ */
19
+
20
+
21
+ #ifdef __cplusplus
22
+ extern "C" {
23
+ #endif
24
+
25
+ /**@name Constructors and destructor
26
+ This is a "C" interface to Cbc.
27
+ The user does not need to know structure of Cbc_Model.
28
+ */
29
+ /*@{*/
30
+
31
+ /** Default Cbc_Model constructor */
32
+ COINLIBAPI Cbc_Model * COINLINKAGE
33
+ Cbc_newModel(void)
34
+ ;
35
+ /** Cbc_Model Destructor */
36
+ COINLIBAPI void COINLINKAGE
37
+ Cbc_deleteModel(Cbc_Model * model)
38
+ ;
39
+ /** Current version of Cbc */
40
+ COINLIBAPI const char* COINLINKAGE Cbc_getVersion(void)
41
+ ;
42
+ /*@}*/
43
+
44
+ /**@name Getting and setting model data
45
+ Note that problem access and modification methods,
46
+ such as getColLower and setColLower,
47
+ are *not valid* after calling Cbc_solve().
48
+ Therefore it is not recommended to reuse a Cbc_Model
49
+ object for multiple solves. A workaround is to call Cbc_clone()
50
+ before solving.
51
+ * */
52
+ /*@{*/
53
+ /** Loads a problem (the constraints on the
54
+ rows are given by lower and upper bounds). If a pointer is NULL then the
55
+ following values are the default:
56
+ <ul>
57
+ <li> <code>colub</code>: all columns have upper bound infinity
58
+ <li> <code>collb</code>: all columns have lower bound 0
59
+ <li> <code>rowub</code>: all rows have upper bound infinity
60
+ <li> <code>rowlb</code>: all rows have lower bound -infinity
61
+ <li> <code>obj</code>: all variables have 0 objective coefficient
62
+ </ul>
63
+
64
+ The constraint matrix is
65
+ given in standard compressed sparse column (without gaps).
66
+ <ul>
67
+ <li> <code>start[i]</code> stores the starting index of the ith column
68
+ <li> <code>index[k]</code> stores the row index of the kth nonzero element
69
+ <li> <code>value[k]</code> stores the coefficient of the kth nonzero element
70
+ </ul>
71
+ */
72
+ COINLIBAPI void COINLINKAGE
73
+ Cbc_loadProblem (Cbc_Model * model, const int numcols, const int numrows,
74
+ const CoinBigIndex * start, const int* index,
75
+ const double* value,
76
+ const double* collb, const double* colub,
77
+ const double* obj,
78
+ const double* rowlb, const double* rowub)
79
+ ;
80
+ /** Read an mps file from the given filename */
81
+ COINLIBAPI int COINLINKAGE
82
+ Cbc_readMps(Cbc_Model * model, const char *filename)
83
+ ;
84
+ /** Write an mps file from the given filename */
85
+ COINLIBAPI void COINLINKAGE
86
+ Cbc_writeMps(Cbc_Model * model, const char *filename)
87
+ ;
88
+ /** Provide an initial feasible solution to accelerate branch-and-bound
89
+ Note that feasibility of the solution is *not* verified.
90
+ */
91
+ COINLIBAPI void COINLINKAGE
92
+ Cbc_setInitialSolution(Cbc_Model *model, const double * sol)
93
+ ;
94
+ /** Fills in array with problem name */
95
+ COINLIBAPI void COINLINKAGE
96
+ Cbc_problemName(Cbc_Model * model, int maxNumberCharacters, char * array)
97
+ ;
98
+ /** Sets problem name.
99
+
100
+ \p array must be a null-terminated string.
101
+ */
102
+ COINLIBAPI int COINLINKAGE
103
+ Cbc_setProblemName(Cbc_Model * model, const char * array)
104
+ ;
105
+
106
+ /** Number of nonzero elements in constraint matrix */
107
+ COINLIBAPI int COINLINKAGE
108
+ Cbc_getNumElements(Cbc_Model * model)
109
+ ;
110
+ /** "Column start" vector of constraint matrix. Same format as Cbc_loadProblem() */
111
+ COINLIBAPI const CoinBigIndex * COINLINKAGE
112
+ Cbc_getVectorStarts(Cbc_Model * model)
113
+ ;
114
+ /** "Row index" vector of constraint matrix */
115
+ COINLIBAPI const int * COINLINKAGE
116
+ Cbc_getIndices(Cbc_Model * model)
117
+ ;
118
+ /** Coefficient vector of constraint matrix */
119
+ COINLIBAPI const double * COINLINKAGE
120
+ Cbc_getElements(Cbc_Model * model)
121
+ ;
122
+
123
+ /** Maximum lenght of a row or column name */
124
+ COINLIBAPI size_t COINLINKAGE
125
+ Cbc_maxNameLength(Cbc_Model * model)
126
+ ;
127
+ /** Fill in first maxLength bytes of name array with a row name */
128
+ COINLIBAPI void COINLINKAGE
129
+ Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength)
130
+ ;
131
+ /** Fill in first maxLength bytes of name array with a column name */
132
+ COINLIBAPI void COINLINKAGE
133
+ Cbc_getColName(Cbc_Model * model, int iColumn, char * name, size_t maxLength)
134
+ ;
135
+ /** Set the name of a column */
136
+ COINLIBAPI void COINLINKAGE
137
+ Cbc_setColName(Cbc_Model * model, int iColumn, const char * name)
138
+ ;
139
+ /** Set the name of a row */
140
+ COINLIBAPI void COINLINKAGE
141
+ Cbc_setRowName(Cbc_Model * model, int iRow, const char * name)
142
+ ;
143
+ /** Number of constraints in the model */
144
+ COINLIBAPI int COINLINKAGE
145
+ Cbc_getNumRows(Cbc_Model * model)
146
+ ;
147
+ /** Number of variables in the model */
148
+ COINLIBAPI int COINLINKAGE
149
+ Cbc_getNumCols(Cbc_Model * model)
150
+ ;
151
+ /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
152
+ COINLIBAPI void COINLINKAGE
153
+ Cbc_setObjSense(Cbc_Model * model, double sense)
154
+ ;
155
+ /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
156
+ COINLIBAPI double COINLINKAGE
157
+ Cbc_getObjSense(Cbc_Model * model)
158
+ ;
159
+ /** Constraint lower bounds */
160
+ COINLIBAPI const double* COINLINKAGE
161
+ Cbc_getRowLower(Cbc_Model * model)
162
+ ;
163
+ /** Set the lower bound of a single constraint */
164
+ COINLIBAPI void COINLINKAGE
165
+ Cbc_setRowLower(Cbc_Model * model, int index, double value)
166
+ ;
167
+ /** Constraint upper bounds */
168
+ COINLIBAPI const double* COINLINKAGE
169
+ Cbc_getRowUpper(Cbc_Model * model)
170
+ ;
171
+ /** Set the upper bound of a single constraint */
172
+ COINLIBAPI void COINLINKAGE
173
+ Cbc_setRowUpper(Cbc_Model * model, int index, double value)
174
+ ;
175
+ /** Objective vector */
176
+ COINLIBAPI const double * COINLINKAGE
177
+ Cbc_getObjCoefficients(Cbc_Model * model)
178
+ ;
179
+ /** Set the objective coefficient of a single variable */
180
+ COINLIBAPI void COINLINKAGE
181
+ Cbc_setObjCoeff(Cbc_Model * model, int index, double value)
182
+ ;
183
+ /** Variable lower bounds */
184
+ COINLIBAPI const double * COINLINKAGE
185
+ Cbc_getColLower(Cbc_Model * model)
186
+ ;
187
+ /** Set the lower bound of a single variable */
188
+ COINLIBAPI void COINLINKAGE
189
+ Cbc_setColLower(Cbc_Model * model, int index, double value)
190
+ ;
191
+ /** Variable upper bounds */
192
+ COINLIBAPI const double * COINLINKAGE
193
+ Cbc_getColUpper(Cbc_Model * model)
194
+ ;
195
+ /** Set the upper bound of a single variable */
196
+ COINLIBAPI void COINLINKAGE
197
+ Cbc_setColUpper(Cbc_Model * model, int index, double value)
198
+ ;
199
+ /** Determine whether the ith variable is integer restricted */
200
+ COINLIBAPI int COINLINKAGE
201
+ Cbc_isInteger(Cbc_Model * model, int i)
202
+ ;
203
+ /** Set this variable to be continuous */
204
+ COINLIBAPI void COINLINKAGE
205
+ Cbc_setContinuous(Cbc_Model * model, int iColumn)
206
+ ;
207
+ /** Set this variable to be integer */
208
+ COINLIBAPI void COINLINKAGE
209
+ Cbc_setInteger(Cbc_Model * model, int iColumn)
210
+ ;
211
+ /** Add SOS constraints to the model using row-order matrix */
212
+ COINLIBAPI void COINLINKAGE
213
+ Cbc_addSOS(Cbc_Model * model, int numRows, const int * rowStarts,
214
+ const int * colIndices, const double * weights, const int type)
215
+ ;
216
+ /** Print the model */
217
+ COINLIBAPI void COINLINKAGE
218
+ Cbc_printModel(Cbc_Model * model, const char * argPrefix)
219
+ ;
220
+ /** Return a copy of this model */
221
+ COINLIBAPI Cbc_Model * COINLINKAGE
222
+ Cbc_clone(Cbc_Model * model)
223
+ ;
224
+ /*@}*/
225
+ /**@name Solver parameters */
226
+ /*@{*/
227
+ /** Set parameter "name" to value "value". Note that this
228
+ * translates directly to using "-name value" as a
229
+ * command-line argument to Cbc.*/
230
+ COINLIBAPI void COINLINKAGE
231
+ Cbc_setParameter(Cbc_Model * model, const char * name, const char * value)
232
+ ;
233
+
234
+
235
+ /*@}*/
236
+ /**@name Message handling. Call backs are handled by ONE function */
237
+ /*@{*/
238
+ /** Pass in Callback function.
239
+ Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */
240
+ COINLIBAPI void COINLINKAGE
241
+ Cbc_registerCallBack(Cbc_Model * model,
242
+ cbc_callback userCallBack)
243
+ ;
244
+ /** Unset Callback function */
245
+ COINLIBAPI void COINLINKAGE
246
+ Cbc_clearCallBack(Cbc_Model * model)
247
+ ;
248
+
249
+ /*@}*/
250
+
251
+
252
+ /**@name Solving the model */
253
+ /*@{*/
254
+ /* Solve the model with Cbc (using CbcMain1).
255
+ */
256
+ COINLIBAPI int COINLINKAGE
257
+ Cbc_solve(Cbc_Model * model)
258
+ ;
259
+ /*@}*/
260
+
261
+
262
+ /**@name Accessing the solution and solution status */
263
+ /*@{*/
264
+
265
+ /** Sum of primal infeasibilities */
266
+ COINLIBAPI double COINLINKAGE
267
+ Cbc_sumPrimalInfeasibilities(Cbc_Model * model)
268
+ ;
269
+ /** Number of primal infeasibilities */
270
+ COINLIBAPI int COINLINKAGE
271
+ Cbc_numberPrimalInfeasibilities(Cbc_Model * model)
272
+ ;
273
+
274
+ /** Just check solution (for external use) - sets sum of
275
+ infeasibilities etc */
276
+ COINLIBAPI void COINLINKAGE
277
+ Cbc_checkSolution(Cbc_Model * model)
278
+ ;
279
+
280
+ /** Number of iterations */
281
+ COINLIBAPI int COINLINKAGE
282
+ Cbc_getIterationCount(Cbc_Model * model)
283
+ ;
284
+ /** Are there a numerical difficulties? */
285
+ COINLIBAPI int COINLINKAGE
286
+ Cbc_isAbandoned(Cbc_Model * model)
287
+ ;
288
+ /** Is optimality proven? */
289
+ COINLIBAPI int COINLINKAGE
290
+ Cbc_isProvenOptimal(Cbc_Model * model)
291
+ ;
292
+ /** Is infeasiblity proven (or none better than cutoff)? */
293
+ COINLIBAPI int COINLINKAGE
294
+ Cbc_isProvenInfeasible(Cbc_Model * model)
295
+ ;
296
+ /** Was continuous solution unbounded? */
297
+ COINLIBAPI int COINLINKAGE
298
+ Cbc_isContinuousUnbounded(Cbc_Model * model)
299
+ ;
300
+ /** Node limit reached? */
301
+ COINLIBAPI int COINLINKAGE
302
+ Cbc_isNodeLimitReached(Cbc_Model * model)
303
+ ;
304
+ /** Time limit reached? */
305
+ COINLIBAPI int COINLINKAGE
306
+ Cbc_isSecondsLimitReached(Cbc_Model * model)
307
+ ;
308
+ /** Solution limit reached? */
309
+ COINLIBAPI int COINLINKAGE
310
+ Cbc_isSolutionLimitReached(Cbc_Model * model)
311
+ ;
312
+ /** Are there numerical difficulties (for initialSolve) ? */
313
+ COINLIBAPI int COINLINKAGE
314
+ Cbc_isInitialSolveAbandoned(Cbc_Model * model)
315
+ ;
316
+ /** Is optimality proven (for initialSolve) ? */
317
+ COINLIBAPI int COINLINKAGE
318
+ Cbc_isInitialSolveProvenOptimal(Cbc_Model * model)
319
+ ;
320
+ /** Is primal infeasiblity proven (for initialSolve) ? */
321
+ COINLIBAPI int COINLINKAGE
322
+ Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model)
323
+ ;
324
+ /** "row" solution
325
+ * This is the vector A*x, where A is the constraint matrix
326
+ * and x is the current solution. */
327
+ COINLIBAPI const double * COINLINKAGE
328
+ Cbc_getRowActivity(Cbc_Model * model)
329
+ ;
330
+ /** Best feasible solution vector */
331
+ COINLIBAPI const double * COINLINKAGE
332
+ Cbc_getColSolution(Cbc_Model * model)
333
+ ;
334
+ /** Objective value of best feasible solution */
335
+ COINLIBAPI double COINLINKAGE
336
+ Cbc_getObjValue(Cbc_Model * model)
337
+ ;
338
+ /** Best known bound on the optimal objective value */
339
+ COINLIBAPI double COINLINKAGE
340
+ Cbc_getBestPossibleObjValue(Cbc_Model * model)
341
+ ;
342
+ /** Number of nodes explored in B&B tree */
343
+ COINLIBAPI int COINLINKAGE
344
+ Cbc_getNodeCount(Cbc_Model * model)
345
+ ;
346
+ /** Print the solution */
347
+ COINLIBAPI void COINLINKAGE
348
+ Cbc_printSolution(Cbc_Model * model)
349
+ ;
350
+ /** Final status of problem
351
+ Some of these can be found out by is...... functions
352
+ -1 before branchAndBound
353
+ 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
354
+ (or check value of best solution)
355
+ 1 stopped - on maxnodes, maxsols, maxtime
356
+ 2 difficulties so run was abandoned
357
+ (5 event user programmed event occurred)
358
+ */
359
+ COINLIBAPI int COINLINKAGE
360
+ Cbc_status(Cbc_Model * model)
361
+ ;
362
+ /** Secondary status of problem
363
+ -1 unset (status_ will also be -1)
364
+ 0 search completed with solution
365
+ 1 linear relaxation not feasible (or worse than cutoff)
366
+ 2 stopped on gap
367
+ 3 stopped on nodes
368
+ 4 stopped on time
369
+ 5 stopped on user event
370
+ 6 stopped on solutions
371
+ 7 linear relaxation unbounded
372
+ 8 stopped on iteration limit
373
+ */
374
+ COINLIBAPI int COINLINKAGE
375
+ Cbc_secondaryStatus(Cbc_Model * model)
376
+ ;
377
+ /*@}*/
378
+ #ifdef __cplusplus
379
+ }
380
+ #endif
381
+ #endif
@@ -0,0 +1,115 @@
1
+ /* $Id: Coin_C_defines.h 1690 2014-03-13 17:45:21Z mlubin $ */
2
+ /*
3
+ Copyright (C) 2002, 2003 International Business Machines Corporation
4
+ and others. All Rights Reserved.
5
+
6
+ This code is licensed under the terms of the Eclipse Public License (EPL).
7
+ */
8
+ #ifndef CoinCDefine_H
9
+ #define CoinCDefine_H
10
+
11
+ /** This has #defines etc for the "C" interface to Coin.
12
+ If COIN_EXTERN_C defined then an extra extern C
13
+ */
14
+
15
+ #if defined (CLP_EXTERN_C)
16
+ #define COIN_EXTERN_C
17
+ #define COIN_NO_SBB
18
+ #define COIN_NO_CBC
19
+ #endif
20
+ #if defined (SBB_EXTERN_C)
21
+ #define COIN_EXTERN_C
22
+ #define COIN_NO_CLP
23
+ #endif
24
+ #if defined (CBC_EXTERN_C)
25
+ #define COIN_EXTERN_C
26
+ #define COIN_NO_CLP
27
+ #endif
28
+ /* We need to allow for Microsoft */
29
+ #ifndef COINLIBAPI
30
+
31
+ #if defined(CBCCINTERFACEDLL_EXPORTS) || defined(CLPMSDLL)
32
+ #if defined (COIN_EXTERN_C)
33
+ # define COINLIBAPI __declspec(dllexport)
34
+ #else
35
+ # define COINLIBAPI __declspec(dllexport)
36
+ #endif
37
+ # define COINLINKAGE __stdcall
38
+ # define COINLINKAGE_CB __cdecl
39
+ #else
40
+ #if defined (COIN_EXTERN_C)
41
+ # define COINLIBAPI extern "C"
42
+ #else
43
+ # define COINLIBAPI
44
+ #endif
45
+ # define COINLINKAGE
46
+ # define COINLINKAGE_CB
47
+ #endif
48
+
49
+ #endif
50
+ /** User does not need to see structure of model but C++ code does */
51
+ #if defined (CLP_EXTERN_C)
52
+ /* Real typedef for structure */
53
+ class CMessageHandler;
54
+ typedef struct {
55
+ ClpSimplex * model_;
56
+ CMessageHandler * handler_;
57
+ } Clp_Simplex;
58
+ #else
59
+ typedef void Clp_Simplex;
60
+ #endif
61
+
62
+ #ifndef COIN_NO_CLP
63
+ /** typedef for user call back.
64
+ The cvec are constructed so don't need to be const*/
65
+ typedef void (COINLINKAGE_CB *clp_callback) (Clp_Simplex * model,int msgno, int ndouble,
66
+ const double * dvec, int nint, const int * ivec,
67
+ int nchar, char ** cvec);
68
+ #endif
69
+ /** User does not need to see structure of model but C++ code does */
70
+ #if defined (SBB_EXTERN_C)
71
+ /* Real typedef for structure */
72
+ class Sbb_MessageHandler;
73
+ typedef struct {
74
+ OsiClpSolverInterface * solver_;
75
+ SbbModel * model_;
76
+ Sbb_MessageHandler * handler_;
77
+ char * information_;
78
+ } Sbb_Model;
79
+ #else
80
+ typedef void Sbb_Model;
81
+ #endif
82
+ #if defined (CBC_EXTERN_C)
83
+ /* Real typedef for structure */
84
+ class Cbc_MessageHandler;
85
+ typedef struct {
86
+ OsiClpSolverInterface * solver_;
87
+ CbcModel * model_;
88
+ Cbc_MessageHandler * handler_;
89
+ std::vector<std::string> cmdargs_;
90
+ } Cbc_Model;
91
+ #else
92
+ typedef void Cbc_Model;
93
+ #endif
94
+ #ifndef COIN_NO_SBB
95
+ /** typedef for user call back.
96
+ The cvec are constructed so don't need to be const*/
97
+ typedef void (COINLINKAGE_CB *sbb_callback) (Sbb_Model * model,int msgno, int ndouble,
98
+ const double * dvec, int nint, const int * ivec,
99
+ int nchar, char ** cvec);
100
+ typedef void (COINLINKAGE_CB *cbc_callback) (Cbc_Model * model,int msgno, int ndouble,
101
+ const double * dvec, int nint, const int * ivec,
102
+ int nchar, char ** cvec);
103
+ #endif
104
+ #if COIN_BIG_INDEX==0
105
+ typedef int CoinBigIndex;
106
+ #elif COIN_BIG_INDEX==1
107
+ typedef long CoinBigIndex;
108
+ #else
109
+ typedef long long CoinBigIndex;
110
+ #endif
111
+ /* just in case used somewhere */
112
+ #undef COIN_NO_CLP
113
+ #undef COIN_NO_SBB
114
+ #undef COIN_NO_CBC
115
+ #endif
@@ -1,42 +1,35 @@
1
- require "mkmf"
2
- ROOT_DIR = File.dirname(File.absolute_path(__FILE__))
3
-
4
- TARBALL_PATH = "/tmp/Cbc.tgz"
5
- CBC_SRC_DIR = "/tmp/Cbc-2.9.9"
6
- CBC_INSTALL = "#{ROOT_DIR}/install"
7
- def install_cbc
8
- system "curl -o #{TARBALL_PATH} https://www.coin-or.org/download/source/Cbc/Cbc-2.9.9.tgz"
9
- Dir.chdir "/tmp" do
10
- system "rm -rf #{CBC_SRC_DIR}; tar -xzf #{TARBALL_PATH}"
11
- res = system "cd #{CBC_SRC_DIR} && ./configure --prefix=#{CBC_INSTALL} -C --with-pic --without-static && make -j `bash -c \"grep -c ^processor /proc/cpuinfo\"` && make install"
12
- unless res
13
- puts "Failed to build CBC, aborting... Cbc source is in #{CBC_SRC_DIR}"
14
- exit 1
15
- end
16
- system "rm -rf #{CBC_SRC_DIR}"
17
- end
18
- end
19
-
20
- install_cbc
1
+ require 'mkmf'
21
2
 
22
3
  ## Rerun this if updated cbc version
23
4
  # swig_cmd = find_executable "swig"
24
5
  # current_path = File.expand_path('../', __FILE__)
25
- # %x{#{swig_cmd} -ruby -I#{current_path}/install/include/coin #{current_path}/cbc.i }
6
+ # %x{#{swig_cmd} -ruby -I#{current_path}/coin #{current_path}/cbc.i }
7
+
8
+ dir_config('cbc-wrapper')
9
+ dir_config('cbc')
10
+
11
+ succeed = true
26
12
 
27
13
  libs = %w(
28
14
  CbcSolver
29
15
  )
30
16
 
31
17
  libs.each do |lib|
32
- find_library(lib, nil, "#{CBC_INSTALL}/lib")
18
+ unless find_library(lib, nil)
19
+ succeed = false
20
+ end
33
21
  end
34
22
 
35
- headers = Dir["#{CBC_INSTALL}/include/coin/*.h"].map { |h| h.split("/").last }
23
+ headers = ["coin/Cbc_C_Interface.h", "coin/Coin_C_defines.h"]
24
+
36
25
  headers.each do |header|
37
- find_header(header, "#{CBC_INSTALL}/include/coin")
26
+ unless find_header(header)
27
+ succeed = false
28
+ end
38
29
  end
39
30
 
40
- dir_config("cbc-wrapper")
41
- RPATHFLAG << " -Wl,-rpath,'$$ORIGIN/install/lib'"
42
- create_makefile("cbc_wrapper")
31
+ if succeed
32
+ create_makefile('cbc_wrapper')
33
+ else
34
+ abort "Missing some libraries or headers"
35
+ end
@@ -1,3 +1,3 @@
1
1
  module CbcWrapper
2
- VERSION = "2.9.9.3"
2
+ VERSION = "2.9.9.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbc-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.9.3
4
+ version: 2.9.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Verger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-01 00:00:00.000000000 Z
11
+ date: 2020-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,8 +86,9 @@ files:
86
86
  - cbc-wrapper.gemspec
87
87
  - ext/cbc-wrapper/cbc.i
88
88
  - ext/cbc-wrapper/cbc_wrap.c
89
+ - ext/cbc-wrapper/coin/Cbc_C_Interface.h
90
+ - ext/cbc-wrapper/coin/Coin_C_defines.h
89
91
  - ext/cbc-wrapper/extconf.rb
90
- - ext/cbc-wrapper/install/.gitignore
91
92
  - lib/cbc-wrapper.rb
92
93
  - lib/cbc-wrapper/version.rb
93
94
  homepage: https://github.com/gverger/cbc-wrapper
@@ -109,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  - !ruby/object:Gem::Version
110
111
  version: '0'
111
112
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.7.6
113
+ rubygems_version: 3.0.3
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Bare wrapper around Cbc Linear Programming Solver made with SWIG
@@ -1,4 +0,0 @@
1
- # Ignore everything in this directory
2
- *
3
- # Except this file
4
- !.gitignore