better scip 920 bazel patch

This commit is contained in:
Laurent Perron
2024-12-04 13:03:39 +01:00
parent 81652921bf
commit a30311c49a

View File

@@ -1,9 +1,9 @@
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000000..0c3f1853b4
index 0000000000..36283fe63d
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,126 @@
@@ -0,0 +1,139 @@
+# 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.
@@ -75,52 +75,65 @@ index 0000000000..0c3f1853b4
+ "//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",
+ "src/scip/githash.c",
+ "src/scip/sorttpl.c",
+ "src/scip/buildflags.c",
+ ],
+ exclude = [ "src/scip/*_xyz.h" ],
+)
+
+BASE_COPTS = [
+ "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c
+ "-DSCIP_IPOPT=\\\"NONE\\\"",
+ "-DSCIP_LPS=\\\"glop\\\"",
+ "-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 = 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",
+ ],
+ ) + BLISS_FILE + [
+ srcs = BASE_SRCS + BLISS_FILE + [
+ "src/scip/exprinterpret_none.c",
+ "src/tpi/tpi_none.c",
+ "src/tpi/tpi_tnycthrd.c",
+ ],
+ hdrs = glob(
+ [
+ "src/*/*.h",
+ "src/*/*.hpp",
+ "src/scip/githash.c",
+ "src/scip/sorttpl.c",
+ "src/scip/buildflags.c",
+ ],
+ exclude =
+ [
+ "src/scip/*_xyz.h",
+ ],
+ ),
+ copts = [
+ "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c
+ "-DTPI_NONE",
+ "-DNPARASCIP",
+ hdrs = BASE_HDRS,
+ copts = BASE_COPTS + [
+ "-DTPI_TNY", # src/tpi/tpi_tnycthrd.h
+ "-DPARASCIP",
+ ] + PLATFORM_FLAGS,
+ defines = [
+ # 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",
+ ],
+ defines = DEFINES,
+ features = ["-parse_headers"],
+ includes = [
+ "src",
@@ -132,13 +145,13 @@ index 0000000000..0c3f1853b4
+)
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000000..47cf7b2212
index 0000000000..b2a03c509f
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,18 @@
+module(
+ name = "scip",
+ version = "9.2.0",
+ version = "9.2.0.bcr.1",
+ compatibility_level = 1,
+)
+
@@ -154,57 +167,77 @@ index 0000000000..47cf7b2212
+ name = "zlib",
+ version = "1.2.13",
+)
diff --git a/src/lpi/lpi_glop.cpp b/src/lpi/lpi_glop.cpp
index 2471778a8f..673e9689e9 100644
--- a/src/lpi/lpi_glop.cpp
+++ b/src/lpi/lpi_glop.cpp
@@ -51,7 +51,6 @@
#include "ortools/util/time_limit.h"
#include "ortools/base/logging.h"
-#include "ortools/base/vlog_is_on.h"
#include "lpi/lpi.h"
#include "scip/pub_message.h"
@@ -2942,12 +2941,12 @@ SCIP_RETCODE SCIPlpiSetIntpar(
SCIPdebugMessage("SCIPlpiSetIntpar: SCIP_LPPAR_LPINFO -> %d.\n", ival);
if ( ival == 0 )
{
- (void) google::SetVLOGLevel("*", google::GLOG_INFO);
+ absl::SetFlag(&FLAGS_stderrthreshold, 2);
lpi->lp_info = false;
}
else
{
- (void) google::SetVLOGLevel("*", google::GLOG_ERROR);
+ absl::SetFlag(&FLAGS_stderrthreshold, 0);
lpi->lp_info = true;
}
break;
@@ -3190,7 +3189,7 @@ SCIP_RETCODE SCIPlpiReadLP(
const std::string filespec(fname);
MPModelProto proto;
- if ( ! ReadFileToProto(filespec, &proto) )
+ if ( ! ReadFileToProto(filespec, &proto).ok() )
{
SCIPerrorMessage("Could not read <%s>\n", fname);
return SCIP_READERROR;
@@ -3214,7 +3213,7 @@ SCIP_RETCODE SCIPlpiWriteLP(
MPModelProto proto;
LinearProgramToMPModelProto(*lpi->linear_program, &proto);
const std::string filespec(fname);
- if ( ! WriteProtoToFile(filespec, proto, operations_research::ProtoWriteFormat::kProtoText, true) )
+ if ( ! WriteProtoToFile(filespec, proto, operations_research::ProtoWriteFormat::kProtoText, true).ok() )
{
SCIPerrorMessage("Could not write <%s>\n", fname);
return SCIP_READERROR;
diff --git a/src/scip/buildflags.h b/src/scip/buildflags.h
new file mode 100644
index 0000000000..c686abcd20
--- /dev/null
+++ b/src/scip/buildflags.h
@@ -0,0 +1,59 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* */
+/* 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. */
+/* */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/**@file buildflags.h
+ * @brief build flags methods
+ * @author Felipe Serrano
+ */
+
+/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
+
+#define SCIP_BUILDFLAGS \
+ "ARCH=arm64\n " \
+ "OSTYPE=Darwin-23.6.0\n " \
+ "COMP=AppleClang 16.0.0.16000026\n " \
+ "BUILD=Release\n " \
+ "DEBUGSOL=OFF\n " \
+ "EXPRINT=none\n " \
+ "SYM=none\n " \
+ "GMP=OFF\n " \
+ "IPOPT=OFF\n " \
+ "WORHP=OFF\n " \
+ "LPS=glop\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"
diff --git a/src/scip/config.h b/src/scip/config.h
new file mode 100644
index 0000000000..871fde8e55
index 0000000000..718ffce3b0
--- /dev/null
+++ b/src/scip/config.h
@@ -0,0 +1,32 @@
@@ -0,0 +1,31 @@
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
@@ -220,7 +253,6 @@ index 0000000000..871fde8e55
+/* #undef SCIP_NO_SIGACTION */
+/* #undef SCIP_NO_STRTOK_R */
+/* #undef TPI_NONE */
+#define TPI_NONE
+/* #undef TPI_OMP */
+#define SCIP_THREADSAFE
+#define WITH_SCIPDEF
@@ -237,9 +269,16 @@ index 0000000000..871fde8e55
+/* #undef SCIP_ROUNDING_MS */
+
+#endif
diff --git a/src/scip/githash.c b/src/scip/githash.c
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/src/scip/githash.c
@@ -0,0 +1 @@
+
diff --git a/src/scip/scip_export.h b/src/scip/scip_export.h
new file mode 100644
index 0000000000..871fde8e55
index 0000000000..5fcb08e6b8
--- /dev/null
+++ b/src/scip/scip_export.h
@@ -0,0 +1,24 @@
@@ -267,77 +306,97 @@ index 0000000000..871fde8e55
+#endif
+
+#endif /* SCIP_EXPORT_H */
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 @@
+#define SCIP_GITHASH "a740f0891e"
\ No newline at end of file
diff --git a/src/scip/scipbuildflags.c b/src/scip/scipbuildflags.c
--- a/src/scip/scipbuildflags.c
+++ b/src/scip/scipbuildflags.c
@@ -23,7 +23,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file scipbuildflags.c
- * @ingroup OTHER_CFILES
* @brief build flags methods
* @author Felipe Serrano
*/
@@ -31,12 +30,36 @@
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
#include "scip/scipbuildflags.h"
-#include "scip/buildflags.h"
/** returns the flags that were used to build SCIP */
const char* SCIPgetBuildFlags(
void
)
{
- return SCIP_BUILDFLAGS "\n LPS=" SCIP_LPS "\n IPOPT=" SCIP_IPOPT;
+ return " ARCH=arm64\n\
+ OSTYPE=Darwin-23.6.0\n\
+ COMP=AppleClang 16.0.0.16000026\n\
+ BUILD=Release\n\
+ DEBUGSOL=OFF\n\
+ EXPRINT=none\n\
+ SYM=none\n\
+ GMP=OFF\n\
+ IPOPT=OFF\n\
+ WORHP=OFF\n\
+ LPS=none\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";
}
diff --git a/BUILD.bazel b/BUILD.bazel
index 36283fe63d..7acd4b8709 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -118,6 +118,28 @@ DEFINES = [
cc_library(
name = "scip",
+ srcs = BASE_SRCS + BLISS_FILE + [
+ "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,
+ features = ["-parse_headers"],
+ includes = [
+ "src",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@zlib",
+ ] + PLATFORM_DEPS,
+)
+
+cc_library(
+ name = "scip_parallel",
srcs = BASE_SRCS + BLISS_FILE + [
"src/scip/exprinterpret_none.c",
"src/tpi/tpi_tnycthrd.c",
diff --git a/src/lpi/lpi_glop.cpp b/src/lpi/lpi_glop.cpp
index a90120188a..26fe768436 100644
--- a/src/lpi/lpi_glop.cpp
+++ b/src/lpi/lpi_glop.cpp
@@ -51,7 +51,6 @@
#include "ortools/util/time_limit.h"
#include "ortools/base/logging.h"
-#include "ortools/base/vlog_is_on.h"
#include "lpi/lpi.h"
#include "scip/pub_message.h"
@@ -2942,12 +2941,12 @@ SCIP_RETCODE SCIPlpiSetIntpar(
SCIPdebugMessage("SCIPlpiSetIntpar: SCIP_LPPAR_LPINFO -> %d.\n", ival);
if ( ival == 0 )
{
- (void) google::SetVLOGLevel("*", google::GLOG_INFO);
+ absl::SetFlag(&FLAGS_stderrthreshold, 2);
lpi->lp_info = false;
}
else
{
- (void) google::SetVLOGLevel("*", google::GLOG_ERROR);
+ absl::SetFlag(&FLAGS_stderrthreshold, 0);
lpi->lp_info = true;
}
break;
@@ -3190,7 +3189,7 @@ SCIP_RETCODE SCIPlpiReadLP(
const std::string filespec(fname);
MPModelProto proto;
- if ( ! ReadFileToProto(filespec, &proto) )
+ if ( ! ReadFileToProto(filespec, &proto).ok() )
{
SCIPerrorMessage("Could not read <%s>\n", fname);
return SCIP_READERROR;
@@ -3214,7 +3213,7 @@ SCIP_RETCODE SCIPlpiWriteLP(
MPModelProto proto;
LinearProgramToMPModelProto(*lpi->linear_program, &proto);
const std::string filespec(fname);
- if ( ! WriteProtoToFile(filespec, proto, operations_research::ProtoWriteFormat::kProtoText, true) )
+ if ( ! WriteProtoToFile(filespec, proto, operations_research::ProtoWriteFormat::kProtoText, true).ok() )
{
SCIPerrorMessage("Could not write <%s>\n", fname);
return SCIP_READERROR;
diff --git a/src/symmetry/compute_symmetry_bliss.cpp b/src/symmetry/compute_symmetry_bliss.cpp
index 26117a8026..2f164d133b 100644
--- a/src/compute_symmetry_bliss.cpp 2024-11-08 16:36:13
+++ b/src/symmetry/compute_symmetry_bliss.cpp 2024-11-08 16:37:32
index 0ba5ea060e..426a6f90f3 100644
--- a/src/symmetry/compute_symmetry_bliss.cpp
+++ b/src/symmetry/compute_symmetry_bliss.cpp
@@ -34,8 +34,9 @@
#include "compute_symmetry.h"
/* include bliss graph */
-#include <bliss/defs.hh>
-#include <bliss/graph.hh>
+#define BLISS_VERSION "0.73"
+#include <defs.hh>
+#include <graph.hh>
#include <string.h>
#include <vector>