genmodel 0.0.21 → 0.0.22
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/ext/Genmodel/GenModelCplex.cpp +31 -0
- data/ext/Genmodel/GenModelCplex.h +8 -1
- data/ext/Genmodel/GenModelOsi.cpp +24 -0
- data/ext/Genmodel/GenModelOsi.h +29 -23
- data/ext/Genmodel/InterfaceObject.cpp +2 -0
- data/ext/Genmodel/extconf.rb +113 -25
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63fd67c6fedfd3146bb75b3658ef7e196f849490
|
4
|
+
data.tar.gz: c4509f1524d449e0d2ed46c8880e5669987133ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50e1e8ec93c96d7c20d1bd214fbc1ebbfddd3c602958f10a3de4e3cd1374a419e63a3550807211317bf060ccaf7545c300dc0a9fa0ed6e4d88e248780e58bd8e
|
7
|
+
data.tar.gz: 7da1a6a902a76ef156fc144fc0c85efbc9f0fc53b64beb2a0cc0dabe75c8137fbab18d09fa48b5e5a5b946d1f2a4a6aef21754a8d48e1d81f3b8671a2af62f09
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#endif
|
5
5
|
#include <limits>
|
6
6
|
|
7
|
+
#ifdef CPLEX_MODULE
|
7
8
|
string getcplexerror(CPXENVptr env, int status)
|
8
9
|
{
|
9
10
|
char errmsg[4096];
|
@@ -710,6 +711,33 @@ long GenModelCplex::Clean()
|
|
710
711
|
|
711
712
|
return 0;
|
712
713
|
}
|
714
|
+
#else
|
715
|
+
long cpx_not_implemented() { throw string("The Cplex module is not available on this platform"); }
|
716
|
+
|
717
|
+
GenModelCplex::GenModelCplex() {cpx_not_implemented();}
|
718
|
+
GenModelCplex::~GenModelCplex() {cpx_not_implemented();}
|
719
|
+
long GenModelCplex::Init(string name) {return cpx_not_implemented();}
|
720
|
+
long GenModelCplex::CreateModel(string filename, int type, string dn) {return cpx_not_implemented();}
|
721
|
+
long GenModelCplex::CreateModel() {return cpx_not_implemented();}
|
722
|
+
long GenModelCplex::AddSolverCol(vector<int>& ind, vector<double>& val, double obj, double lb, double ub, string name, char type) {return cpx_not_implemented();}
|
723
|
+
long GenModelCplex::AddSolverRow(vector<int>& ind, vector<double>& val, double rhs, char sense, string name) {return cpx_not_implemented();}
|
724
|
+
long GenModelCplex::AddCol(int* newi, double* newcol, int nz, double obj, double lb, double ub, const char* name, char type) {return cpx_not_implemented();}
|
725
|
+
long GenModelCplex::AddCut(int* cols, double* vals, int nz, double rhs, char sense, const char* name) {return cpx_not_implemented();}
|
726
|
+
long GenModelCplex::ChangeBulkBounds(int count, int * ind, char * type, double * vals) {return cpx_not_implemented();}
|
727
|
+
long GenModelCplex::ChangeBulkObjectives(int count, int * ind, double * vals) {return cpx_not_implemented();}
|
728
|
+
long GenModelCplex::ChangeBulkNz(int count, int* rind, int* cind, double* vals) {return cpx_not_implemented();}
|
729
|
+
long GenModelCplex::WriteProblemToLpFile(string filename) {return cpx_not_implemented();}
|
730
|
+
long GenModelCplex::WriteSolutionToFile(string filename) {return cpx_not_implemented();}
|
731
|
+
long GenModelCplex::SwitchToMip() {return cpx_not_implemented();}
|
732
|
+
long GenModelCplex::SwitchToLp() {return cpx_not_implemented();}
|
733
|
+
long GenModelCplex::DeleteMipStarts() {return cpx_not_implemented();}
|
734
|
+
long GenModelCplex::Solve() {return cpx_not_implemented();}
|
735
|
+
long GenModelCplex::SetSol() {return cpx_not_implemented();}
|
736
|
+
long GenModelCplex::Clean() {return cpx_not_implemented();}
|
737
|
+
double GenModelCplex::GetMIPRelativeGap() {return cpx_not_implemented();}
|
738
|
+
long GenModelCplex::SetDirectParam(int whichparam, genmodel_param value, string type, string message) {return cpx_not_implemented();}
|
739
|
+
long GenModelCplex::SetParam(string param, int whichparam, string type, string message, bool implemented) {return cpx_not_implemented();}
|
740
|
+
#endif
|
713
741
|
|
714
742
|
long CplexData::Reset()
|
715
743
|
{
|
@@ -795,6 +823,7 @@ long CplexData::ClearStructure()
|
|
795
823
|
|
796
824
|
long CplexData::Delete()
|
797
825
|
{
|
826
|
+
#ifdef CPLEX_MODULE
|
798
827
|
if(lp != NULL)
|
799
828
|
{
|
800
829
|
CPXfreeprob(env, &lp);
|
@@ -809,6 +838,8 @@ long CplexData::Delete()
|
|
809
838
|
}
|
810
839
|
|
811
840
|
ClearStructure();
|
841
|
+
#endif
|
812
842
|
|
813
843
|
return 0;
|
814
844
|
}
|
845
|
+
|
@@ -17,7 +17,14 @@
|
|
17
17
|
#endif
|
18
18
|
|
19
19
|
#include "GenModel.h"
|
20
|
-
|
20
|
+
|
21
|
+
#ifdef CPLEX_MODULE
|
22
|
+
#include <ilcplex/cplex.h>
|
23
|
+
#else
|
24
|
+
typedef void* CPXENVptr;
|
25
|
+
typedef void* CPXLPptr;
|
26
|
+
typedef void* CPXFILEptr;
|
27
|
+
#endif
|
21
28
|
|
22
29
|
using namespace std;
|
23
30
|
|
@@ -5,7 +5,10 @@
|
|
5
5
|
* Author: mbouchard
|
6
6
|
*/
|
7
7
|
|
8
|
+
|
8
9
|
#include "GenModelOsi.h"
|
10
|
+
|
11
|
+
#ifdef OSI_MODULE
|
9
12
|
#include "ProblemReaderOsi.h"
|
10
13
|
#include "CbcHeuristicFPump.hpp"
|
11
14
|
#include "CbcHeuristicRINS.hpp"
|
@@ -16,6 +19,7 @@
|
|
16
19
|
|
17
20
|
using namespace std;
|
18
21
|
|
22
|
+
|
19
23
|
long GenModelOsi::WriteProblemToLpFile(string filename)
|
20
24
|
{
|
21
25
|
if(!bcreated)
|
@@ -817,6 +821,26 @@ long GenModelOsi::Clean()
|
|
817
821
|
|
818
822
|
return 0;
|
819
823
|
}
|
824
|
+
#else
|
825
|
+
|
826
|
+
long osi_not_implemented() { throw string("The Osi module is not available on this platform"); }
|
827
|
+
|
828
|
+
long GenModelOsi::Init(string name) {return osi_not_implemented();}
|
829
|
+
long GenModelOsi::CreateModel() {return osi_not_implemented();}
|
830
|
+
long GenModelOsi::CreateModel(string filename, int type, string dn) {return osi_not_implemented();}
|
831
|
+
long GenModelOsi::AddSolverRow(vector<int>& ind, vector<double>& val, double rhs, char sense, string name) {return osi_not_implemented();}
|
832
|
+
long GenModelOsi::AddSolverCol(vector<int>& ind, vector<double>& val, double obj, double lb, double ub, string name, char type) {return osi_not_implemented();}
|
833
|
+
long GenModelOsi::AddCut(int* cols, double* vals, int nz, double rhs, char sense, const char* name) {return osi_not_implemented();}
|
834
|
+
long GenModelOsi::AddCol(int* newi, double* newcol, int nz, double obj, double lb, double ub, const char* name, char type) {return osi_not_implemented();}
|
835
|
+
long GenModelOsi::WriteProblemToLpFile(string filename) {return osi_not_implemented();}
|
836
|
+
long GenModelOsi::WriteSolutionToFile(string filename) {return osi_not_implemented();}
|
837
|
+
long GenModelOsi::Solve() {return osi_not_implemented();}
|
838
|
+
long GenModelOsi::SetSol() {return osi_not_implemented();}
|
839
|
+
long GenModelOsi::Clean() {return osi_not_implemented();}
|
840
|
+
long GenModelOsi::SetDirectParam(int whichparam, genmodel_param value, string type, string message) {return osi_not_implemented();}
|
841
|
+
long GenModelOsi::SetParam(string param, int whichparam, string type, string message, bool implemented) {return osi_not_implemented();}
|
842
|
+
|
843
|
+
#endif
|
820
844
|
|
821
845
|
long OsiData::Reset()
|
822
846
|
{
|
data/ext/Genmodel/GenModelOsi.h
CHANGED
@@ -15,29 +15,35 @@
|
|
15
15
|
#endif
|
16
16
|
|
17
17
|
#include "GenModel.h"
|
18
|
-
#
|
19
|
-
|
20
|
-
//#include "
|
21
|
-
//#include "
|
22
|
-
//#include "
|
23
|
-
//#include "
|
24
|
-
|
25
|
-
|
26
|
-
//#include "
|
27
|
-
|
28
|
-
#include "
|
29
|
-
#include "
|
30
|
-
#include "
|
31
|
-
#include "
|
32
|
-
#include "
|
33
|
-
#include "
|
34
|
-
#include "
|
35
|
-
#include "
|
36
|
-
#include "
|
37
|
-
#include "
|
38
|
-
#include "
|
39
|
-
#include "
|
40
|
-
#include "
|
18
|
+
#ifdef OSI_MODULE
|
19
|
+
#include "OsiClpSolverInterface.hpp"
|
20
|
+
//#include "OsiCpxSolverInterface.hpp"
|
21
|
+
//#include "OsiSpxSolverInterface.hpp"
|
22
|
+
//#include "OsiGrbSolverInterface.hpp"
|
23
|
+
//#include "OsiGlpkSolverInterface.hpp"
|
24
|
+
//#include "OsiVolSolverInterface.hpp"
|
25
|
+
#include "CbcModel.hpp"
|
26
|
+
//#include "CbcBranchUser.hpp"
|
27
|
+
//#include "CbcCompareUser.hpp"
|
28
|
+
#include "CbcCutGenerator.hpp"
|
29
|
+
#include "CbcHeuristicLocal.hpp"
|
30
|
+
#include "CbcHeuristicGreedy.hpp"
|
31
|
+
#include "CglProbing.hpp"
|
32
|
+
#include "CbcHeuristic.hpp"
|
33
|
+
#include "GenModelOsiInterface.h"
|
34
|
+
#include "CoinTime.hpp"
|
35
|
+
#include "CglGomory.hpp"
|
36
|
+
#include "CglProbing.hpp"
|
37
|
+
#include "CglKnapsackCover.hpp"
|
38
|
+
#include "CglOddHole.hpp"
|
39
|
+
#include "CglClique.hpp"
|
40
|
+
#include "CglFlowCover.hpp"
|
41
|
+
#include "CglMixedIntegerRounding.hpp"
|
42
|
+
#else
|
43
|
+
typedef unsigned long CoinBigIndex;
|
44
|
+
typedef void* CbcModel;
|
45
|
+
typedef void* OsiSolverInterface;
|
46
|
+
#endif
|
41
47
|
|
42
48
|
using namespace std;
|
43
49
|
|
data/ext/Genmodel/extconf.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
require 'rbconfig'
|
3
|
+
require 'find'
|
3
4
|
|
4
5
|
extension_name = 'GenModel/GenModel'
|
5
6
|
dir_config(extension_name)
|
@@ -39,10 +40,16 @@ CONFIG["DLDFLAGS"].gsub!(/-multiply_definedsuppress/, '')
|
|
39
40
|
$DLDFLAGS = CONFIG["DLDFLAGS"]
|
40
41
|
puts "#{CONFIG["DLDFLAGS"]}, #{$DLDFLAGS}"
|
41
42
|
|
43
|
+
puts CONFIG['CPPOUTFILE']
|
44
|
+
|
45
|
+
CONFIG["CFLAGS"] = '-O2 -Wall -pthread -fmessage-length=0 -fPIC -std=c++0x'
|
46
|
+
#CONFIG["CXX"] = 'g++'
|
47
|
+
|
48
|
+
sep = File::PATH_SEPARATOR
|
42
49
|
is_cplex = true;
|
43
50
|
is_osi = true;
|
44
51
|
if is_darwin
|
45
|
-
path =
|
52
|
+
path = Dir.home+"/Applications/IBM/ILOG/CPLEX_Studio126/cplex/include/"
|
46
53
|
puts "Looking for ilcplex/cplex.h in "+path
|
47
54
|
if(is_cplex && find_header("ilcplex/cplex.h",path))
|
48
55
|
puts "found"
|
@@ -51,16 +58,96 @@ if is_darwin
|
|
51
58
|
is_cplex = false
|
52
59
|
end
|
53
60
|
|
54
|
-
path =
|
61
|
+
path = Dir.home+"/Applications/IBM/ILOG/CPLEX_Studio126/cplex/lib/x86-64_osx/static_pic"
|
55
62
|
puts "Looking for libcplex (function CPXopenCPLEX) in "+path
|
56
|
-
if(is_cplex &&
|
63
|
+
if(is_cplex && find_library("cplex","CPXopenCPLEX",path)) #"CPXopenCPLEX",path))
|
57
64
|
puts "found"
|
58
65
|
else
|
59
66
|
puts "not found"
|
60
67
|
is_cplex = false
|
61
68
|
end
|
69
|
+
|
70
|
+
#path = "/usr/local/Cellar/cbc/2.8.6/include/coin/"+sep+"/usr/local/Cellar/cgl/0.58.3/include/coin/"
|
71
|
+
cbc_path = "/usr/local/Cellar/cbc/"
|
72
|
+
cbc_file = "/include/coin/OsiClpSolverInterface.hpp"
|
73
|
+
puts "Looking for OsiClpSolverInterface.hpp in "+cbc_path+"/*"
|
74
|
+
file_exist = nil
|
75
|
+
Find.find(cbc_path) do |path|
|
76
|
+
if (FileTest.directory?(path))
|
77
|
+
puts path+cbc_file
|
78
|
+
temp_name = (path).gsub(/\/usr\/local\/Cellar\/cbc\//,'')
|
79
|
+
count = temp_name.count('/')
|
80
|
+
if ((count == 0) && (File.exist?(path+cbc_file)))
|
81
|
+
file_exist = "-I#{path}/include/coin"
|
82
|
+
break
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
if(is_osi && file_exist != nil)
|
87
|
+
$INCFLAGS << " " << file_exist.quote
|
88
|
+
puts "found"
|
89
|
+
else
|
90
|
+
puts "not found"
|
91
|
+
is_osi = false
|
92
|
+
end
|
93
|
+
|
94
|
+
path = "/usr/lib:/usr/local/lib/"
|
95
|
+
puts "Looking for Clp (function main) in "+path
|
96
|
+
if(is_osi && find_library("Clp",nil,path))
|
97
|
+
puts "found"
|
98
|
+
else
|
99
|
+
puts "not found"
|
100
|
+
is_osi = false
|
101
|
+
end
|
102
|
+
|
103
|
+
path = "/usr/lib:/usr/local/lib/"
|
104
|
+
puts "Looking for Cbc (function main) in "+path
|
105
|
+
if(is_osi && find_library("Cbc",nil,path))
|
106
|
+
puts "found"
|
107
|
+
else
|
108
|
+
puts "not found"
|
109
|
+
is_osi = false
|
110
|
+
end
|
111
|
+
|
112
|
+
path = "/usr/lib:/usr/local/lib/"
|
113
|
+
puts "Looking for Cgl (function main) in "+path
|
114
|
+
if(is_osi && find_library("Cgl",nil,path))
|
115
|
+
puts "found"
|
116
|
+
else
|
117
|
+
puts "not found"
|
118
|
+
is_osi = false
|
119
|
+
end
|
120
|
+
|
121
|
+
path = "/usr/lib:/usr/local/lib/"
|
122
|
+
puts "Looking for Osi (function main) in "+path
|
123
|
+
if(is_osi && find_library("Osi",nil,path))
|
124
|
+
puts "found"
|
125
|
+
else
|
126
|
+
puts "not found"
|
127
|
+
is_osi = false
|
128
|
+
end
|
129
|
+
|
130
|
+
path = "/usr/lib:/usr/local/lib/"
|
131
|
+
puts "Looking for OsiClp (function main) in "+path
|
132
|
+
if(is_osi && find_library("Osi",nil,path))
|
133
|
+
puts "found"
|
134
|
+
else
|
135
|
+
puts "not found"
|
136
|
+
is_osi = false
|
137
|
+
end
|
138
|
+
|
139
|
+
path = "/usr/lib:/usr/local/lib/"
|
140
|
+
puts "Looking for CoinUtils (function main) in "+path
|
141
|
+
if(is_cplex && find_library("CoinUtils",nil,path))
|
142
|
+
puts "found"
|
143
|
+
else
|
144
|
+
puts "not found"
|
145
|
+
#is_osi = false
|
146
|
+
end
|
147
|
+
|
62
148
|
elsif is_linux
|
63
|
-
path =
|
149
|
+
# path = Dir.home+"/ibm/ILOG/CPLEX_Studio126/cplex/include:/opt/ibm/ILOG/CPLEX_Studio126/cplex/include"
|
150
|
+
path = "/opt/ibm/ILOG/CPLEX_Studio126/cplex/include"
|
64
151
|
puts "Looking for ilcplex/cplex.h in "+path
|
65
152
|
if(is_cplex && find_header("ilcplex/cplex.h",path))
|
66
153
|
puts "found"
|
@@ -71,33 +158,44 @@ elsif is_linux
|
|
71
158
|
|
72
159
|
path = "/usr/lib:/usr/local/lib/"
|
73
160
|
puts "Looking for pthread (function main) in "+path
|
74
|
-
if(
|
161
|
+
if(find_library("pthread",nil,path))
|
75
162
|
puts "found"
|
76
163
|
else
|
77
164
|
puts "not found"
|
78
165
|
end
|
79
166
|
|
167
|
+
cbc_path = "/usr/include/coin/"
|
168
|
+
cbc_file = "OsiClpSolverInterface.hpp"
|
169
|
+
puts "Looking for OsiClpSolverInterface.hpp in "+cbc_path+"/*"
|
170
|
+
if(is_osi && File.exist?(cbc_path+cbc_file))
|
171
|
+
$INCFLAGS << " -I" << cbc_path.quote
|
172
|
+
puts "found"
|
173
|
+
else
|
174
|
+
puts "not found"
|
175
|
+
is_osi = false
|
176
|
+
end
|
177
|
+
|
80
178
|
path = "/usr/lib:/usr/local/lib/"
|
81
179
|
puts "Looking for Clp (function main) in "+path
|
82
|
-
if(is_osi &&
|
180
|
+
if(is_osi && find_library("Clp",nil,path))
|
83
181
|
puts "found"
|
84
|
-
|
182
|
+
else
|
85
183
|
puts "not found"
|
86
184
|
is_osi = false
|
87
185
|
end
|
88
186
|
|
89
187
|
path = "/usr/lib:/usr/local/lib/"
|
90
188
|
puts "Looking for Cbc (function main) in "+path
|
91
|
-
if(is_osi &&
|
189
|
+
if(is_osi && find_library("Cbc",nil,path))
|
92
190
|
puts "found"
|
93
|
-
|
191
|
+
else
|
94
192
|
puts "not found"
|
95
193
|
is_osi = false
|
96
194
|
end
|
97
195
|
|
98
196
|
path = "/usr/lib:/usr/local/lib/"
|
99
197
|
puts "Looking for Cgl (function main) in "+path
|
100
|
-
if(is_osi &&
|
198
|
+
if(is_osi && find_library("Cgl",nil,path))
|
101
199
|
puts "found"
|
102
200
|
else
|
103
201
|
puts "not found"
|
@@ -106,7 +204,7 @@ elsif is_linux
|
|
106
204
|
|
107
205
|
path = "/usr/lib:/usr/local/lib/"
|
108
206
|
puts "Looking for Osi (function main) in "+path
|
109
|
-
if(is_osi &&
|
207
|
+
if(is_osi && find_library("Osi",nil,path))
|
110
208
|
puts "found"
|
111
209
|
else
|
112
210
|
puts "not found"
|
@@ -115,7 +213,7 @@ elsif is_linux
|
|
115
213
|
|
116
214
|
path = "/usr/lib:/usr/local/lib/"
|
117
215
|
puts "Looking for OsiClp (function main) in "+path
|
118
|
-
if(is_osi &&
|
216
|
+
if(is_osi && find_library("Osi",nil,path))
|
119
217
|
puts "found"
|
120
218
|
else
|
121
219
|
puts "not found"
|
@@ -124,11 +222,11 @@ elsif is_linux
|
|
124
222
|
|
125
223
|
path = "/usr/lib:/usr/local/lib/"
|
126
224
|
puts "Looking for CoinUtils (function main) in "+path
|
127
|
-
if(is_cplex &&
|
225
|
+
if(is_cplex && find_library("CoinUtils",nil,path))
|
128
226
|
puts "found"
|
129
227
|
else
|
130
228
|
puts "not found"
|
131
|
-
|
229
|
+
#is_osi = false
|
132
230
|
end
|
133
231
|
|
134
232
|
|
@@ -137,15 +235,6 @@ else
|
|
137
235
|
is_osi = false;
|
138
236
|
end
|
139
237
|
|
140
|
-
[#r"/opt/ibm/ILOG/CPLEX_Studio126/cplex/bin/x86-64_sles10_4.1/",
|
141
|
-
#os.environ['HOME']+"/source/gurobi510/linux64/lib",
|
142
|
-
|
143
|
-
"Darwin": [os.environ['HOME']+"/Applications/IBM/ILOG/CPLEX_Studio126/cplex/lib/x86-64_osx/static_pic",
|
144
|
-
r"/Library/gurobi560/mac64/lib",
|
145
|
-
r"/Users/mbouchard/source/scipoptsuite-3.0.2/scip-3.0.2/lib/",
|
146
|
-
r"../lib"]
|
147
|
-
}
|
148
|
-
|
149
238
|
|
150
239
|
if(is_cplex)
|
151
240
|
puts "*** With CPLEX_MOUDLE ***"
|
@@ -156,7 +245,6 @@ if(is_osi)
|
|
156
245
|
$defs.push("-DOSI_MODULE")
|
157
246
|
end
|
158
247
|
|
159
|
-
|
160
|
-
CONFIG["CXX"] = 'g++'
|
248
|
+
|
161
249
|
|
162
250
|
create_makefile (extension_name)
|