2025-01-10 11:33:35 +01:00
|
|
|
# Copyright 2010-2025 Google LLC
|
2023-11-17 16:25:02 +01:00
|
|
|
# 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("@pip_deps//:requirements.bzl", "requirement")
|
2025-04-11 17:33:09 +02:00
|
|
|
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
2023-11-17 16:25:02 +01:00
|
|
|
|
|
|
|
|
# External users should depend only on ":mathopt" and import "mathopt".
|
|
|
|
|
# Hence other libraries are private.
|
|
|
|
|
package(default_visibility = ["//visibility:private"])
|
|
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
|
name = "mathopt",
|
|
|
|
|
srcs = ["mathopt.py"],
|
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
|
deps = [
|
|
|
|
|
":callback",
|
|
|
|
|
":compute_infeasible_subsystem_result",
|
2024-07-29 15:15:15 +02:00
|
|
|
":errors",
|
2023-11-21 11:57:26 +01:00
|
|
|
":expressions",
|
2022-12-16 17:06:11 +01:00
|
|
|
":indicator_constraints",
|
2024-11-12 13:55:16 +01:00
|
|
|
":init_arguments",
|
2022-12-16 17:06:11 +01:00
|
|
|
":linear_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":message_callback",
|
|
|
|
|
":model",
|
|
|
|
|
":model_parameters",
|
2022-12-16 17:06:11 +01:00
|
|
|
":objectives",
|
2023-11-17 16:25:02 +01:00
|
|
|
":parameters",
|
2022-12-16 17:06:11 +01:00
|
|
|
":quadratic_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":result",
|
|
|
|
|
":solution",
|
|
|
|
|
":solve",
|
2024-02-23 10:20:28 +01:00
|
|
|
":solver_resources",
|
2023-11-17 16:25:02 +01:00
|
|
|
":sparse_containers",
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "from_model",
|
|
|
|
|
srcs = ["from_model.py"],
|
|
|
|
|
deps = ["//ortools/math_opt/python/elemental"],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "model_storage",
|
|
|
|
|
srcs = ["model_storage.py"],
|
|
|
|
|
visibility = ["//ortools/math_opt/python:__subpackages__"],
|
|
|
|
|
deps = [
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
|
name = "hash_model_storage",
|
|
|
|
|
srcs = ["hash_model_storage.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model_storage",
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "hash_model_storage_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["hash_model_storage_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":hash_model_storage",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
|
name = "model_storage_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["model_storage_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":hash_model_storage",
|
|
|
|
|
":model_storage",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
|
name = "model_storage_update_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["model_storage_update_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":hash_model_storage",
|
|
|
|
|
":model_storage",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "model",
|
|
|
|
|
srcs = ["model.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":from_model",
|
|
|
|
|
":indicator_constraints",
|
|
|
|
|
":linear_constraints",
|
|
|
|
|
":normalized_inequality",
|
|
|
|
|
":objectives",
|
|
|
|
|
":quadratic_constraints",
|
|
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
2022-12-16 17:06:11 +01:00
|
|
|
"//ortools/math_opt/elemental/python:cpp_elemental",
|
|
|
|
|
"//ortools/math_opt/elemental/python:enums",
|
|
|
|
|
"//ortools/math_opt/python/elemental",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "model_element_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["model_element_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":indicator_constraints",
|
|
|
|
|
":linear_constraints",
|
|
|
|
|
":model",
|
|
|
|
|
":objectives",
|
|
|
|
|
":quadratic_constraints",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
|
name = "model_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["model_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":linear_constraints",
|
|
|
|
|
":model",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "linear_constraints",
|
|
|
|
|
srcs = ["linear_constraints.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":from_model",
|
|
|
|
|
":variables",
|
|
|
|
|
"//ortools/math_opt/elemental/python:enums",
|
|
|
|
|
"//ortools/math_opt/python/elemental",
|
2023-11-17 16:25:02 +01:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "linear_expression_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["linear_expression_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":bounded_expressions",
|
|
|
|
|
":model",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "sparse_containers",
|
|
|
|
|
srcs = ["sparse_containers.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":linear_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":model",
|
2022-12-16 17:06:11 +01:00
|
|
|
":quadratic_constraints",
|
|
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "sparse_containers_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["sparse_containers_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":linear_constraints",
|
|
|
|
|
":model",
|
|
|
|
|
":quadratic_constraints",
|
|
|
|
|
":sparse_containers",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "solution",
|
|
|
|
|
srcs = ["solution.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":linear_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":model",
|
2022-12-16 17:06:11 +01:00
|
|
|
":objectives",
|
|
|
|
|
":quadratic_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":sparse_containers",
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/math_opt:solution_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "solution_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["solution_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
|
|
|
|
":solution",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:solution_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "quadratic_constraints",
|
|
|
|
|
srcs = ["quadratic_constraints.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":from_model",
|
|
|
|
|
":variables",
|
|
|
|
|
"//ortools/math_opt/elemental/python:enums",
|
|
|
|
|
"//ortools/math_opt/python/elemental",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "quadratic_constraints_test",
|
|
|
|
|
srcs = ["quadratic_constraints_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "indicator_constraints",
|
|
|
|
|
srcs = ["indicator_constraints.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":from_model",
|
|
|
|
|
":variables",
|
|
|
|
|
"//ortools/math_opt/elemental/python:enums",
|
|
|
|
|
"//ortools/math_opt/python/elemental",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "indicator_constraints_test",
|
|
|
|
|
srcs = ["indicator_constraints_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":indicator_constraints",
|
|
|
|
|
":model",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "result",
|
|
|
|
|
srcs = ["result.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":linear_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":model",
|
|
|
|
|
":solution",
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/gscip:gscip_proto_py_pb2",
|
|
|
|
|
"//ortools/math_opt:result_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:osqp_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "objectives",
|
|
|
|
|
srcs = ["objectives.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":from_model",
|
|
|
|
|
":variables",
|
|
|
|
|
"//ortools/math_opt/elemental/python:enums",
|
|
|
|
|
"//ortools/math_opt/python/elemental",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "objectives_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["objectives_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
|
|
|
|
":objectives",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt/elemental/python:cpp_elemental",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
|
name = "model_objective_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["model_objective_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
|
|
|
|
":objectives",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "parameters",
|
|
|
|
|
srcs = ["parameters.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
"//ortools/glop:parameters_py_pb2",
|
|
|
|
|
"//ortools/gscip:gscip_proto_py_pb2",
|
|
|
|
|
"//ortools/math_opt:parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:glpk_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:gurobi_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:highs_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:osqp_py_pb2",
|
|
|
|
|
"//ortools/pdlp:solvers_py_pb2",
|
|
|
|
|
"//ortools/sat:sat_parameters_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "parameters_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["parameters_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":parameters",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/glop:parameters_py_pb2",
|
|
|
|
|
"//ortools/gscip:gscip_proto_py_pb2",
|
|
|
|
|
"//ortools/math_opt:parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
"//ortools/math_opt/solvers:glpk_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:gurobi_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:highs_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:osqp_py_pb2",
|
|
|
|
|
"//ortools/pdlp:solvers_py_pb2",
|
|
|
|
|
"//ortools/sat:sat_parameters_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "model_parameters",
|
|
|
|
|
srcs = ["model_parameters.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":linear_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":model",
|
2022-12-16 17:06:11 +01:00
|
|
|
":objectives",
|
2023-11-17 16:25:02 +01:00
|
|
|
":solution",
|
|
|
|
|
":sparse_containers",
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/math_opt:model_parameters_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "model_parameters_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["model_parameters_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
|
|
|
|
":model_parameters",
|
|
|
|
|
":solution",
|
|
|
|
|
":sparse_containers",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:model_parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt:solution_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "callback",
|
|
|
|
|
srcs = ["callback.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
2022-12-16 17:06:11 +01:00
|
|
|
":normalized_inequality",
|
2023-11-17 16:25:02 +01:00
|
|
|
":sparse_containers",
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/math_opt:callback_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "callback_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["callback_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":callback",
|
|
|
|
|
":model",
|
|
|
|
|
":sparse_containers",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:callback_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "compute_infeasible_subsystem_result",
|
|
|
|
|
srcs = ["compute_infeasible_subsystem_result.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":linear_constraints",
|
2023-11-17 16:25:02 +01:00
|
|
|
":model",
|
|
|
|
|
":result",
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-17 16:25:02 +01:00
|
|
|
requirement("immutabledict"),
|
|
|
|
|
"//ortools/math_opt:infeasible_subsystem_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "compute_infeasible_subsystem_result_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["compute_infeasible_subsystem_result_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":compute_infeasible_subsystem_result",
|
|
|
|
|
":model",
|
|
|
|
|
":result",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:infeasible_subsystem_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "solve",
|
|
|
|
|
srcs = ["solve.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":callback",
|
|
|
|
|
":compute_infeasible_subsystem_result",
|
2024-07-29 15:15:15 +02:00
|
|
|
":errors",
|
2024-11-12 13:55:16 +01:00
|
|
|
":init_arguments",
|
2023-11-17 16:25:02 +01:00
|
|
|
":message_callback",
|
|
|
|
|
":model",
|
|
|
|
|
":model_parameters",
|
|
|
|
|
":parameters",
|
|
|
|
|
":result",
|
|
|
|
|
"//ortools/math_opt:parameters_py_pb2",
|
2024-07-29 15:15:15 +02:00
|
|
|
"//ortools/math_opt:rpc_py_pb2",
|
2023-11-17 16:25:02 +01:00
|
|
|
"//ortools/math_opt/core/python:solver",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
|
name = "message_callback",
|
|
|
|
|
srcs = ["message_callback.py"],
|
|
|
|
|
deps = [requirement("absl-py")],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "message_callback_test",
|
|
|
|
|
srcs = ["message_callback_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":message_callback",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "statistics",
|
|
|
|
|
srcs = ["statistics.py"],
|
|
|
|
|
deps = [":model"],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "statistics_test",
|
|
|
|
|
srcs = ["statistics_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":model",
|
|
|
|
|
":statistics",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "bounded_expressions",
|
|
|
|
|
srcs = ["bounded_expressions.py"],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "bounded_expressions_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["bounded_expressions_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":bounded_expressions",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-16 17:06:11 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "variables",
|
|
|
|
|
srcs = ["variables.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":bounded_expressions",
|
|
|
|
|
":from_model",
|
|
|
|
|
requirement("immutabledict"),
|
|
|
|
|
"//ortools/math_opt/elemental/python:enums",
|
|
|
|
|
"//ortools/math_opt/python/elemental",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
|
name = "normalized_inequality",
|
|
|
|
|
srcs = ["normalized_inequality.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":bounded_expressions",
|
|
|
|
|
":variables",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "normalized_inequality_test",
|
|
|
|
|
size = "small",
|
|
|
|
|
srcs = ["normalized_inequality_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":bounded_expressions",
|
|
|
|
|
":model",
|
|
|
|
|
":normalized_inequality",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-17 16:25:02 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "normalize",
|
|
|
|
|
srcs = ["normalize.py"],
|
|
|
|
|
visibility = ["//ortools/math_opt/python:__subpackages__"],
|
2023-11-20 16:13:03 +01:00
|
|
|
deps = ["@com_google_protobuf//:protobuf_python"],
|
2023-11-17 16:25:02 +01:00
|
|
|
)
|
2023-11-21 11:57:26 +01:00
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "normalize_test",
|
|
|
|
|
srcs = ["normalize_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":normalize",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:model_parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_py_pb2",
|
|
|
|
|
"//ortools/math_opt:model_update_py_pb2",
|
|
|
|
|
"//ortools/math_opt:parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt:result_py_pb2",
|
|
|
|
|
"//ortools/math_opt:sparse_containers_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2023-11-21 11:57:26 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "expressions",
|
|
|
|
|
srcs = ["expressions.py"],
|
|
|
|
|
deps = [
|
2022-12-16 17:06:11 +01:00
|
|
|
":variables",
|
2023-11-21 11:57:26 +01:00
|
|
|
],
|
|
|
|
|
)
|
2024-02-23 10:20:28 +01:00
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "expressions_test",
|
|
|
|
|
srcs = ["expressions_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":expressions",
|
|
|
|
|
":model",
|
|
|
|
|
":variables",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2024-02-23 10:20:28 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "solver_resources",
|
|
|
|
|
srcs = ["solver_resources.py"],
|
|
|
|
|
deps = ["//ortools/math_opt:rpc_py_pb2"],
|
|
|
|
|
)
|
2024-07-29 15:15:15 +02:00
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "solver_resources_test",
|
|
|
|
|
srcs = ["solver_resources_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":solver_resources",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:rpc_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2024-07-29 15:15:15 +02:00
|
|
|
py_library(
|
|
|
|
|
name = "errors",
|
|
|
|
|
srcs = ["errors.py"],
|
|
|
|
|
deps = ["//ortools/math_opt:rpc_py_pb2"],
|
|
|
|
|
)
|
2024-11-12 13:55:16 +01:00
|
|
|
|
2025-04-11 17:33:09 +02:00
|
|
|
py_test(
|
|
|
|
|
name = "errors_test",
|
|
|
|
|
srcs = ["errors_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":errors",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:rpc_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2024-11-12 13:55:16 +01:00
|
|
|
py_library(
|
|
|
|
|
name = "init_arguments",
|
|
|
|
|
srcs = ["init_arguments.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
"//ortools/math_opt:parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt/solvers:gurobi_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|
2025-04-11 17:33:09 +02:00
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
|
name = "init_arguments_test",
|
|
|
|
|
srcs = ["init_arguments_test.py"],
|
|
|
|
|
deps = [
|
|
|
|
|
":init_arguments",
|
|
|
|
|
requirement("absl-py"),
|
|
|
|
|
"//ortools/math_opt:parameters_py_pb2",
|
|
|
|
|
"//ortools/math_opt/python/testing:compare_proto",
|
|
|
|
|
"//ortools/math_opt/solvers:gurobi_py_pb2",
|
|
|
|
|
],
|
|
|
|
|
)
|