Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scip: change underlying LP solver to the official soplex; add scip_interactive binary; add myself as maintainer #3524

Merged
merged 7 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions modules/scip/9.2.0.bcr.3/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module(
name = "scip",
version = "9.2.0.bcr.3",
bazel_compatibility = [">=7.2.1"], # need support for "overlay" directory
compatibility_level = 1,
)

bazel_dep(
name = "bliss",
version = "0.73",
)

bazel_dep(
name = "platforms",
version = "0.0.10",
)

bazel_dep(
name = "soplex",
version = "7.1.2.bcr.1",
)

bazel_dep(
name = "zlib",
version = "1.3.1.bcr.3",
)

144 changes: 144 additions & 0 deletions modules/scip/9.2.0.bcr.3/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Copyright 2010-2024 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# We use a lot of macros to reduce the duplication between scip and scip_parallel.

PLATFORM_FLAGS = select({
"@platforms//os:linux": [
"-Wunknown-pragmas",
"-fexceptions",
"-DSYM=bliss",
"-DBLISS_VERSION=\\\"0.73\\\"",
],
"@platforms//os:macos": [
"-Wunknown-pragmas",
"-fexceptions",
"-DSYM=bliss",
"-DBLISS_VERSION=\\\"0.73\\\"",
],
"@platforms//os:windows": [
"/DSYM=none",
"/DSCIP_NO_SIGACTION",
"/DSCIP_NO_STRTOK_R",
"/utf-8"
],
"//conditions:default": [],
})

PLATFORM_DEPS = select({
"@platforms//os:linux": ["@bliss"],
"@platforms//os:macos": ["@bliss"],
"@platforms//os:windows": [],
"//conditions:default": [],
})

BLISS_FILE = select({
"@platforms//os:linux": ["src/symmetry/compute_symmetry_bliss.cpp"],
"@platforms//os:macos": ["src/symmetry/compute_symmetry_bliss.cpp"],
"@platforms//os:windows": ["src/symmetry/compute_symmetry_none.cpp"],
"//conditions:default": ["src/symmetry/compute_symmetry_none.cpp"],
})

BASE_SRCS = glob(
[
"src/*/*.c",
],
exclude = [
"src/lpi/lpi_*.c",
"src/nauty/*",
"src/scip/exprinterpret_*.c",
"src/scip/nlpi_filtersqp.c",
"src/scip/nlpi_worhp.c",
"src/scip/*_xyz.c",
"src/scip/sorttpl.c",
"src/symmetry/compute_symmetry_*.cpp",
"src/symmetry/*nauty*",
"src/tpi/tpi_*.c",
],
)

BASE_HDRS = glob(
[
"src/*/*.h",
"src/*/*.hpp",
],
exclude = [ "src/scip/*_xyz.h" ],
) + [
"src/scip/githash.c",
"src/scip/sorttpl.c",
]

BASE_COPTS = [
"-DSCIP_IPOPT=\\\"NONE\\\"",
"-DSCIP_LPS=\\\"spx2\\\"",
"-DSCIP_GITHASH=\\\"a740f0891e\\\"",
]


DEFINES = [
# Scip optionally depends on scip/config.h and scip/scip_export.h
# that are generated by build system.
#
# We need every library and binary that depends on SCIP libraries to
# define this macro. That is why we use `defines' here instead of
# `copts' or `local_defines'.
"NO_CONFIG_HEADER",
]

cc_library(
name = "scip",
srcs = BASE_SRCS + BLISS_FILE + [
"src/lpi/lpi_spx2.cpp",
"src/scip/exprinterpret_none.c",
"src/tpi/tpi_none.c",
],
hdrs = BASE_HDRS,
copts = BASE_COPTS + [
"-DTPI_NONE", # src/tpi/tpi_none.h
"-DNPARASCIP",
] + PLATFORM_FLAGS,
defines = DEFINES,
includes = ["src"],
visibility = ["//visibility:public"],
deps = [
"@soplex",
"@zlib",
] + PLATFORM_DEPS,
)

cc_library(
name = "scip_parallel",
srcs = BASE_SRCS + BLISS_FILE + [
"src/scip/exprinterpret_none.c",
"src/tpi/tpi_tnycthrd.c",
],
hdrs = BASE_HDRS,
copts = BASE_COPTS + [
"-DTPI_TNY", # src/tpi/tpi_tnycthrd.h
"-DPARASCIP",
] + PLATFORM_FLAGS,
defines = DEFINES,
includes = ["src"],
visibility = ["//visibility:public"],
deps = [
"@soplex",
"@zlib",
] + PLATFORM_DEPS,
)

cc_binary(
name = "scip_interactive",
srcs = ["src/cppmain.cpp"],
deps = [":scip"],
)

1 change: 1 addition & 0 deletions modules/scip/9.2.0.bcr.3/overlay/MODULE.bazel
91 changes: 91 additions & 0 deletions modules/scip/9.2.0.bcr.3/patches/add_buildflags_h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
diff --git a/src/scip/buildflags.h b/src/scip/buildflags.h
index c686abcd20..1ea6a4fbf4 100644
--- a/src/scip/buildflags.h
+++ b/src/scip/buildflags.h
@@ -0,0 +1,86 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* */
+/* This file is part of the program and library */
+/* SCIP --- Solving Constraint Integer Programs */
+/* */
+/* Copyright (c) 2002-2024 Zuse Institute Berlin (ZIB) */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
+/* See the License for the specific language governing permissions and */
+/* limitations under the License. */
+/* */
+/* You should have received a copy of the Apache-2.0 license */
+/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
+/* */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#if defined(__linux__)
+#define SCIP_OSTYPE "Linux"
+#elif defined(__APPLE__)
+#define SCIP_OSTYPE "Darwin"
+#elif defined(__FreeBSD__)
+#define SCIP_OSTYPE "FreeBSD"
+#elif defined(__NetBSD__)
+#define SCIP_OSTYPE "NetBSD"
+#elif defined(__OpenBSD__)
+#define SCIP_OSTYPE "OpenBSD"
+#elif defined(_MSC_VER) || defined(__MINGW64__)
+#define SCIP_OSTYPE "Windows"
+#else
+#define SCIP_OSTYPE "UnknownArch"
+#endif
+
+#if defined(__clang__)
+#define SCIP_COMP "CLang"
+#elif defined(__GNUC__) || defined(__GNUG__)
+#define SCIP_COMP "GCC"
+#elif defined(_MSC_VER)
+#define SCIP_COMP "VisualStudio"
+#else
+#define SCIP_COMP "UnknownCompiler"
+#endif
+
+#if defined(__x86_64__) || defined(_M_X64)
+#define SCIP_ARCH "x86_64"
+#elif defined(__aarch64__)
+#define SCIP_ARCH "arm64"
+#else
+#define SCIP_ARCH "UnknownArch"
+#endif
+
+#define SCIP_BUILDFLAGS \
+ "ARCH=" SCIP_ARCH "\n " \
+ "OSTYPE=" SCIP_OSTYPE "\n " \
+ "COMP=" SCIP_COMP "\n " \
+ "BUILD=Release\n " \
+ "DEBUGSOL=OFF\n " \
+ "EXPRINT=none\n " \
+ "SYM=none\n " \
+ "GMP=OFF\n " \
+ "IPOPT=OFF\n " \
+ "WORHP=OFF\n " \
+ "LPS=spx2\n " \
+ "LPSCHECK=OFF\n " \
+ "NOBLKBUFMEM=OFF\n " \
+ "NOBLKMEM=OFF\n " \
+ "NOBUFMEM=OFF\n " \
+ "THREADSAFE=ON; " \
+ "FORCE\n " \
+ "READLINE=OFF\n " \
+ "SANITIZE_ADDRESS=OFF\n " \
+ "SANITIZE_MEMORY=OFF\n " \
+ "SANITIZE_UNDEFINED=OFF\n " \
+ "SANITIZE_THREAD=OFF\n " \
+ "SHARED=OFF\n " \
+ "VERSION=9.2.0.0\n " \
+ "API_VERSION=115\n " \
+ "ZIMPL=OFF\n " \
+ "ZLIB=ON"
37 changes: 37 additions & 0 deletions modules/scip/9.2.0.bcr.3/patches/add_config_h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/src/scip/config.h b/src/scip/config.h
new file mode 100644
index 0000000000..871fde8e55
--- /dev/null
+++ b/src/scip/config.h
@@ -0,0 +1,31 @@
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define CMAKE_BUILD_TYPE "Release"
+#define SCIP_VERSION_MAJOR 9
+#define SCIP_VERSION_MINOR 2
+#define SCIP_VERSION_PATCH 0
+#define SCIP_VERSION_SUB 0
+#define SCIP_VERSION_API 115
+/* #undef BMS_NOBLOCKMEM */
+/* #undef SCIP_NOBUFFERMEM */
+/* #undef WITH_DEBUG_SOLUTION */
+/* #undef SCIP_NO_SIGACTION */
+/* #undef SCIP_NO_STRTOK_R */
+/* #undef TPI_NONE */
+/* #undef TPI_OMP */
+#define SCIP_THREADSAFE
+#define WITH_SCIPDEF
+/* #undef SCIP_WITH_LAPACK */
+/* #undef SCIP_WITH_PAPILO */
+#define SCIP_WITH_ZLIB
+/* #undef SCIP_WITH_READLINE */
+/* #undef SCIP_WITH_GMP */
+/* #undef SCIP_WITH_LPSCHECK */
+/* #undef SCIP_WITH_ZIMPL */
+/* #undef SCIP_WITH_AMPL */
+#define SCIP_ROUNDING_FE
+/* #undef SCIP_ROUNDING_FP */
+/* #undef SCIP_ROUNDING_MS */
+
+#endif
7 changes: 7 additions & 0 deletions modules/scip/9.2.0.bcr.3/patches/add_githash_c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
diff --git a/src/scip/githash.c b/src/scip/githash.c
new file mode 100644
index 0000000000..d1e99c662d
--- /dev/null
+++ b/src/scip/githash.c
@@ -0,0 +1,1 @@
+
30 changes: 30 additions & 0 deletions modules/scip/9.2.0.bcr.3/patches/add_scip_export_h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/src/scip/scip_export.h b/src/scip/scip_export.h
new file mode 100644
index 0000000000..871fde8e55
--- /dev/null
+++ b/src/scip/scip_export.h
@@ -0,0 +1,24 @@
+
+#ifndef SCIP_EXPORT_H
+#define SCIP_EXPORT_H
+
+#ifdef SCIP_STATIC_DEFINE
+# define SCIP_EXPORT
+# define SCIP_NO_EXPORT
+#else
+# ifndef SCIP_EXPORT
+# ifdef libscip_EXPORTS
+/* We are building this library */
+# define SCIP_EXPORT
+# else
+/* We are using this library */
+# define SCIP_EXPORT
+# endif
+# endif
+
+# ifndef SCIP_NO_EXPORT
+# define SCIP_NO_EXPORT
+# endif
+#endif
+
+#endif /* SCIP_EXPORT_H */
15 changes: 15 additions & 0 deletions modules/scip/9.2.0.bcr.3/patches/compute_symmetry_bliss.cpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/symmetry/compute_symmetry_bliss.cpp b/src/symmetry/compute_symmetry_bliss.cpp
index 0ba5ea060e..4fc4338e73 100644
--- a/src/symmetry/compute_symmetry_bliss.cpp
+++ b/src/symmetry/compute_symmetry_bliss.cpp
@@ -34,8 +34,8 @@
#include "compute_symmetry.h"

/* include bliss graph */
-#include <bliss/defs.hh>
-#include <bliss/graph.hh>
+#include <defs.hh>
+#include <graph.hh>

#include <string.h>
#include <vector>
17 changes: 17 additions & 0 deletions modules/scip/9.2.0.bcr.3/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
matrix:
platform:
- debian10
- ubuntu2004
- macos
- macos_arm64
- windows
bazel:
- 8.x
- 7.x
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- '@scip//...'
17 changes: 17 additions & 0 deletions modules/scip/9.2.0.bcr.3/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"url": "https://github.com/scipopt/scip/archive/refs/tags/v920.tar.gz",
"integrity": "sha256-oi3CD0Tpm/7AcYif1a8r/FfErxS3bXd9ExIAZhY0b3w=",
"strip_prefix": "scip-920",
"patches": {
"add_buildflags_h.patch": "sha256-f6Bf1J/VjcuwS4tXyinxJERaM11KZPkMhnCKiLdknMc=",
"add_config_h.patch": "sha256-EOS5VOaw/zOcjrq001yaWnw2dFyb5m7816+vn3skbj0=",
"add_githash_c.patch": "sha256-zM+HwMB8gMy3VD05roWU7LOtZ1pxajLuQ+spFKH4ruQ=",
"add_scip_export_h.patch": "sha256-Ft0dOF/qTpjVgb8a1WNmCOdPNxL2X+eHkPfMFpoRTbE=",
"compute_symmetry_bliss.cpp.patch": "sha256-WT16SQpkdpGApHrTHwSYyHpnXPfOTu2sZfDfQQ7zV0s="
},
"patch_strip": 1,
"overlay": {
"BUILD.bazel": "sha256-8XF/30snfL/D8TQOINwZIF0HHAa2TmOFQZrZSEtAfjA=",
"MODULE.bazel": "sha256-xfjr76f+STrnQS9SaAgRhyKKMM85GbDZg7vQU/LDLX8="
}
}
Loading
Loading