* don't use repo name * Bump abseil-cpp to 20250512.0 * Bump Protobuf to 31.0 * Bump benchmark to 1.9.2 * Bump googletest to 1.17.0
114 lines
3.1 KiB
Python
114 lines
3.1 KiB
Python
# Copyright 2010-2025 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.
|
|
|
|
# Python wrapper for cp_model.
|
|
|
|
load("@pip_deps//:requirements.bzl", "requirement")
|
|
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
|
|
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
|
|
|
cc_library(
|
|
name = "linear_expr_doc",
|
|
hdrs = ["linear_expr_doc.h"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "linear_expr",
|
|
srcs = ["linear_expr.cc"],
|
|
hdrs = ["linear_expr.h"],
|
|
deps = [
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/util:fp_roundtrip_conv",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/container:fixed_array",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
pybind_extension(
|
|
name = "cp_model_helper",
|
|
srcs = ["cp_model_helper.cc"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":linear_expr",
|
|
":linear_expr_doc",
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/sat:cp_model_utils",
|
|
"//ortools/sat:sat_parameters_cc_proto",
|
|
"//ortools/sat:swig_helper",
|
|
"@abseil-cpp//absl/strings",
|
|
"@pybind11_protobuf//pybind11_protobuf:native_proto_caster",
|
|
],
|
|
)
|
|
|
|
py_test(
|
|
name = "cp_model_helper_test",
|
|
srcs = ["cp_model_helper_test.py"],
|
|
deps = [
|
|
":cp_model_helper",
|
|
"//ortools/sat:cp_model_py_pb2",
|
|
"//ortools/sat:sat_parameters_py_pb2",
|
|
"//ortools/util/python:sorted_interval_list",
|
|
requirement("absl-py"),
|
|
],
|
|
)
|
|
|
|
py_library(
|
|
name = "cp_model_numbers",
|
|
srcs = ["cp_model_numbers.py"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":cp_model_helper",
|
|
requirement("numpy"),
|
|
"@protobuf//:protobuf_python",
|
|
],
|
|
)
|
|
|
|
py_test(
|
|
name = "cp_model_numbers_test",
|
|
srcs = ["cp_model_numbers_test.py"],
|
|
deps = [
|
|
":cp_model_numbers",
|
|
requirement("absl-py"),
|
|
],
|
|
)
|
|
|
|
py_library(
|
|
name = "cp_model",
|
|
srcs = ["cp_model.py"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":cp_model_helper",
|
|
":cp_model_numbers",
|
|
requirement("numpy"),
|
|
requirement("pandas"),
|
|
"//ortools/sat:cp_model_py_pb2",
|
|
"//ortools/sat:sat_parameters_py_pb2",
|
|
"//ortools/util/python:sorted_interval_list",
|
|
],
|
|
)
|
|
|
|
py_test(
|
|
name = "cp_model_test",
|
|
srcs = ["cp_model_test.py"],
|
|
deps = [
|
|
":cp_model",
|
|
":cp_model_helper",
|
|
requirement("absl-py"),
|
|
requirement("numpy"),
|
|
],
|
|
)
|