291 lines
9.1 KiB
Python
291 lines
9.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.
|
|
|
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
|
|
|
package(default_visibility = ["//ortools/math_opt:__subpackages__"])
|
|
|
|
cc_library(
|
|
name = "model_storage_types",
|
|
hdrs = ["model_storage_types.h"],
|
|
deps = [
|
|
"//ortools/base:intops",
|
|
"//ortools/math_opt/elemental:elements",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "range",
|
|
hdrs = ["range.h"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "iterators",
|
|
hdrs = ["iterators.h"],
|
|
deps = [":range"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "sparse_coefficient_map",
|
|
srcs = ["sparse_coefficient_map.cc"],
|
|
hdrs = ["sparse_coefficient_map.h"],
|
|
deps = [
|
|
":model_storage_types",
|
|
"//ortools/base:intops",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/meta:type_traits",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "sparse_matrix",
|
|
srcs = ["sparse_matrix.cc"],
|
|
hdrs = ["sparse_matrix.h"],
|
|
deps = [
|
|
":model_storage_types",
|
|
"//ortools/base:intops",
|
|
"//ortools/base:map_util",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/meta:type_traits",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "linear_expression_data",
|
|
hdrs = ["linear_expression_data.h"],
|
|
deps = [
|
|
":sparse_coefficient_map",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"//ortools/math_opt/core:sorted",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "update_trackers",
|
|
hdrs = ["update_trackers.h"],
|
|
deps = [
|
|
":model_storage_types",
|
|
"//ortools/base:intops",
|
|
"//ortools/base:stl_util",
|
|
"@abseil-cpp//absl/base:core_headers",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/synchronization",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "variable_storage",
|
|
srcs = ["variable_storage.cc"],
|
|
hdrs = ["variable_storage.h"],
|
|
deps = [
|
|
":model_storage_types",
|
|
":range",
|
|
"//ortools/base:intops",
|
|
"//ortools/math_opt:model_cc_proto",
|
|
"//ortools/math_opt:model_update_cc_proto",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"//ortools/math_opt/core:sorted",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "objective_storage",
|
|
srcs = ["objective_storage.cc"],
|
|
hdrs = ["objective_storage.h"],
|
|
deps = [
|
|
":range",
|
|
":sparse_coefficient_map",
|
|
":sparse_matrix",
|
|
"//ortools/base:intops",
|
|
"//ortools/base:map_util",
|
|
"//ortools/math_opt:model_cc_proto",
|
|
"//ortools/math_opt:model_update_cc_proto",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"//ortools/math_opt/core:sorted",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/strings:string_view",
|
|
"@abseil-cpp//absl/types:span",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "linear_constraint_storage",
|
|
srcs = ["linear_constraint_storage.cc"],
|
|
hdrs = ["linear_constraint_storage.h"],
|
|
deps = [
|
|
":model_storage_types",
|
|
":range",
|
|
":sparse_matrix",
|
|
"//ortools/base:intops",
|
|
"//ortools/math_opt:model_cc_proto",
|
|
"//ortools/math_opt:model_update_cc_proto",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"//ortools/math_opt/core:sorted",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/meta:type_traits",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "atomic_constraint_storage",
|
|
hdrs = ["atomic_constraint_storage.h"],
|
|
deps = [
|
|
":model_storage_types",
|
|
":range",
|
|
"//ortools/base:intops",
|
|
"//ortools/base:map_util",
|
|
"//ortools/math_opt/core:sorted",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
config_setting(
|
|
name = "storage_v2",
|
|
define_values = {"mathopt_storage_v2": "1"},
|
|
)
|
|
|
|
cc_library(
|
|
name = "model_storage",
|
|
srcs = select({
|
|
":storage_v2": [],
|
|
"//conditions:default": ["model_storage.cc"],
|
|
}),
|
|
hdrs = ["model_storage.h"],
|
|
defines = select({
|
|
":storage_v2": ["MATHOPT_STORAGE_V2"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = [
|
|
":atomic_constraint_storage",
|
|
":iterators",
|
|
":linear_constraint_storage",
|
|
":model_storage_types",
|
|
":objective_storage",
|
|
":update_trackers",
|
|
":variable_storage",
|
|
"//ortools/base:intops",
|
|
"//ortools/base:status_macros",
|
|
"//ortools/math_opt:model_cc_proto",
|
|
"//ortools/math_opt:model_update_cc_proto",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"//ortools/math_opt/constraints/indicator:storage",
|
|
"//ortools/math_opt/constraints/quadratic:storage",
|
|
"//ortools/math_opt/constraints/second_order_cone:storage",
|
|
"//ortools/math_opt/constraints/sos:storage",
|
|
"//ortools/math_opt/core:model_summary",
|
|
"//ortools/math_opt/core:sorted",
|
|
"//ortools/math_opt/core:sparse_vector_view",
|
|
"//ortools/math_opt/io:names_removal",
|
|
"//ortools/math_opt/validators:model_validator",
|
|
"@abseil-cpp//absl/base:nullability",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/memory",
|
|
"@abseil-cpp//absl/status",
|
|
"@abseil-cpp//absl/status:statusor",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
] + select({
|
|
":storage_v2": [":model_storage_v2"],
|
|
"//conditions:default": [],
|
|
}),
|
|
)
|
|
|
|
cc_library(
|
|
name = "model_storage_v2",
|
|
srcs = ["model_storage_v2.cc"],
|
|
hdrs = ["model_storage_v2.h"],
|
|
deps = [
|
|
":atomic_constraint_storage",
|
|
":atomic_constraints_v2",
|
|
":model_storage_types",
|
|
"//ortools/base:status_macros",
|
|
"//ortools/math_opt:model_cc_proto",
|
|
"//ortools/math_opt:model_update_cc_proto",
|
|
"//ortools/math_opt:sparse_containers_cc_proto",
|
|
"//ortools/math_opt/constraints/indicator:storage",
|
|
"//ortools/math_opt/constraints/quadratic:storage",
|
|
"//ortools/math_opt/constraints/sos:storage",
|
|
"//ortools/math_opt/elemental",
|
|
"//ortools/math_opt/elemental:attr_key",
|
|
"//ortools/math_opt/elemental:attributes",
|
|
"//ortools/math_opt/elemental:derived_data",
|
|
"//ortools/math_opt/elemental:elements",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/base:nullability",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/memory",
|
|
"@abseil-cpp//absl/status",
|
|
"@abseil-cpp//absl/status:statusor",
|
|
"@abseil-cpp//absl/strings:string_view",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "atomic_constraints_v2",
|
|
hdrs = ["atomic_constraints_v2.h"],
|
|
deps = [
|
|
":atomic_constraint_storage",
|
|
":model_storage_types",
|
|
"//ortools/math_opt/constraints/indicator:storage",
|
|
"//ortools/math_opt/constraints/quadratic:storage",
|
|
"//ortools/math_opt/elemental",
|
|
"//ortools/math_opt/elemental:attr_key",
|
|
"//ortools/math_opt/elemental:attributes",
|
|
"//ortools/math_opt/elemental:derived_data",
|
|
"//ortools/math_opt/elemental:elements",
|
|
"@abseil-cpp//absl/log:check",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "model_storage_item",
|
|
srcs = ["model_storage_item.cc"],
|
|
hdrs = ["model_storage_item.h"],
|
|
deps = [
|
|
":model_storage",
|
|
"//ortools/math_opt/elemental:elements",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/strings:string_view",
|
|
],
|
|
)
|