-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathICbcModel.cpp
43 lines (34 loc) · 1.25 KB
/
ICbcModel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "ICbcModel.hpp"
#include "CbcCompareUser.hpp"
#include "CbcSolver.hpp"
PyObject* ICbcModel::getPrimalVariableSolution(){
_import_array();
npy_intp dims = this->solver()->getNumCols();
double* d = (double*)(this->solver()->getColSolution());
PyObject *Arr = PyArray_SimpleNewFromData( 1, &dims, PyArray_DOUBLE, d );
return Arr;
}
ICbcModel::ICbcModel(OsiClpSolverInterface& osiint):CbcModel(osiint){
_import_array();
}
void ICbcModel::setNodeCompare(PyObject* obj,
runTest_t runTest, runNewSolution_t runNewSolution,
runEvery1000Nodes_t runEvery1000Nodes){
CbcCompareUser compare(obj, runTest,
runNewSolution,runEvery1000Nodes);
setNodeComparison(compare);
}
int ICbcModel::cbcMain(){
// initialize
int returnCode = -1;
int logLevel = this->logLevel();
const char* argv[] = {"ICbcModel", "-solve","-quit"};
CbcMain0(*this);
this->setLogLevel(logLevel);
return CbcMain1(3, argv, *this);
//const char* argv = "-solve -quit";
//CbcSolverUsefulData solverData;
//CbcMain0(*this, solverData);
//this->setLogLevel(logLevel);
//return CbcMain1(3, argv, *this, NULL, solverData);
}