diff --git a/src/main/java/com/patrikdufresne/cbc4j/CBCLibrary.java b/src/main/java/com/patrikdufresne/cbc4j/CBCLibrary.java
index 5291ccb9b8fe6e12ff35b37d601669f14f37eeae..5bf3dd280caabd7877d3cc65434afb090f766569 100644
--- a/src/main/java/com/patrikdufresne/cbc4j/CBCLibrary.java
+++ b/src/main/java/com/patrikdufresne/cbc4j/CBCLibrary.java
@@ -37,15 +37,15 @@ public class CBCLibrary {
/**
* cbc java library name.
*/
- private static final String JAVACBC_JAVA_LIBNAME = "javacbc10";
+ private static final String CBC4J_JAVA_LIBNAME = "cbc4j10";
/**
* Relative cbc path according to current architecture.
*/
- private static final String JAVACBC_LIB_DIR;
+ private static final String CBC4J_LIB_DIR;
/**
* cbc library path property name.
*/
- private static final String JAVACBC_LIBRARY_PATH = "javacbc.library.path";
+ private static final String CBC4J_LIBRARY_PATH = "cbc4j.library.path";
/**
* The resource class path separator.
*
@@ -62,7 +62,7 @@ public class CBCLibrary {
/* Initialize the constant */
DELIMITER = System.getProperty("line.separator"); //$NON-NLS-1$
SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$
- JAVACBC_LIB_DIR = ".cbc" + SEPARATOR + "lib" + SEPARATOR + os() + SEPARATOR + arch(); //$NON-NLS-1$ $NON-NLS-2$
+ CBC4J_LIB_DIR = ".cbc" + SEPARATOR + "lib" + SEPARATOR + os() + SEPARATOR + arch(); //$NON-NLS-1$ $NON-NLS-2$
}
/**
@@ -179,7 +179,7 @@ public class CBCLibrary {
* is the library can't be loaded.
*/
public static void load() {
- loadLibrary(JAVACBC_JAVA_LIBNAME);
+ loadLibrary(CBC4J_JAVA_LIBNAME);
}
/**
@@ -227,7 +227,7 @@ public class CBCLibrary {
StringBuffer message = new StringBuffer();
/* Try loading library from glpk library path */
- String path = System.getProperty(JAVACBC_LIBRARY_PATH); //$NON-NLS-1$
+ String path = System.getProperty(CBC4J_LIBRARY_PATH); //$NON-NLS-1$
if (path != null) {
path = new File(path).getAbsolutePath();
if (load(path, libName1, message)) return;
@@ -242,7 +242,7 @@ public class CBCLibrary {
String fileName1 = mapLibraryName(libName1);
if (path == null) {
path = System.getProperty("user.home"); //$NON-NLS-1$
- File dir = new File(path, JAVACBC_LIB_DIR);
+ File dir = new File(path, CBC4J_LIB_DIR);
if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) {
path = dir.getAbsolutePath();
} else {
diff --git a/src/main/native/Makefile b/src/main/native/Makefile
index 19f8cb7bb42828431f8e6491c476da535745b090..d5284bdf89cd63060004c56caa3a587ba79fce35 100644
--- a/src/main/native/Makefile
+++ b/src/main/native/Makefile
@@ -1,15 +1,15 @@
-#Makefile for javaCbc
+#Makefile for cbc4j
-$(LIBJAVACBC): javacbc.o javacbc_wrap.o
- $(TARGET)-g++ -shared -DNDEBUG javacbc.o javacbc_wrap.o -L$(CBCDIR)/lib -lCbcSolver -lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp -lCoinUtils -lm $(LDFLAGS) -o $(LIBJAVACBC)
+$(LIBCBC4J): cbc4j.o cbc4j_wrap.o
+ $(TARGET)-g++ -shared -DNDEBUG cbc4j.o cbc4j_wrap.o -L$(CBCDIR)/lib -lCbcSolver -lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp -lCoinUtils -lm $(LDFLAGS) -o $(LIBCBC4J)
-javacbc.o: javacbc.cpp javacbc.hpp
- $(TARGET)-g++ -fPIC -c javacbc.cpp -I$(CBCDIR)/include/coin -I$(JAVADIR)/include/ -I$(JAVADIR)/include/linux -I.
+cbc4j.o: cbc4j.cpp cbc4j.hpp
+ $(TARGET)-g++ -fPIC -c cbc4j.cpp -I$(CBCDIR)/include/coin -I$(JAVADIR)/include/ -I$(JAVADIR)/include/linux -I.
-javacbc_wrap.o: javacbc_wrap.cxx
- $(TARGET)-g++ -fPIC -c javacbc_wrap.cxx -I$(CBCDIR)/include/coin -I$(JAVADIR)/include/ -I$(JAVADIR)/include/linux -I.
+cbc4j_wrap.o: cbc4j_wrap.cxx
+ $(TARGET)-g++ -fPIC -c cbc4j_wrap.cxx -I$(CBCDIR)/include/coin -I$(JAVADIR)/include/ -I$(JAVADIR)/include/linux -I.
-javacbc_wrap.cxx: javacbc.i javacbc.hpp
- swig -outdir "$(SWIG_OUTDIR)" -package "$(SWIG_PACKAGE)" -c++ -java javacbc.i
+cbc4j_wrap.cxx: cbc4j.i cbc4j.hpp
+ swig -outdir "$(SWIG_OUTDIR)" -package "$(SWIG_PACKAGE)" -c++ -java cbc4j.i
-all: $(LIBJAVACBC)
+all: $(LIBCBC4J)
diff --git a/src/main/native/javacbc.cpp b/src/main/native/cbc4j.cpp
similarity index 55%
rename from src/main/native/javacbc.cpp
rename to src/main/native/cbc4j.cpp
index e3fe37af684402f7504a80a4ea19897720914654..9557187d16d9c31f5451949ac8b5ddbde46d13b3 100644
--- a/src/main/native/javacbc.cpp
+++ b/src/main/native/cbc4j.cpp
@@ -18,7 +18,7 @@ using namespace std;
#include "OsiClpSolverInterface.hpp"
#include "CoinTime.hpp"
-#include "javacbc.hpp"
+#include "cbc4j.hpp"
#include "CoinPackedMatrix.hpp"
#include "CbcHeuristicFPump.hpp"
@@ -27,250 +27,305 @@ using namespace std;
-// Solve initial LP relaxation.
-void initialSolve(OsiClpSolverInterface& solver){
- solver.initialSolve();
- // // Flush the stdout.
- std::cout.flush();
+void addCol(OsiClpSolverInterface& osi, int numberElements, const int* rows, const double* elements, const double collb, const double colub, const double obj){// Add a column (primal variable) to the problem.
+ osi.addCol(numberElements,rows,elements,collb,colub,obj);
}
-void setInt(OsiClpSolverInterface& solver, int i){
- solver.setInteger(i);
+void addRow(OsiClpSolverInterface& osi, int numberElements, const int* columns, const double* element, const double rowlb, const double rowub){// Add a row (constraint) to the problem.
+ osi.addRow(numberElements,columns,element,rowlb,rowub);
}
-// Default Constructor.
-OsiClpSolverInterface* newOsiClpSolverInterface(){
- return new OsiClpSolverInterface();
+double bestSolution(CbcModel& c, int colIndex){
+ return c.bestSolution()[colIndex];
}
-// Delete OsiClpSolverInterface
-void deleteOsiClpSolverInterface(OsiClpSolverInterface* solver) {
- delete solver;
+void branchAndBound(CbcModel& c, int doStatistics){
+ c.branchAndBound(doStatistics);
+ std::cout.flush();
}
-// Create a new instance of CbcModel
-CbcModel* newCbcModel(OsiClpSolverInterface& s){
- return new CbcModel(s);
+void callCbc0 (CbcModel &m) {
+ CbcMain0(m);
+ std::cout.flush();
+}
+
+int callCbc1 (int argc, const char* argv[], CbcModel &m) {
+ int val = CbcMain1(argc, argv, m);
+ std::cout.flush();
+ return val;
}
void deleteCbcModel(CbcModel* c) {
delete c;
}
-void initialSolve(CbcModel& c) {
- c.initialSolve();
-}
-void branchAndBound(CbcModel& c, int doStatistics){
- c.branchAndBound(doStatistics);
- std::cout.flush();
+
+// Remove a set of columns (primal variables) from the problem.
+void deleteCols(OsiClpSolverInterface& osi, const int num, const int* colIndices){
+ osi.deleteCols(num,colIndices);
}
-int status(CbcModel& c) {
- return c.status();
+
+void deleteOsiClpSolverInterface(OsiClpSolverInterface* solver) {
+ delete solver;
}
-bool isProvenOptimal(CbcModel& c){
- return c.isProvenOptimal();
+
+// Delete a set of rows (constraints) from the problem.
+void deleteRows(OsiClpSolverInterface& osi, const int num, const int* rowIndices){
+ osi.deleteRows(num,rowIndices);
}
-bool isProvenInfeasible(CbcModel& c){
- return c.isProvenInfeasible();
+
+double getCbcColSolution(CbcModel& c, int colIndex){
+ return c.getCbcColSolution()[colIndex];
}
-int getNumCols(CbcModel& c){
- return c.getNumCols();
+
+double getCbcRowLower(CbcModel& c, int rowIndex){
+ return c.getCbcRowLower()[rowIndex];
}
-int getNumRows(CbcModel& c){
- return c.getNumRows();
+
+double getCbcRowUpper(CbcModel& c, int rowIndex){
+ return c.getCbcRowUpper()[rowIndex];
}
-double getObjSense(CbcModel& c){
- return c.getObjSense();
+
+double getCoefficient(OsiClpSolverInterface &osi, int row, int col) {
+ return osi.getMatrixByCol()->getCoefficient(row, col);
}
+
double getColLower(CbcModel& c, int colIndex){
return c.getColLower()[colIndex];
}
-double getColUpper(CbcModel& c, int colIndex){
- return c.getColUpper()[colIndex];
-}
-double getRowLower(CbcModel& c, int rowIndex){
- return c.getRowLower()[rowIndex];
-}
-double getRowUpper(CbcModel& c, int rowIndex){
- return c.getRowUpper()[rowIndex];
-}
-double getObjCoefficients(CbcModel& c, int colIndex){
- return c.getObjCoefficients()[colIndex];
+
+// Get pointer to array[getNumCols(OsiClpSolverInterface& osi)] of column lower bounds.
+double getColLower(OsiClpSolverInterface& osi, int colIndex){
+ return osi.getColLower()[colIndex];
}
-void setObjSense(CbcModel& c, double s){
- c.setObjSense(s);
+
+// Return name of column if one exists or Cnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
+std::string getColName(OsiClpSolverInterface& osi, int colIndex, unsigned maxLen){
+ return osi.getColName(colIndex,maxLen);
}
-bool isContinuous(CbcModel& c, int colIndex){
-return c.isContinuous(colIndex);
+
+// Get pointer to array[getNumCols()] of primal solution vector.
+double getColSolution(OsiClpSolverInterface& osi, int colIndex){
+ return osi.getColSolution()[colIndex];
}
-bool isBinary(CbcModel& c, int colIndex){
-return c.isBinary(colIndex);
+
+double getColSolution(OsiSolverInterface& osi, int colIndex){
+ return osi.getColSolution()[colIndex];
}
-bool isInteger(CbcModel& c, int colIndex){
- return c.isInteger(colIndex);
+
+double getColUpper(CbcModel& c, int colIndex){
+ return c.getColUpper()[colIndex];
}
-const CoinPackedMatrix* getMatrixByCol(CbcModel& c){
- return c.getMatrixByCol();
+
+// Get pointer to array[getNumCols(OsiClpSolverInterface& osi)] of column upper bounds.
+double getColUpper(OsiClpSolverInterface& osi, int colIndex){
+ return osi.getColUpper()[colIndex];
}
+
double getInfinity(CbcModel& c){
return c.getInfinity();
}
-double getCbcRowLower(CbcModel& c, int rowIndex){
- return c.getCbcRowLower()[rowIndex];
-}
-double getCbcRowUpper(CbcModel& c, int rowIndex){
- return c.getCbcRowUpper()[rowIndex];
-}
-double getCbcColSolution(CbcModel& c, int colIndex){
- return c.getCbcColSolution()[colIndex];
-}
-double getObjValue(CbcModel& c){
- return c.getObjValue();
-}
-void setLogLevel(CbcModel& c, int n){
- c.setLogLevel(n);
+
+// Get solver's value for infinity.
+double getInfinity(OsiClpSolverInterface& osi){
+ return osi.getInfinity();
}
-//OsiClpInterface proxy methods
-//Methods returning info on how the solution process terminated
-bool isProvenOptimal(OsiClpSolverInterface& osi){ //Is optimality proven?
- return osi.isProvenOptimal();
+int getNumCols(CbcModel& c){
+ return c.getNumCols();
}
-//Methods related to querying the input data
-int getNumCols(OsiClpSolverInterface& osi){ // Get number of columns.
+// Get number of columns.
+int getNumCols(OsiClpSolverInterface& osi){
return osi.getNumCols();
}
-int getNumRows(OsiClpSolverInterface& osi){ // Get number of rows.
- return osi.getNumRows();
-}
-std::string getRowName(OsiClpSolverInterface& osi, int rowIndex, unsigned maxLen){ // Return name of row if one exists or Rnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
- return osi.getRowName(rowIndex,maxLen);
-}
-std::string getColName(OsiClpSolverInterface& osi, int colIndex, unsigned maxLen){ // Return name of column if one exists or Cnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
- return osi.getColName(colIndex,maxLen);
+
+int getNumRows(CbcModel& c){
+ return c.getNumRows();
}
-double getColLower(OsiClpSolverInterface& osi, int colIndex){ // Get pointer to array[getNumCols(OsiClpSolverInterface& osi)] of column lower bounds.
- return osi.getColLower()[colIndex];
+
+// Get number of rows.
+int getNumRows(OsiClpSolverInterface& osi){
+ return osi.getNumRows();
}
-double getColUpper(OsiClpSolverInterface& osi, int colIndex){ // Get pointer to array[getNumCols(OsiClpSolverInterface& osi)] of column upper bounds.
- return osi.getColUpper()[colIndex];
+
+
+double getObjCoefficients(CbcModel& c, int colIndex){
+ return c.getObjCoefficients()[colIndex];
}
-double getObjCoefficients(OsiClpSolverInterface& osi, int colIndex){ // Get pointer to array[getNumCols(OsiClpSolverInterface& osi)] of objective function coefficients.
+
+// Get pointer to array[getNumCols(OsiClpSolverInterface& osi)] of objective function coefficients.
+double getObjCoefficients(OsiClpSolverInterface& osi, int colIndex){
return osi.getObjCoefficients()[colIndex];
}
-double getRowLower(OsiClpSolverInterface& osi, int rowIndex){ // Get pointer to array[getNumRows(OsiClpSolverInterface& osi)] of row lower bounds.
- return osi.getRowLower()[rowIndex];
-}
-double getRowUpper(OsiClpSolverInterface& osi, int rowIndex){ // Get pointer to array[getNumRows(OsiClpSolverInterface& osi)] of row upper bounds.
- return osi.getRowUpper()[rowIndex];
+
+double getObjSense(CbcModel& c){
+ return c.getObjSense();
}
-double getObjSense(OsiClpSolverInterface& osi){ // Get objective function sense (1 for min (default), -1 for max).
+
+// Get objective function sense (1 for min (default), -1 for max).
+double getObjSense(OsiClpSolverInterface& osi){
return osi.getObjSense();
}
-void setObjSense(OsiClpSolverInterface& osi, double s){
- osi.setObjSense(s);
-}
-bool isContinuous(OsiClpSolverInterface& osi, int colNumber){ // Return true if column is continuous.
- return osi.isContinuous(colNumber);
-}
-bool isBinary(OsiClpSolverInterface& osi, int colIndex){ // Return true if variable is binary.
- return osi.isBinary(colIndex);
-}
-bool isInteger(OsiClpSolverInterface& osi, int colIndex){ // Return true if column is integer.
- return osi.isInteger(colIndex);
-}
-const CoinPackedMatrix * getMatrixByCol(OsiClpSolverInterface& osi){ // Get pointer to column-wise copy of matrix.
- return osi.getMatrixByCol();
+
+double getObjValue(CbcModel& c){
+ return c.getObjValue();
}
-double getInfinity(OsiClpSolverInterface& osi){ // Get solver's value for infinity.
- return osi.getInfinity();
+
+// Get objective function value.
+double getObjValue(OsiClpSolverInterface& osi){
+ return osi.getObjValue();
}
-//Methods related to querying the solution
-double getColSolution(OsiClpSolverInterface& osi, int colIndex){ // Get pointer to array[getNumCols()] of primal solution vector.
- return osi.getColSolution()[colIndex];
+double getObjValue(OsiSolverInterface& c) {
+ return c.getObjValue();
}
-double getObjValue(OsiClpSolverInterface& osi){ // Get objective function value.
- return osi.getObjValue();
+
+double getRowLower(CbcModel& c, int rowIndex){
+ return c.getRowLower()[rowIndex];
}
-//Changing bounds on variables and constraints
-void setObjCoeff(OsiClpSolverInterface& osi, int elementIndex, double elementValue){// Set an objective function setObjCoeff.
- osi.setObjCoeff(elementIndex,elementValue);
+// Get pointer to array[getNumRows(OsiClpSolverInterface& osi)] of row lower bounds.
+double getRowLower(OsiClpSolverInterface& osi, int rowIndex){
+ return osi.getRowLower()[rowIndex];
}
-void setColLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue){// Set a single column lower bound, Use -DBL_MAX for -infinity.
- osi.setColLower(elementIndex,elementValue);
+
+// Return name of row if one exists or Rnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
+std::string getRowName(OsiClpSolverInterface& osi, int rowIndex, unsigned maxLen){
+ return osi.getRowName(rowIndex,maxLen);
}
-void setColUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue){// Set a single column upper bound, Use DBL_MAX for infinity.
- osi.setColUpper(elementIndex,elementValue);
+
+double getRowUpper(CbcModel& c, int rowIndex){
+ return c.getRowUpper()[rowIndex];
}
-void setColBounds(OsiClpSolverInterface& osi, int elementIndex, double lower, double upper){// Set a single column lower and upper bound.
- osi.setColBounds(elementIndex,lower,upper);
+
+// Get pointer to array[getNumRows(OsiClpSolverInterface& osi)] of row upper bounds.
+double getRowUpper(OsiClpSolverInterface& osi, int rowIndex){
+ return osi.getRowUpper()[rowIndex];
}
-void setRowLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue){// Set a single row lower bound, Use -DBL_MAX for -infinity.
- osi.setRowLower(elementIndex,elementValue);
+
+void initialSolve(CbcModel& c) {
+ c.initialSolve();
}
-void setRowUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue){// Set a single row upper bound, Use DBL_MAX for infinity.
- osi.setRowUpper(elementIndex,elementValue);
+
+void initialSolve(OsiClpSolverInterface& solver){
+ solver.initialSolve();
+ std::cout.flush();
}
-void setObjective(OsiClpSolverInterface& osi, const double *array){// Set the objective coefficients for all columns array [getNumCols()] is an array of values for the objective.
- osi.setObjective(array);
+
+bool isBinary(CbcModel& c, int colIndex){
+ return c.isBinary(colIndex);
}
-void setRowName(OsiClpSolverInterface& osi, int rowIndex, std::string name){// Set name of row.
- osi.setRowName(rowIndex,name);
+
+// Return true if variable is binary.
+bool isBinary(OsiClpSolverInterface& osi, int colIndex){
+ return osi.isBinary(colIndex);
}
-void setColName(OsiClpSolverInterface& osi, int colIndex, std::string name){// Set name of column.
- osi.setColName(colIndex,name);
+
+bool isContinuous(CbcModel& c, int colIndex){
+ return c.isContinuous(colIndex);
}
+// Return true if column is continuous.
+bool isContinuous(OsiClpSolverInterface& osi, int colNumber){
+ return osi.isContinuous(colNumber);
+}
-//Integrality related changing methods
-void setContinuous(OsiClpSolverInterface& osi, int index){// Set the index-th variable to be a continuous variable.
- osi.setContinuous(index);
+bool isInteger(CbcModel& c, int colIndex){
+ return c.isInteger(colIndex);
}
-void setInteger(OsiClpSolverInterface& osi, int index){// Set the index-th variable to be an integer variable.
- osi.setInteger(index);
+
+// Return true if column is integer.
+bool isInteger(OsiClpSolverInterface& osi, int colIndex){
+ return osi.isInteger(colIndex);
}
-/*Methods to expand a problem.
- Note that if a column is added then by default
- it will correspond to a continuous variable. */
+bool isProvenInfeasible(CbcModel& c){
+ return c.isProvenInfeasible();
+}
-void addCol(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj){// Add a column (primal variable) to the problem.
- osi.addCol(numberElements,rows,elements,collb,colub,obj);
+// Create a new instance of CbcModel
+CbcModel* newCbcModel(OsiClpSolverInterface& s){
+ return new CbcModel(s);
}
-void deleteCols(OsiClpSolverInterface& osi, const int num, const int *colIndices){// Remove a set of columns (primal variables) from the problem.
- osi.deleteCols(num,colIndices);
+
+// Default Constructor.
+bool isProvenOptimal(CbcModel& c){
+ return c.isProvenOptimal();
}
-void addRow(OsiClpSolverInterface& osi, int numberElements, const int *columns, const double *element, const double rowlb, const double rowub){// Add a row (constraint) to the problem.
- osi.addRow(numberElements,columns,element,rowlb,rowub);
+
+//Is optimality proven?
+bool isProvenOptimal(OsiClpSolverInterface& osi){
+ return osi.isProvenOptimal();
}
+
void modifyCoefficient(OsiClpSolverInterface& osi, int row, int column, double newElement, bool keepZero){
osi.modifyCoefficient(row,column,newElement,keepZero);
}
-void deleteRows(OsiClpSolverInterface& osi, const int num, const int *rowIndices){// Delete a set of rows (constraints) from the problem.
- osi.deleteRows(num,rowIndices);
+
+OsiClpSolverInterface* newOsiClpSolverInterface(){
+ return new OsiClpSolverInterface();
}
-//Methods to input a problem
-int readLp(OsiClpSolverInterface& osi, const char *filename, const double epsilon){// Read file in LP format (with names).
+// Read file in LP format (with names).
+int readLp(OsiClpSolverInterface& osi, const char* filename, const double epsilon){
osi.readLp(filename,epsilon);
}
-void writeLp(OsiClpSolverInterface& osi, const char *filename, const char *extension, double epsilon, int numberAcross, int decimals, double objSense, bool useRowNames){// Write the problem into an Lp file of the given filename.
- osi.writeLp(filename,extension,epsilon,numberAcross,decimals,objSense,useRowNames);
-}
-// Resolve an LP relaxation after problem modification.
+//Integrality related changing methods
void resolve(OsiSolverInterface& osi) {
osi.resolve();
}
// Returns solver - has current state.
OsiClpSolverInterface* solver(CbcModel& m) {
- OsiSolverInterface *solver = m.solver();
- return dynamic_cast(solver);
+ OsiSolverInterface* solver = m.solver();
+ return dynamic_cast(solver);
}
-// Set current log (detail) level.
+
+void setCoefficients(OsiClpSolverInterface &osi, int row, int numberElements, const int* cols, const double* coefs) {
+ int colCount = osi.getNumCols();
+ for(int col=0;colsetLogLevel(n);
}
@@ -280,8 +335,13 @@ const double* getObjCoefficients(OsiClpSolverInterface& osi) {
return osi.getObjCoefficients();
}
+// Set an objective function setObjCoeff.
+void setObjCoeff(OsiClpSolverInterface& osi, int elementIndex, double elementValue){
+ osi.setObjCoeff(elementIndex,elementValue);
+}
+
// Sets the objective coefficient
-void setObjCoefficients(OsiClpSolverInterface &osi, int numberElements, const int *cols, const double *coefs) {
+void setObjCoefficients(OsiClpSolverInterface &osi, int numberElements, const int* cols, const double* coefs) {
int colCount = osi.getNumCols();
for(int col=0;colgetCoefficient(row, col);
+void setObjSense(CbcModel& c, double s){
+ c.setObjSense(s);
}
// Run the solver using CbcMain1
-void callCbc0 (CbcModel &m) {
- CbcMain0(m);
- std::cout.flush();
+void setObjSense(OsiClpSolverInterface& osi, double s){
+ osi.setObjSense(s);
}
-// Run solver using CbcMain1
-int callCbc1 (int argc, const char *argv[], CbcModel &m) {
- int val = CbcMain1(argc, argv, m);
- std::cout.flush();
- return val;
+// Set a single row lower bound, Use -DBL_MAX for -infinity.
+void setRowLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue){
+ osi.setRowLower(elementIndex,elementValue);
}
-// Get objective function value.
-double getObjValue(OsiSolverInterface& c) {
- return c.getObjValue();
+// Set name of row.
+void setRowName(OsiClpSolverInterface& osi, int rowIndex, std::string name){
+ osi.setRowName(rowIndex,name);
}
-// Get pointer to array[getNumCols()] of primal solution vector.
-double getColSolution(OsiSolverInterface& osi, int colIndex){
- return osi.getColSolution()[colIndex];
+// Set a single row upper bound, Use DBL_MAX for infinity.
+void setRowUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue){
+ osi.setRowUpper(elementIndex,elementValue);
}
-double bestSolution(CbcModel& c, int colIndex){
-return c.bestSolution()[colIndex];
+int status(CbcModel& c) {
+ return c.status();
}
-// Simple method to solve the model with default settings.
-void solve(CbcModel &model) {
-
- int logLevel = 0;
-
- // Reduce printout
- model.setLogLevel(logLevel);
- model.messageHandler()->setLogLevel(logLevel);
- model.solver()->messageHandler()->setLogLevel(logLevel);
- model.solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry);
-
- // TODO initialSolve on Clp
-
- model.initialSolve();
-
- // Could tune more
- double objValue = model.solver()->getObjSense() * model.solver()->getObjValue();
- double minimumDropA=CoinMin(1.0,fabs(objValue)*1.0e-3+1.0e-4);
- double minimumDrop= fabs(objValue)*1.0e-4+1.0e-4;
- model.setMinimumDrop(minimumDrop);
-
-
-
- // Switch off strong branching if wanted
- // model.setNumberStrong(0);
- // Do more strong branching if small
- if (model.getNumCols()<5000)
- model.setNumberStrong(10);
- else
- model.setNumberStrong(20);
- //model.setNumberStrong(5);
- model.setNumberBeforeTrust(5);
-
- model.solver()->setIntParam(OsiMaxNumIterationHotStart,100);
-
- // Default strategy will leave cut generators as they exist already
- // so cutsOnlyAtRoot (1) ignored
- // numberStrong (2) is 5 (default)
- // numberBeforeTrust (3) is 5 (default is 0)
- // printLevel (4) defaults (0)
- CbcStrategyDefault strategy(true,0,0);
-
- // Do complete search
- model.branchAndBound();
-
+void writeLp(OsiClpSolverInterface& osi, const char* filename, const char* extension, double epsilon, int numberAcross, int decimals, double objSense, bool useRowNames){// Write the problem into an Lp file of the given filename.
+ osi.writeLp(filename,extension,epsilon,numberAcross,decimals,objSense,useRowNames);
}
diff --git a/src/main/native/cbc4j.hpp b/src/main/native/cbc4j.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..89094368c236487685f3efee1e7eb7f4fb3dfa0c
--- /dev/null
+++ b/src/main/native/cbc4j.hpp
@@ -0,0 +1,89 @@
+#ifndef CBC4J_H
+#define CBC4J_H
+#include
+#include
+#include
+using namespace std;
+#include "CbcModel.hpp"
+#include "CbcStrategy.hpp"
+#include "OsiClpSolverInterface.hpp"
+#include "CoinTime.hpp"
+#include "CbcHeuristicFPump.hpp"
+
+void addCol(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj);
+void addRow(OsiClpSolverInterface& osi, int numberElements, const int *columns, const double *element, const double rowlb, const double rowub);
+double bestSolution(CbcModel& c, int colIndex);
+void branchAndBound(CbcModel& c, int doStatistics = 0);
+void callCbc0 (CbcModel &m);
+int callCbc1 (int argc, const char *argv[], CbcModel & babSolver);
+void deleteCbcModel(CbcModel* c);
+void deleteCols(OsiClpSolverInterface& osi, const int num, const int *colIndices);
+void deleteRows(OsiClpSolverInterface& osi, const int num, const int *rowIndices);
+void deleteOsiClpSolverInterface(OsiClpSolverInterface* solver);
+double getCbcColSolution(CbcModel& c, int colIndex);
+double getCbcRowLower(CbcModel& c, int rowIndex);
+double getCbcRowUpper(CbcModel& c, int rowIndex);
+double getCoefficient(OsiClpSolverInterface& osi, int row, int col);
+double getColLower(CbcModel& c, int colIndex);
+double getColLower(OsiClpSolverInterface& osi, int elementIndex);
+std::string getColName(OsiClpSolverInterface& osi, int colIndex, unsigned maxLen=std::string::npos);
+double getColSolution(OsiClpSolverInterface& osi, int colIndex);
+double getColSolution(OsiSolverInterface& osi, int colIndex);
+double getColUpper(CbcModel& c, int colIndex);
+double getColUpper(OsiClpSolverInterface& osi, int elementIndex);
+double getInfinity(CbcModel& c);
+double getInfinity(OsiClpSolverInterface& osi);
+double getObjCoefficients(CbcModel& c, int colIndex);
+double getObjSense(CbcModel& c);
+int getNumCols(CbcModel& c);
+int getNumCols(OsiClpSolverInterface& osi);
+int getNumRows(CbcModel& c);
+int getNumRows(OsiClpSolverInterface& osi);
+double getObjCoefficients(OsiClpSolverInterface& osi, int elementIndex);
+const double* getObjCoefficients(OsiClpSolverInterface& osi);
+double getObjValue(CbcModel& c);
+double getObjValue(OsiClpSolverInterface& osi);
+double getObjValue(OsiSolverInterface& c);
+double getObjSense(OsiClpSolverInterface& osi);
+double getRowLower(CbcModel& c, int rowIndex);
+double getRowLower(OsiClpSolverInterface& osi, int rowIndex);
+std::string getRowName(OsiClpSolverInterface& osi, int rowIndex, unsigned maxLen=std::string::npos);
+double getRowUpper(CbcModel& c, int rowIndex);
+double getRowUpper(OsiClpSolverInterface& osi, int rowIndex);
+void initialSolve(CbcModel& c);
+void initialSolve(OsiClpSolverInterface& solver);
+bool isBinary(CbcModel& c, int colIndex);
+bool isBinary(OsiClpSolverInterface& osi, int colIndex);
+bool isContinuous(CbcModel& c, int colIndex);
+bool isContinuous(OsiClpSolverInterface& osi, int colNumber);
+bool isInteger(CbcModel& c, int colIndex);
+bool isInteger(OsiClpSolverInterface& osi, int colIndex);
+bool isProvenOptimal(CbcModel& c);
+bool isProvenOptimal(OsiClpSolverInterface& osi);
+bool isProvenInfeasible(CbcModel& c);
+CbcModel* newCbcModel(OsiClpSolverInterface& s);
+OsiClpSolverInterface* newOsiClpSolverInterface();
+void modifyCoefficient(OsiClpSolverInterface& osi, int row, int column, double newElement, bool keepZero=false);
+int readLp(OsiClpSolverInterface& osi, const char *filename, const double epsilon=1e-5);
+void resolve(OsiSolverInterface& osi);
+void setCoefficients(OsiClpSolverInterface& osi, int row, int numberElements, const int *cols, const double *coefs);
+void setColBounds(OsiClpSolverInterface& osi, int elementIndex, double lower, double upper);
+void setColLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+void setColName(OsiClpSolverInterface& osi, int colIndex, std::string name);
+void setColUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+void setContinuous(OsiClpSolverInterface& osi, int index);
+void setInteger(OsiClpSolverInterface& osi, int index);
+void setLogLevel(CbcModel& c, int n);
+void setLogLevel(OsiClpSolverInterface& s, int n);
+void setObjective(OsiClpSolverInterface& osi, const double *array);
+void setObjCoeff(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+void setObjCoefficients(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *coefs);
+void setObjSense(CbcModel& c, double s);
+void setObjSense(OsiClpSolverInterface& osi, double s);
+void setRowLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+void setRowName(OsiClpSolverInterface& osi, int rowIndex, std::string name);
+void setRowUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+OsiClpSolverInterface* solver(CbcModel& m);
+int status(CbcModel& c);
+void writeLp(OsiClpSolverInterface& osi, const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true);
+#endif
diff --git a/src/main/native/cbc4j.i b/src/main/native/cbc4j.i
new file mode 100644
index 0000000000000000000000000000000000000000..87290cb2d0973981ae1a609d7f680d55d69e9376
--- /dev/null
+++ b/src/main/native/cbc4j.i
@@ -0,0 +1,92 @@
+%module cbc4j
+%{
+#include "cbc4j.hpp"
+%}
+%include "arrays_java.i";
+%include "std_string.i";
+%include "various.i"
+%apply double[] {double *};
+%apply int[] {int *};
+%apply char **STRING_ARRAY { const char *argv[] }
+using namespace std;
+typedef std::string String;
+%typemap(out) const double* {
+$result = SWIG_JavaArrayOutDouble(jenv, $1, arg1->getNumCols());
+}
+
+extern void addCol(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj);
+extern void addRow(OsiClpSolverInterface& osi, int numberElements, const int *columns, const double *element, const double rowlb, const double rowub);
+extern double bestSolution(CbcModel& c, int colIndex);
+extern void branchAndBound(CbcModel& c, int doStatistics = 0);
+extern void callCbc0 (CbcModel &m);
+extern int callCbc1 (int argc, const char *argv[], CbcModel & babSolver);
+extern void deleteCbcModel(CbcModel* c);
+extern void deleteCols(OsiClpSolverInterface& osi, const int num, const int *colIndices);
+extern void deleteRows(OsiClpSolverInterface& osi, const int num, const int *rowIndices);
+extern void deleteOsiClpSolverInterface(OsiClpSolverInterface* solver);
+extern double getCbcColSolution(CbcModel& c, int colIndex);
+extern double getCbcRowLower(CbcModel& c, int rowIndex);
+extern double getCbcRowUpper(CbcModel& c, int rowIndex);
+extern double getCoefficient(OsiClpSolverInterface& osi, int row, int col);
+extern double getColLower(CbcModel& c, int colIndex);
+extern double getColLower(OsiClpSolverInterface& osi, int elementIndex);
+extern std::string getColName(OsiClpSolverInterface& osi, int colIndex, unsigned maxLen=std::string::npos);
+extern double getColSolution(OsiClpSolverInterface& osi, int colIndex);
+extern double getColSolution(OsiSolverInterface& osi, int colIndex);
+extern double getColUpper(CbcModel& c, int colIndex);
+extern double getColUpper(OsiClpSolverInterface& osi, int elementIndex);
+extern double getInfinity(CbcModel& c);
+extern double getInfinity(OsiClpSolverInterface& osi);
+extern double getObjCoefficients(CbcModel& c, int colIndex);
+extern double getObjSense(CbcModel& c);
+extern int getNumCols(CbcModel& c);
+extern int getNumCols(OsiClpSolverInterface& osi);
+extern int getNumRows(CbcModel& c);
+extern int getNumRows(OsiClpSolverInterface& osi);
+extern double getObjCoefficients(OsiClpSolverInterface& osi, int elementIndex);
+extern const double* getObjCoefficients(OsiClpSolverInterface& osi);
+extern double getObjValue(CbcModel& c);
+extern double getObjValue(OsiClpSolverInterface& osi);
+extern double getObjValue(OsiSolverInterface& c);
+extern double getObjSense(OsiClpSolverInterface& osi);
+extern double getRowLower(CbcModel& c, int rowIndex);
+extern double getRowLower(OsiClpSolverInterface& osi, int rowIndex);
+extern std::string getRowName(OsiClpSolverInterface& osi, int rowIndex, unsigned maxLen=std::string::npos);
+extern double getRowUpper(CbcModel& c, int rowIndex);
+extern double getRowUpper(OsiClpSolverInterface& osi, int rowIndex);
+extern void initialSolve(CbcModel& c);
+extern void initialSolve(OsiClpSolverInterface& solver);
+extern bool isBinary(CbcModel& c, int colIndex);
+extern bool isBinary(OsiClpSolverInterface& osi, int colIndex);
+extern bool isContinuous(CbcModel& c, int colIndex);
+extern bool isContinuous(OsiClpSolverInterface& osi, int colNumber);
+extern bool isInteger(CbcModel& c, int colIndex);
+extern bool isInteger(OsiClpSolverInterface& osi, int colIndex);
+extern bool isProvenOptimal(CbcModel& c);
+extern bool isProvenOptimal(OsiClpSolverInterface& osi);
+extern bool isProvenInfeasible(CbcModel& c);
+extern CbcModel* newCbcModel(OsiClpSolverInterface& s);
+extern OsiClpSolverInterface* newOsiClpSolverInterface();
+extern void modifyCoefficient(OsiClpSolverInterface& osi, int row, int column, double newElement, bool keepZero=false);
+extern int readLp(OsiClpSolverInterface& osi, const char *filename, const double epsilon=1e-5);
+extern void resolve(OsiSolverInterface& osi);
+extern void setCoefficients(OsiClpSolverInterface& osi, int row, int numberElements, const int *cols, const double *coefs);
+extern void setColBounds(OsiClpSolverInterface& osi, int elementIndex, double lower, double upper);
+extern void setColLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+extern void setColName(OsiClpSolverInterface& osi, int colIndex, std::string name);
+extern void setColUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+extern void setContinuous(OsiClpSolverInterface& osi, int index);
+extern void setInteger(OsiClpSolverInterface& osi, int index);
+extern void setLogLevel(CbcModel& c, int n);
+extern void setLogLevel(OsiClpSolverInterface& s, int n);
+extern void setObjective(OsiClpSolverInterface& osi, const double *array);
+extern void setObjCoeff(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+extern void setObjCoefficients(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *coefs);
+extern void setObjSense(CbcModel& c, double s);
+extern void setObjSense(OsiClpSolverInterface& osi, double s);
+extern void setRowLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+extern void setRowName(OsiClpSolverInterface& osi, int rowIndex, std::string name);
+extern void setRowUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue);
+extern OsiClpSolverInterface* solver(CbcModel& m);
+extern int status(CbcModel& c);
+extern void writeLp(OsiClpSolverInterface& osi, const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true);
diff --git a/src/main/native/javacbc.hpp b/src/main/native/javacbc.hpp
deleted file mode 100644
index bc63b35d0768fa3a4d7574e9d8712381dc640423..0000000000000000000000000000000000000000
--- a/src/main/native/javacbc.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#ifndef JAVACBC_H
-#define JAVACBC_H
-
-#include
-#include
-#include
-using namespace std;
-// For Branch and bound
-#include "CbcModel.hpp"
-#include "CbcStrategy.hpp"
-#include "OsiClpSolverInterface.hpp"
-
-#include "CoinTime.hpp"
-#include "CbcHeuristicFPump.hpp"
-
-// Solve initial LP relaxation.
-void initialSolve(OsiClpSolverInterface& solver);
-
-void setInt(OsiClpSolverInterface& solver, int i);
-
-// Default Constructor.
-OsiClpSolverInterface* newOsiClpSolverInterface();
-
-// Delete OsiClpSolverInterface
-void deleteOsiClpSolverInterface(OsiClpSolverInterface* solver);
-
-// Create a new instance of CbcModel
-CbcModel* newCbcModel(OsiClpSolverInterface& s);
-void deleteCbcModel(CbcModel* c);
-
-void initialSolve(CbcModel& c);
-void branchAndBound(CbcModel& c, int doStatistics = 0);
-int status(CbcModel& c);
-bool isProvenOptimal(CbcModel& c);
-bool isProvenInfeasible(CbcModel& c);
-int getNumCols(CbcModel& c);
-int getNumRows(CbcModel& c) ;
-double getColLower(CbcModel& c, int colIndex);
-double getColUpper(CbcModel& c, int colIndex);
-double getRowLower(CbcModel& c, int rowIndex);
-double getRowUpper(CbcModel& c, int rowIndex);
-double getObjCoefficients(CbcModel& c, int colIndex);
-double getObjSense(CbcModel& c);
-void setObjSense(CbcModel& c, double s);
-bool isContinuous(CbcModel& c, int colIndex);
-bool isBinary(CbcModel& c, int colIndex);
-bool isInteger(CbcModel& c, int colIndex);
-const CoinPackedMatrix* getMatrixByCol(CbcModel& c);
-double getInfinity(CbcModel& c);
-double getCbcRowLower(CbcModel& c, int rowIndex);
-double getCbcRowUpper(CbcModel& c, int rowIndex);
-double getCbcColSolution(CbcModel& c, int colIndex);
-double getObjValue(CbcModel& c);
-void setLogLevel(CbcModel& c, int n);
-
-//OsiClpInterface proxy methods
-//Methods returning info on how the solution process terminated
-bool isProvenOptimal(OsiClpSolverInterface& osi); //Is optimality proven?
-
-//Methods related to querying the input data
-int getNumCols(OsiClpSolverInterface& osi);// Get number of columns.
-int getNumRows(OsiClpSolverInterface& osi);// Get number of rows.
-std::string getRowName(OsiClpSolverInterface& osi, int rowIndex, unsigned maxLen=std::string::npos);// Return name of row if one exists or Rnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
-std::string getColName(OsiClpSolverInterface& osi, int colIndex, unsigned maxLen=std::string::npos);// Return name of column if one exists or Cnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
-double getColLower(OsiClpSolverInterface& osi, int elementIndex);// Get pointer to array[getNumCols(OsiClpSolverInterface osi)] of column lower bounds.
-double getColUpper(OsiClpSolverInterface& osi, int elementIndex);// Get pointer to array[getNumCols(OsiClpSolverInterface osi)] of column upper bounds.
-double getObjCoefficients(OsiClpSolverInterface& osi, int elementIndex);// Get pointer to array[getNumCols(OsiClpSolverInterface osi)] of objective function coefficients.
-double getRowLower(OsiClpSolverInterface& osi, int rowIndex);// Get pointer to array[getNumRows(OsiClpSolverInterface osi)] of row lower bounds.
-double getRowUpper(OsiClpSolverInterface& osi, int rowIndex);// Get pointer to array[getNumRows(OsiClpSolverInterface osi)] of row upper bounds.
-double getObjSense(OsiClpSolverInterface& osi);// Get objective function sense (1 for min (default), -1 for max).
-void setObjSense(OsiClpSolverInterface& osi, double s); // Sets objective function sense (1 for min (default), -1 for max).
-bool isContinuous(OsiClpSolverInterface& osi, int colNumber);// Return true if column is continuous.
-bool isBinary(OsiClpSolverInterface& osi, int colIndex);// Return true if variable is binary.
-bool isInteger(OsiClpSolverInterface& osi, int colIndex);// Return true if column is integer.
-const CoinPackedMatrix * getMatrixByCol(OsiClpSolverInterface& osi);// Get pointer to column-wise copy of matrix.
-double getInfinity(OsiClpSolverInterface& osi);// Get solver's value for infinity.
-
-//Methods related to querying the solution
-double getColSolution(OsiClpSolverInterface& osi, int colIndex);// Get pointer to array[getNumCols()] of primal solution vector.
-double getObjValue(OsiClpSolverInterface& osi);// Get objective function value.
-
-//Changing bounds on variables and constraints
-void setObjCoeff(OsiClpSolverInterface& osi, int elementIndex, double elementValue);// Set an objective function coefficient.
-void setColLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue);// Set a single column lower bound, Use -DBL_MAX for -infinity.
-void setColUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue);// Set a single column upper bound, Use DBL_MAX for infinity.
-void setColBounds(OsiClpSolverInterface& osi, int elementIndex, double lower, double upper);// Set a single column lower and upper bound.
-void setRowLower(OsiClpSolverInterface& osi, int elementIndex, double elementValue);// Set a single row lower bound, Use -DBL_MAX for -infinity.
-void setRowUpper(OsiClpSolverInterface& osi, int elementIndex, double elementValue);// Set a single row upper bound, Use DBL_MAX for infinity.
-void setObjective(OsiClpSolverInterface& osi, const double *array);// Set the objective coefficients for all columns array [getNumCols()] is an array of values for the objective.
-void setRowName(OsiClpSolverInterface& osi, int rowIndex, std::string name);// Set name of row.
-void setColName(OsiClpSolverInterface& osi, int colIndex, std::string name);// Set name of column.
-
-
-//Integrality related changing methods
-void setContinuous(OsiClpSolverInterface& osi, int index);// Set the index-th variable to be a continuous variable.
-void setInteger(OsiClpSolverInterface& osi, int index);// Set the index-th variable to be an integer variable.
-
-/*Methods to expand a problem.
- Note that if a column is added then by default
- it will correspond to a continuous variable. */
-
-void addCol(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj);// Add a column (primal variable) to the problem.
-void deleteCols(OsiClpSolverInterface& osi, const int num, const int *colIndices);// Remove a set of columns (primal variables) from the problem.
-void addRow(OsiClpSolverInterface& osi, int numberElements, const int *columns, const double *element, const double rowlb, const double rowub);// Add a row (constraint) to the problem.
-void modifyCoefficient(OsiClpSolverInterface& osi, int row, int column, double newElement, bool keepZero=false);
-void deleteRows(OsiClpSolverInterface& osi, const int num, const int *rowIndices);// Delete a set of rows (constraints) from the problem.
-
-//Methods to input a problem
-int readLp(OsiClpSolverInterface& osi, const char *filename, const double epsilon=1e-5);// Read file in LP format (with names).
-void writeLp(OsiClpSolverInterface& osi, const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true);// Write the problem into an Lp file of the given filename.
-
-// Resolve an LP relaxation after problem modification.
-void resolve(OsiSolverInterface& osi);
-
-// Returns solver - has current state.
-OsiClpSolverInterface* solver(CbcModel& m);
-// Set current log (detail) level.
-void setLogLevel(OsiClpSolverInterface& s, int n);
-// Get pointer to array[getNumCols()] of objective function coefficients.
-const double* getObjCoefficients(OsiClpSolverInterface& osi);
-// Sets the objective coefficient
-void setObjCoefficients(OsiClpSolverInterface& osi, int numberElements, const int *rows, const double *coefs);
-// Sets the coefficients for a row
-void setCoefficients(OsiClpSolverInterface& osi, int row, int numberElements, const int *cols, const double *coefs);
-// Return the coefficient.
-double getCoefficient(OsiClpSolverInterface& osi, int row, int col);
-// Sun the solver using CbcMain1
-void callCbc0 (CbcModel &m);
-int callCbc1 (int argc, const char *argv[], CbcModel & babSolver);
-// Get objective function value.
-double getObjValue(OsiSolverInterface& c);
-// Get pointer to array[getNumCols()] of primal solution vector.
-double getColSolution(OsiSolverInterface& osi, int colIndex);
-
-double bestSolution(CbcModel& c, int colIndex);
-#endif
diff --git a/src/main/native/javacbc.i b/src/main/native/javacbc.i
deleted file mode 100644
index a61277147b4590ae228f3ba1eba28697db9df050..0000000000000000000000000000000000000000
--- a/src/main/native/javacbc.i
+++ /dev/null
@@ -1,145 +0,0 @@
-%module javacbc
-%{
-#include "javacbc.hpp"
-%}
-
-%include "arrays_java.i";
-%include "std_string.i";
-%include "various.i"
-
-%apply double[] {double *};
-%apply int[] {int *};
-%apply char **STRING_ARRAY { const char *argv[] }
-
-using namespace std;
-typedef std::string String;
-
-// Solve initial LP relaxation.
-extern void initialSolve(OsiClpSolverInterface &solver);
-
-extern void setInt(OsiClpSolverInterface &solver, int i);
-
-// Default Constructor.
-extern OsiClpSolverInterface* newOsiClpSolverInterface();
-
-// Delete OsiClpSolverInterface
-extern void deleteOsiClpSolverInterface(OsiClpSolverInterface* solver);
-
-// Create a new instance of CbcModel
-extern CbcModel* newCbcModel(OsiClpSolverInterface &s);
-extern void deleteCbcModel(CbcModel* c);
-extern void initialSolve(CbcModel &c);
-extern void branchAndBound(CbcModel &c, int doStatistics = 0);
-extern int status(CbcModel &c);
-extern bool isProvenOptimal(CbcModel &c);
-extern bool isProvenInfeasible(CbcModel &c);
-extern int getNumCols(CbcModel &c);
-extern int getNumRows(CbcModel &c) ;
-
-extern double getColLower(CbcModel &c, int colIndex);
-extern double getColUpper(CbcModel &c, int colIndex);
-extern double getObjCoefficients(CbcModel &c, int colIndex);
-extern double getCbcColSolution(CbcModel &c, int colIndex);
-
-extern double getRowLower(CbcModel &c, int rowIndex);
-extern double getRowUpper(CbcModel &c, int rowIndex);
-extern double getCbcRowLower(CbcModel &c, int rowIndex);
-extern double getCbcRowUpper(CbcModel &c, int rowIndex);
-
-extern double getObjSense(CbcModel &c);
-extern void setObjSense(CbcModel &c, double s);
-extern bool isContinuous(CbcModel &c, int colIndex);
-extern bool isBinary(CbcModel &c, int colIndex);
-extern bool isInteger(CbcModel &c, int colIndex);
-extern const CoinPackedMatrix* getMatrixByCol(CbcModel &c);
-extern double getInfinity(CbcModel &c);
-extern double getObjValue(CbcModel &c);
-extern void setLogLevel(CbcModel &c, int n);
-
-//OsiClpSolverInterface proxy functions and constructor
-//Methods returning info on how the solution process terminated
-extern bool isProvenOptimal(OsiClpSolverInterface &osi); //Is optimality proven?
-
-//Methods related to querying the input data
-extern int getNumCols(OsiClpSolverInterface &osi);// Get number of columns.
-extern int getNumRows(OsiClpSolverInterface &osi);// Get number of rows.
-extern std::string getRowName(OsiClpSolverInterface &osi, int rowIndex, unsigned maxLen=std::string::npos);// Return name of row if one exists or Rnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
-extern std::string getColName(OsiClpSolverInterface &osi, int colIndex, unsigned maxLen=std::string::npos);// Return name of column if one exists or Cnnnnnnn maxLen is currently ignored and only there to match the signature from the base class!
-
-extern double getColLower(OsiClpSolverInterface &osi, int elementIndex); // Get pointer to array[getNumCols()] of column lower bounds.
-extern double getColUpper(OsiClpSolverInterface &osi, int elementIndex); // Get pointer to array[getNumCols()] of column upper bounds.
-extern double getObjCoefficients(OsiClpSolverInterface &osi, int elementIndex); // Get pointer to array[getNumCols()] of objective function coefficients.
-
-extern double getRowLower(OsiClpSolverInterface &osi, int rowIndex);// Get pointer to array[getNumRows()] of row lower bounds.
-extern double getRowUpper(OsiClpSolverInterface &osi, int rowIndex);// Get pointer to array[getNumRows()] of row upper bounds.
-
-extern double getObjSense(OsiClpSolverInterface &osi);// Get objective function sense (1 for min (default), -1 for max).
-extern void setObjSense(OsiClpSolverInterface &osi, double s);// Sets objective function sense (1 for min (default), -1 for max).
-extern bool isContinuous(OsiClpSolverInterface &osi, int colNumber);// Return true if column is continuous.
-extern bool isBinary(OsiClpSolverInterface &osi, int colIndex);// Return true if variable is binary.
-extern bool isInteger(OsiClpSolverInterface &osi, int colIndex);// Return true if column is integer.
-extern const CoinPackedMatrix * getMatrixByCol(OsiClpSolverInterface &osi);// Get pointer to column-wise copy of matrix.
-extern double getInfinity(OsiClpSolverInterface &osi);// Get solver's value for infinity.
-
-//Methods related to querying the solution
-extern double getColSolution(OsiClpSolverInterface &osi, int colIndex);// Get pointer to array[getNumCols()] of primal solution vector.
-extern double getObjValue(OsiClpSolverInterface &osi);// Get objective function value.
-
-//Changing bounds on variables and constraints
-void setObjCoeff(OsiClpSolverInterface &osi, int elementIndex, double elementValue);// Set an objective function coefficient.
-void setColLower(OsiClpSolverInterface &osi, int elementIndex, double elementValue);// Set a single column lower bound, Use -DBL_MAX for -infinity.
-void setColUpper(OsiClpSolverInterface &osi, int elementIndex, double elementValue);// Set a single column upper bound, Use DBL_MAX for infinity.
-void setColBounds(OsiClpSolverInterface &osi, int elementIndex, double lower, double upper);// Set a single column lower and upper bound.
-void setRowLower(OsiClpSolverInterface &osi, int elementIndex, double elementValue);// Set a single row lower bound, Use -DBL_MAX for -infinity.
-void setRowUpper(OsiClpSolverInterface &osi, int elementIndex, double elementValue);// Set a single row upper bound, Use DBL_MAX for infinity.
-void setObjective(OsiClpSolverInterface &osi, const double *array);// Set the objective coefficients for all columns array [getNumCols()] is an array of values for the objective.
-void setRowName(OsiClpSolverInterface &osi, int rowIndex, std::string name);// Set name of row.
-void setColName(OsiClpSolverInterface &osi, int colIndex, std::string name);// Set name of column.
-
-
-//Integrality related changing methods
-void setContinuous(OsiClpSolverInterface &osi, int index);// Set the index-th variable to be a continuous variable.
-void setInteger(OsiClpSolverInterface &osi, int index);// Set the index-th variable to be an integer variable.
-
-//Methods to expand a problem.
-//Note that if a column is added then by default
-//it will correspond to a continuous variable.
-
-extern void addCol(OsiClpSolverInterface &osi, int numberElements, const int *rows, const double *elements, const double collb, const double colub, const double obj);// Add a column (primal variable) to the problem.
-extern void deleteCols(OsiClpSolverInterface &osi, const int num, const int *colIndices);// Remove a set of columns (primal variables) from the problem.
-extern void addRow(OsiClpSolverInterface &osi, int numberElements, const int *columns, const double *element, const double rowlb, const double rowub);// Add a row (constraint) to the problem.
-extern void modifyCoefficient(OsiClpSolverInterface &osi, int row, int column, double newElement, bool keepZero=false);
-extern void deleteRows(OsiClpSolverInterface &osi, const int num, const int *rowIndices);// Delete a set of rows (constraints) from the problem.
-
-//Methods to input a problem
-extern int readLp(OsiClpSolverInterface &osi, const char *filename, const double epsilon=1e-5);// Read file in LP format (with names).
-extern void writeLp(OsiClpSolverInterface &osi, const char *filename, const char *extension="lp", double epsilon=1e-5, int numberAcross=10, int decimals=5, double objSense=0.0, bool useRowNames=true);// Write the problem into an Lp file of the given filename.
-
-// Resolve an LP relaxation after problem modification.
-extern void resolve(OsiSolverInterface& osi);
-
-// Returns solver - has current state.
-extern OsiClpSolverInterface* solver(CbcModel &m);
-// Set current log (detail) level.
-extern void setLogLevel(OsiClpSolverInterface &s, int n);
-// Get pointer to array[getNumCols()] of objective function coefficients.
-%typemap(out) const double* {
-$result = SWIG_JavaArrayOutDouble(jenv, $1, arg1->getNumCols());
-}
-extern const double* getObjCoefficients(OsiClpSolverInterface &osi);
-// Sets the objective coefficient
-extern void setObjCoefficients(OsiClpSolverInterface &osi, int numberElements, const int *rows, const double *coefs);
-// Sets the coefficients for a row
-extern void setCoefficients(OsiClpSolverInterface &osi, int row, int numberElements, const int *cols, const double *coefs);
-// Return the coefficient.
-extern double getCoefficient(OsiClpSolverInterface &osi, int row, int col);
-// Run the solver using CbcMain0
-extern void callCbc0 (CbcModel &babSolver);
-// Run the solver using CbcMain1
-extern int callCbc1 (int argc, const char *argv[], CbcModel &babSolver);
-// Get objective function value.
-extern double getObjValue(OsiSolverInterface& c);
-// Get pointer to array[getNumCols()] of primal solution vector.
-extern double getColSolution(OsiSolverInterface& osi, int colIndex);
-
-extern double bestSolution(CbcModel& c, int colIndex);