algorithms: backport from main

This commit is contained in:
Corentin Le Molgat
2025-10-16 12:56:52 +02:00
parent 862a6af30c
commit 02c95e1e23
3 changed files with 11 additions and 23 deletions

View File

@@ -28,9 +28,7 @@ bool_flag(
config_setting(
name = "use_cbc",
flag_values = {
":with_cbc": "true",
},
flag_values = {":with_cbc": "true"},
)
bool_flag(
@@ -40,9 +38,7 @@ bool_flag(
config_setting(
name = "use_scip",
flag_values = {
":with_scip": "true",
},
flag_values = {":with_scip": "true"},
)
cc_library(
@@ -93,12 +89,12 @@ cc_library(
cc_test(
name = "radix_sort_test",
size = "medium",
srcs = ["radix_sort_test.cc"],
copts = select({
"@platforms//os:windows": ["/Zc:preprocessor"],
"//conditions:default": [],
}),
tags = ["noci"],
deps = [
":radix_sort",
"//ortools/base:dump_vars",
@@ -314,6 +310,7 @@ cc_library(
hdrs = ["sparse_permutation.h"],
deps = [
"//ortools/base",
"//ortools/base:numbers",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/types:span",
],

View File

@@ -11,9 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
# Description: python wrapping of the libraries in ../
# Python wrapper for ..
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@pip_deps//:requirements.bzl", "requirement")
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
@@ -27,9 +27,7 @@ bool_flag(
config_setting(
name = "use_cbc",
flag_values = {
":with_cbc": "true",
},
flag_values = {":with_cbc": "true"},
)
bool_flag(
@@ -39,9 +37,7 @@ bool_flag(
config_setting(
name = "use_scip",
flag_values = {
":with_scip": "true",
},
flag_values = {":with_scip": "true"},
)
# knapsack_solver
@@ -54,7 +50,7 @@ cc_library(
pybind_extension(
name = "knapsack_solver",
srcs = ["knapsack_solver.cc"],
copts = [] + select({
copts = select({
":use_cbc": ["-DUSE_CBC"],
"//conditions:default": [],
}) + select({
@@ -65,12 +61,12 @@ pybind_extension(
deps = [
":knapsack_solver_doc",
"//ortools/algorithms:knapsack_solver_lib",
"@abseil-cpp//absl/strings",
],
)
py_test(
name = "knapsack_solver_test",
size = "small",
srcs = ["knapsack_solver_test.py"],
deps = [
":knapsack_solver",

View File

@@ -14,7 +14,6 @@
"""knapsack_solver unittest file."""
from absl import app
from absl.testing import absltest
from ortools.algorithms.python import knapsack_solver
@@ -261,9 +260,5 @@ class PyWrapAlgorithmsKnapsackSolverTest(absltest.TestCase):
self.assertEqual(optimal_profit, profit)
def main(_):
absltest.main()
if __name__ == "__main__":
app.run(main)
absltest.main()