Skip to content

Commit

Permalink
change scip to scipmp (#206)
Browse files Browse the repository at this point in the history
* init scip solver driver

* minimal driver

* add basic functionalities

* fix primal solution

* change getPROBDATA to cons

* change getPROBDATA v2

* fix test

* add indicator constraint LinLE

* add indicator constraint LinGE

* add indicator constraint LinEQ

* change indicator constraint to recommended

* add or, and constraint

* handle char and bool param

* add more options

* improve readme and changes

* disable sepa of indicator cons

* improve memory handling

* add linearHelper method

* add indicator helper method

* add quadratic helper method

* add pool solution

* add abs, sin and cosfunctions

* add exp and log function

* add pow function

* add more options and concurrent mode

* improve tests

* add more options

* add last options

* adapt mipstart header

* Update CHANGES.scip.md

* add option to x-multimip1

* change cmake

* add variable names

* change scip to scipmp

* change cmake

* add docu

* add scipmp test

* delete scip
  • Loading branch information
jurgen-lentz authored May 3, 2023
1 parent 307075e commit 52500d3
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 12 deletions.
12 changes: 12 additions & 0 deletions doc/rst/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ does not have automatic dependency detection), you can use the following::
-DCOPT_LIBS=d:/copt/libs/win64/copt.lib
-DCOPT_INCLUDE_DIRS=d:/copt/include

To build the solver *scipmp* statically (on Linux or MacOS), you need to make sure
to add all its dependencies. The following cmake command builds *scipmp* assuming
that it is installed with the LP solver SoPlex, the arithmetic library GMP and
the library bliss for symmetry detection (*SCIP* and its dependencies are all
installed in the standard location)::

cmake .. -DBUILD=scipmp
-DSCIP_LIBS="/usr/local/lib/libscip.a;/usr/local/lib/libsoplex.a;/usr/local/lib/libgmp.a;/usr/local/lib/libbliss.a"
-DSCIP_INCLUDE_DIRS=/usr/local/include

Note: Any other dependency can be used in the same way.

Similarly, for *ortoolsmp* (on MacOS) assuming *ortools* is installed in
the standard location::

Expand Down
2 changes: 1 addition & 1 deletion solvers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ add_ampl_backend(cbcmp DLL_RUNTIME SHARED_LIB MODULE CBC
LIBRARIES ${CBC_LIBS} ${CMAKE_DL_LIBS})


add_ampl_backend(scip DLL_RUNTIME SHARED_LIB MODULE SCIP
add_ampl_backend(scipmp DLL_RUNTIME SHARED_LIB MODULE SCIP
LIBRARIES ${SCIP_LIBS} ${CMAKE_DL_LIBS})

add_ampl_backend(highsmp DLL_RUNTIME SHARED_LIB MODULE HIGHS
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion solvers/scip/main.cc → solvers/scipmp/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Declare a backend factory
std::unique_ptr<mp::BasicBackend> CreateScipBackend();

extern "C" int main1(int, char **argv) {
int main(int, char **argv) {
return
mp::RunBackendApp(argv, CreateScipBackend);
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion solvers/scip/scip-lib.c → solvers/scipmp/scipmp-lib.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "scip/scip-ampls-c-api.h"
#include "scipmp/scipmp-ampls-c-api.h"

#ifdef _WIN32
#define APIEXPORT __declspec(dllexport)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "mp/flat/redef/MIP/converter_mip.h"
#include "mp/flat/model_api_connect.h"

#include "scipmodelapi.h"
#include "scipmpmodelapi.h"


namespace mp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include "mp/env.h"
#include "mp/flat/model_api_base.h"
#include "scipbackend.h"
#include "scipmpbackend.h"

extern "C" {
#include "scip-ampls-c-api.h" // Scip AMPLS C API
#include "scipmp-ampls-c-api.h" // Scip AMPLS C API
}
#include "mp/ampls-cpp-api.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "mp/backend-mip.h"
#include "mp/flat/backend_flat.h"
#include "scipcommon.h"
#include "scipmpcommon.h"

namespace mp {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mp/format.h"
#include "scipcommon.h"
#include "scipmpcommon.h"

static
SCIP_DECL_PROBDELORIG(probdataDelOrigNl)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "scipmodelapi.h"
#include "scipmpmodelapi.h"

namespace mp {

Expand Down Expand Up @@ -28,8 +28,10 @@ void ScipModelAPI::AddVariables(const VarArrayDef& v) {
vartype = SCIP_VARTYPE_INTEGER;
else
vartype = SCIP_VARTYPE_CONTINUOUS;
//const char* name = v.pnames()[i];
SCIP_CCALL( SCIPcreateVarBasic(getSCIP(), &var, NULL, lb, ub, objcoef, vartype) );
const char* name = NULL;
if (v.pnames() != NULL)
const char* name = v.pnames()[i];
SCIP_CCALL( SCIPcreateVarBasic(getSCIP(), &var, name, lb, ub, objcoef, vartype) );
SCIP_CCALL( SCIPaddVar(getSCIP(), var) );
getPROBDATA()->vars[i] = var;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <memory>

#include "mp/env.h"
#include "scipcommon.h"
#include "scipmpcommon.h"
#include "mp/flat/model_api_base.h"
#include "mp/flat/constr_std.h"

Expand Down
1 change: 1 addition & 0 deletions test/end2end/scripts/python/SolverCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def addStdSolvers(solvers: SolverCollection, binPath=""):
solvers.addSolver(Solver.MosekSolver(path.join(binPath,"mosek")))
solvers.addSolver(Solver.CbcMPSolver(path.join(binPath, "cbc")))
solvers.addSolver(Solver.SCIPSolver(path.join(binPath, "scip")))
solvers.addSolver(Solver.SCIPSolver(path.join(binPath, "scipmp")))
solvers.addSolver(Solver.CPLEXODHSolver(path.join(binPath, "cplexodh")))
solvers.addSolver(Solver.GUROBIODHSolver(path.join(binPath, "gurobiodh")))

Expand Down

0 comments on commit 52500d3

Please sign in to comment.