genmodel 0.0.24 → 0.0.25
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 +1 -1
- data/ext/Genmodel/GenModelOsi.cpp +32 -10
- 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: cb21eb0a2b3bee9704f777ba8eb6fdfc5dc201f3
|
4
|
+
data.tar.gz: b57e970b21c5174c0764cf002c9871c09f22f25f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6363350698cb2401603dbe2cd47c05e43ea3c14ba7e65319c878b34c636d83b291f8fe6de3158eb7c4a73097a66f9661f2bc3b02dc69d8cc8aae73c10018942
|
7
|
+
data.tar.gz: 28389755879adbf16ec35fb859d5d0141b07ea89eecbbcaeb50ac611a540bcebb85144615334ab963dff75e994d90c050a778f0202b13f2fa361423038eaba38
|
@@ -597,7 +597,7 @@ long GenModelCplex::Init(string name)
|
|
597
597
|
}
|
598
598
|
|
599
599
|
// General settings
|
600
|
-
boolParam["log_output_stdout"] = true;
|
600
|
+
//boolParam["log_output_stdout"] = true;
|
601
601
|
SetParam("log_output_stdout", CPX_PARAM_SCRIND, "bool", "Failure to turn on/off log output to stdout");
|
602
602
|
SetParam("log_level", 0, "long", "Failure to set log level", false);
|
603
603
|
SetParam("use_data_checking", CPX_PARAM_DATACHECK, "bool", "Failure to turn on/off data checking");
|
@@ -19,6 +19,11 @@
|
|
19
19
|
|
20
20
|
using namespace std;
|
21
21
|
|
22
|
+
void printmsg(char* msg, GenModelOsi* p)
|
23
|
+
{
|
24
|
+
if(false && p->boolParam.count("log_output_stdout") > 0 && p->boolParam["log_output_stdout"])
|
25
|
+
printf("%s", msg);
|
26
|
+
}
|
22
27
|
|
23
28
|
long GenModelOsi::WriteProblemToLpFile(string filename)
|
24
29
|
{
|
@@ -48,6 +53,7 @@ long GenModelOsi::WriteSolutionToFile(string filename)
|
|
48
53
|
|
49
54
|
long GenModelOsi::Solve()
|
50
55
|
{
|
56
|
+
char tmp[4096];
|
51
57
|
if(!bcreated)
|
52
58
|
throw string("WriteSolutionToFile() not available : Problem not created yet;");
|
53
59
|
OsiData* d = static_cast<OsiData*>(solverdata);
|
@@ -217,40 +223,56 @@ long GenModelOsi::Solve()
|
|
217
223
|
// If time is given then stop after that number of minutes
|
218
224
|
if (dblParam.count("time_limit") > 0)
|
219
225
|
{
|
220
|
-
|
226
|
+
snprintf(tmp,4096,"Stopping after %f seconds\n", dblParam["time_limit"]); printmsg(tmp, this);
|
221
227
|
d->mipmodel->setDblParam(CbcModel::CbcMaximumSeconds, dblParam["time_limit"]);
|
222
228
|
}
|
223
229
|
|
224
230
|
// Switch off most output
|
225
231
|
if (d->mipmodel->getNumCols()<3000)
|
226
232
|
{
|
227
|
-
|
233
|
+
if(false && boolParam.count("log_output_stdout") > 0 && boolParam["log_output_stdout"])
|
234
|
+
d->mipmodel->messageHandler()->setLogLevel(1);
|
235
|
+
else
|
236
|
+
d->mipmodel->messageHandler()->setLogLevel(0);
|
228
237
|
//d->model->solver()->messageHandler()->setLogLevel(0);
|
229
238
|
}
|
230
239
|
else
|
231
240
|
{
|
232
|
-
|
233
|
-
|
241
|
+
if(false && boolParam.count("log_output_stdout") > 0 && boolParam["log_output_stdout"])
|
242
|
+
{
|
243
|
+
d->mipmodel->messageHandler()->setLogLevel(2);
|
244
|
+
//d->mipmodel->solver()->messageHandler()->setLogLevel(1);
|
245
|
+
}
|
246
|
+
else
|
247
|
+
{
|
248
|
+
d->mipmodel->messageHandler()->setLogLevel(0);
|
249
|
+
//d->mipmodel->solver()->messageHandler()->setLogLevel(0);
|
250
|
+
}
|
234
251
|
}
|
235
|
-
|
252
|
+
|
253
|
+
if(false && boolParam.count("log_output_stdout") > 0 && boolParam["log_output_stdout"])
|
254
|
+
d->mipmodel->setPrintFrequency(1);//(50);
|
255
|
+
else
|
256
|
+
d->mipmodel->setPrintFrequency(0);
|
236
257
|
|
237
258
|
double time1 = CoinCpuTime();
|
238
259
|
|
239
260
|
// Do complete search
|
240
261
|
d->mipmodel->branchAndBound();
|
241
262
|
|
242
|
-
|
243
|
-
CoinCpuTime()-time1, d->mipmodel->getNodeCount(), d->mipmodel->getObjValue(), (!d->mipmodel->status() ? " Finished" : " Not finished"));
|
263
|
+
snprintf(tmp,4096," took %f seconds, %d nodes with objective %f, %s\n",
|
264
|
+
CoinCpuTime()-time1, d->mipmodel->getNodeCount(), d->mipmodel->getObjValue(), (!d->mipmodel->status() ? " Finished" : " Not finished")); printmsg(tmp, this);
|
244
265
|
|
245
266
|
// Print more statistics
|
246
|
-
|
267
|
+
snprintf(tmp,4096,"Cuts at root node changed objective from %f to %f\n",
|
268
|
+
d->mipmodel->getContinuousObjective(), d->mipmodel->rootObjectiveAfterCuts()); printmsg(tmp, this);
|
247
269
|
|
248
270
|
int numberGenerators = d->mipmodel->numberCutGenerators();
|
249
271
|
for (int iGenerator=0;iGenerator<numberGenerators;iGenerator++)
|
250
272
|
{
|
251
273
|
CbcCutGenerator * generator = d->mipmodel->cutGenerator(iGenerator);
|
252
|
-
|
253
|
-
generator->numberTimesEntered(),generator->numberCutsInTotal(), generator->numberCutsActive());
|
274
|
+
snprintf(tmp,4096,"%s was tried %d times and created %d cuts of which %d were active after adding rounds of cuts\n", generator->cutGeneratorName(),
|
275
|
+
generator->numberTimesEntered(),generator->numberCutsInTotal(), generator->numberCutsActive()); printmsg(tmp, this);
|
254
276
|
}
|
255
277
|
|
256
278
|
hassolution = d->mipmodel->getIntParam(CbcModel::CbcMaxNumSol) > 0;
|