preliminary support for SCIP in bazel
This commit is contained in:
32
WORKSPACE
32
WORKSPACE
@@ -1,6 +1,17 @@
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
|
||||
|
||||
http_archive(
|
||||
name = "zlib",
|
||||
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
|
||||
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
|
||||
strip_prefix = "zlib-1.2.11",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz",
|
||||
"https://zlib.net/zlib-1.2.11.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
git_repository(
|
||||
name = "com_github_gflags_gflags",
|
||||
commit = "e171aa2", # release v2.2.2
|
||||
@@ -19,6 +30,15 @@ git_repository(
|
||||
remote = "https://github.com/bazelbuild/bazel-skylib.git",
|
||||
)
|
||||
|
||||
# Python Rules
|
||||
http_archive(
|
||||
name = "rules_python",
|
||||
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz",
|
||||
strip_prefix = "rules_python-0.0.2",
|
||||
sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c",
|
||||
)
|
||||
|
||||
# Protobuf
|
||||
git_repository(
|
||||
name = "com_google_protobuf",
|
||||
commit = "678da4f", # release v3.12.2
|
||||
@@ -45,16 +65,16 @@ http_archive(
|
||||
http_archive(
|
||||
name = "glpk",
|
||||
build_file = "//bazel:glpk.BUILD",
|
||||
sha256 = "9a5dab356268b4f177c33e00ddf8164496dc2434e83bd1114147024df983a3bb",
|
||||
url = "http://ftp.gnu.org/gnu/glpk/glpk-4.52.tar.gz",
|
||||
sha256 = "4281e29b628864dfe48d393a7bedd781e5b475387c20d8b0158f329994721a10",
|
||||
url = "http://ftp.gnu.org/gnu/glpk/glpk-4.65.tar.gz",
|
||||
)
|
||||
|
||||
load("//bazel:archive_helper.bzl", "local_archive")
|
||||
|
||||
local_archive(
|
||||
http_archive(
|
||||
name = "scip",
|
||||
build_file = "//bazel:scip.BUILD",
|
||||
src = "//dependencies/archives:scip-7.0.1.tgz",
|
||||
patches = [ "//bazel:scip.patch" ],
|
||||
sha256 = "033bf240298d3a1c92e8ddb7b452190e0af15df2dad7d24d0572f10ae8eec5aa",
|
||||
url = "https://github.com/google/or-tools/releases/download/v7.7/scip-7.0.1.tgz",
|
||||
)
|
||||
|
||||
#http_archive(
|
||||
|
||||
@@ -3,6 +3,7 @@ exports_files([
|
||||
"glpk.BUILD",
|
||||
"swig.BUILD",
|
||||
"scip.BUILD",
|
||||
"scip.patch",
|
||||
# "zlib.BUILD",
|
||||
"archive_helper.bzl",
|
||||
])
|
||||
|
||||
@@ -22,7 +22,7 @@ cc_library(
|
||||
"-Iexternal/glpk/glpk-4.65/src/misc",
|
||||
"-Iexternal/glpk/glpk-4.65/src/proxy",
|
||||
"-Iexternal/glpk/glpk-4.65/src/zlib",
|
||||
"-DHAVE_ZLIB",
|
||||
# "-DHAVE_ZLIB",
|
||||
],
|
||||
includes=["glpk-4.65/src"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
||||
@@ -1,27 +1,35 @@
|
||||
exports_files(
|
||||
["scip-7.0.1/src/lpi/lpi_glop.cpp"]
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "libscip",
|
||||
srcs = [
|
||||
# "src/symmetry/compute_symmetry_bliss.cpp",
|
||||
# "src/nlpi/exprinterpret_cppad.cpp",
|
||||
] + glob(
|
||||
srcs = glob(
|
||||
[
|
||||
"src/*/*.c",
|
||||
"src/objscip/*.cpp", # C++ wrappers.
|
||||
"scip-7.0.1/src/*/*.c",
|
||||
],
|
||||
exclude = [
|
||||
"src/lpi/lpi_*.c",
|
||||
"src/tpi/tpi_openmp.c",
|
||||
"src/tpi/tpi_none.c",
|
||||
"src/nlpi/nlpi_filtersqp.c",
|
||||
"src/nlpi/nlpi_worhp.c",
|
||||
"src/scip/compr_xyz.c",
|
||||
"src/scip/sorttpl.c",
|
||||
"src/nlpi/exprinterpret_none.c",
|
||||
"scip-7.0.1/src/lpi/lpi_*.c",
|
||||
"scip-7.0.1/src/tpi/tpi_*.c",
|
||||
"scip-7.0.1/src/nlpi/nlpi_filtersqp.c",
|
||||
"scip-7.0.1/src/nlpi/nlpi_worhp.c",
|
||||
"scip-7.0.1/src/scip/compr_xyz.c",
|
||||
"scip-7.0.1/src/scip/sorttpl.c",
|
||||
"scip-7.0.1/src/nlpi/exprinterpret_*.c",
|
||||
"scip-7.0.1/src/symmetry/compute_symmetry_*.cpp",
|
||||
|
||||
],
|
||||
),
|
||||
) + [
|
||||
"scip-7.0.1/src/symmetry/compute_symmetry_none.cpp",
|
||||
"scip-7.0.1/src/nlpi/exprinterpret_none.c",
|
||||
"scip-7.0.1/src/tpi/tpi_tnycthrd.c",
|
||||
],
|
||||
hdrs = glob([
|
||||
"src/*/*.h",
|
||||
"src/*/*.hpp",
|
||||
"scip-7.0.1/src/*/*.h",
|
||||
"scip-7.0.1/src/*/*.hpp",
|
||||
"scip-7.0.1/src/scip/githash.c",
|
||||
"scip-7.0.1/src/scip/sorttpl.c",
|
||||
"scip-7.0.1/src/scip/buildflags.c",
|
||||
]),
|
||||
copts = [
|
||||
"-Wunknown-pragmas",
|
||||
@@ -36,7 +44,13 @@ cc_library(
|
||||
# one does not technically need to add this, as SCIP code always
|
||||
# uses syntax like "#ifndef NPARASCIP". But let's be explicit here.
|
||||
"-DPARASCIP",
|
||||
"-Iexternal/scip/scip-7.0.1/src",
|
||||
# "-Iexternal/scip/scip-7.0.1/src",
|
||||
# "-Iexternal/scip/scip-7.0.1/src/scip",
|
||||
"-Iscip-7.0.1/src",
|
||||
"-Iscip-7.0.1/src/scip",
|
||||
],
|
||||
includes = [
|
||||
"scip-7.0.1/src",
|
||||
],
|
||||
defines = [
|
||||
# Scip 7.0.1 optionally depends on scip/config.h and
|
||||
@@ -47,12 +61,10 @@ cc_library(
|
||||
# `copts' or `local_defines'.
|
||||
"NO_CONFIG_HEADER",
|
||||
],
|
||||
features = ["-use_header_modules"], # Incompatible with -fexceptions.
|
||||
#nocopts = "-Werror", # Errors in soplex and scip includes.
|
||||
deps = [
|
||||
#"//third_party/zlib",
|
||||
#"//third_party/bliss:libbliss",
|
||||
#"//third_party/cppad:cppad_includes",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
)
|
||||
|
||||
5
bazel/scip.patch
Normal file
5
bazel/scip.patch
Normal file
@@ -0,0 +1,5 @@
|
||||
--- scip-7.0.1/src/scip/buildflags.c.new 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ scip-7.0.1/src/scip/buildflags.c 2020-06-30 18:23:41.479773668 +0200
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define SCIP_BUILDFLAGS " ARCH=x86_64\n COMP=gnu\n DEBUGSOL=false\n EXPRINT=cppad\n GAMS=false\n SYM=none\n GMP=false\n IPOPT=false\n IPOPTOPT=opt\n WORHP=false\n WORHPOPT=opt\n LPS=spx2\n LPSCHECK=false\n LPSOPT=opt\n NOBLKBUFMEM=false\n NOBLKMEM=false\n NOBUFMEM=false\n OPT=opt\n OSTYPE=linux\n PARASCIP=true\n READLINE=false\n SANITIZE=\n SHARED=false\n USRARFLAGS=\n USRCFLAGS=-fPIC\n USRCXXFLAGS=-fPIC\n USRDFLAGS=\n USRFLAGS=\n USRLDFLAGS=\n USROFLAGS=\n VERSION=6.0.0\n ZIMPL=false\n ZIMPLOPT=opt\n ZLIB=true"
|
||||
+
|
||||
@@ -15,9 +15,15 @@ cc_library(
|
||||
"integral_types.h",
|
||||
"logging.h",
|
||||
"macros.h",
|
||||
"version.h",
|
||||
],
|
||||
srcs = [
|
||||
"logging.cc",
|
||||
"version.cc",
|
||||
],
|
||||
copts = [
|
||||
"-DOR_TOOLS_MAJOR=7",
|
||||
"-DOR_TOOLS_MINOR=8",
|
||||
],
|
||||
deps = [
|
||||
"@com_github_gflags_gflags//:gflags",
|
||||
@@ -157,7 +163,7 @@ cc_library(
|
||||
deps = [
|
||||
":base",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
"@com_google_protobuf//:protobuf",
|
||||
#"@com_google_protobuf//:protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
|
||||
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
@@ -73,6 +74,9 @@ cc_library(
|
||||
"gurobi_environment.cc",
|
||||
"gurobi_interface.cc",
|
||||
"gurobi_proto_solver.cc",
|
||||
"scip_interface.cc",
|
||||
"scip_proto_solver.cc",
|
||||
"lpi_glop.cpp",
|
||||
] + select({
|
||||
":with_cbc": ["cbc_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
@@ -101,34 +105,46 @@ cc_library(
|
||||
"model_validator.h",
|
||||
"sat_proto_solver.h",
|
||||
"sat_solver_utils.h",
|
||||
"scip_helper_macros.h",
|
||||
"scip_proto_solver.h",
|
||||
],
|
||||
copts = ["-DUSE_SCIP"],
|
||||
deps = [
|
||||
":linear_solver_cc_proto",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/status",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
"@scip//:libscip",
|
||||
"//ortools/base:accurate_sum",
|
||||
"//ortools/base:dynamic_library",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:map_util",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
"@com_google_absl//absl/status",
|
||||
"//ortools/base:status_macros",
|
||||
"//ortools/base:stl_util",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base:timer",
|
||||
"//ortools/base",
|
||||
"//ortools/bop:bop_parameters_cc_proto",
|
||||
"//ortools/bop:integral_solver",
|
||||
"//ortools/glop:lp_solver",
|
||||
"//ortools/glop:parameters_cc_proto",
|
||||
"//ortools/port:file",
|
||||
"//ortools/port:proto_utils",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:lazy_mutable_copy",
|
||||
"//ortools/bop:bop_parameters_cc_proto",
|
||||
"//ortools/sat:cp_model_cc_proto",
|
||||
"//ortools/sat:cp_model_solver",
|
||||
"//ortools/sat:lp_utils",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:lazy_mutable_copy",
|
||||
] + select({
|
||||
":with_glpk": ["@glpk//:glpk"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
copy_file(
|
||||
name = "lpi_glop",
|
||||
src = "@scip//:scip-7.0.1/src/lpi/lpi_glop.cpp",
|
||||
out = "lpi_glop.cpp",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user