ortools: various export from google3
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
11
BUILD.bazel
11
BUILD.bazel
@@ -18,13 +18,14 @@ load("@rules_license//rules:license.bzl", "license")
|
|||||||
licenses(["notice"])
|
licenses(["notice"])
|
||||||
exports_files(["LICENSE"])
|
exports_files(["LICENSE"])
|
||||||
license(
|
license(
|
||||||
name = "license",
|
name = "license",
|
||||||
package_name = "or-tools",
|
package_name = "or-tools",
|
||||||
license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"],
|
license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"],
|
||||||
license_text = ":LICENSE",
|
license_text = ":LICENSE",
|
||||||
)
|
)
|
||||||
|
|
||||||
package(
|
package(
|
||||||
default_applicable_licenses = [":license"],
|
default_applicable_licenses = [":license"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# gazelle:build_file_name BUILD,BUILD.bazel
|
# gazelle:build_file_name BUILD,BUILD.bazel
|
||||||
|
|||||||
13
MODULE.bazel
13
MODULE.bazel
@@ -1,3 +1,16 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Bazel now uses Bzlmod by default to manage external dependencies.
|
# Bazel now uses Bzlmod by default to manage external dependencies.
|
||||||
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
|
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ cc_library(
|
|||||||
name = "hungarian",
|
name = "hungarian",
|
||||||
srcs = ["hungarian.cc"],
|
srcs = ["hungarian.cc"],
|
||||||
hdrs = ["hungarian.h"],
|
hdrs = ["hungarian.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"@abseil-cpp//absl/container:flat_hash_map",
|
"@abseil-cpp//absl/container:flat_hash_map",
|
||||||
@@ -177,6 +178,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "adjustable_k_ary_heap",
|
name = "adjustable_k_ary_heap",
|
||||||
hdrs = ["adjustable_k_ary_heap.h"],
|
hdrs = ["adjustable_k_ary_heap.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = ["@abseil-cpp//absl/log:check"],
|
deps = ["@abseil-cpp//absl/log:check"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -398,7 +398,6 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "memfile",
|
name = "memfile",
|
||||||
hdrs = ["memfile.h"],
|
hdrs = ["memfile.h"],
|
||||||
deps = [],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@@ -432,7 +431,6 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "mutable_memfile",
|
name = "mutable_memfile",
|
||||||
hdrs = ["mutable_memfile.h"],
|
hdrs = ["mutable_memfile.h"],
|
||||||
deps = [],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
// This file provides the StrongVector container that wraps around the STL
|
// This file provides the StrongVector container that wraps around the STL
|
||||||
// vector. The wrapper restrict indexing to a pre-specified type-safe integer
|
// vector. The wrapper restrict indexing to a pre-specified type-safe integer
|
||||||
// type or StrongInt (see util/intops/strong_int.h). It prevents accidental
|
// type or StrongInt (see ortools/base/strong_int.h). It prevents accidental
|
||||||
// indexing by different "logical" integer-like types (e.g. another StrongInt)
|
// indexing by different "logical" integer-like types (e.g. another StrongInt)
|
||||||
// or native integer types. The wrapper is useful as C++ and the standard
|
// or native integer types. The wrapper is useful as C++ and the standard
|
||||||
// template library allows the user to mix "logical" integral indices that might
|
// template library allows the user to mix "logical" integral indices that might
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
//
|
//
|
||||||
// where type_name is the desired name for the "logical" integer-like type
|
// where type_name is the desired name for the "logical" integer-like type
|
||||||
// and the value_type is a supported native integer type such as int or
|
// and the value_type is a supported native integer type such as int or
|
||||||
// uint64_t (see util/intops/strong_int.h for details).
|
// uint64_t (see ortools/base/strong_int.h for details).
|
||||||
//
|
//
|
||||||
// The wrapper exposes all public methods of STL vector and behaves mostly as
|
// The wrapper exposes all public methods of STL vector and behaves mostly as
|
||||||
// pass-through. The only methods modified to ensure type-safety are the
|
// pass-through. The only methods modified to ensure type-safety are the
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
|
|||||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||||
load("@rules_python//python:py_library.bzl", "py_library")
|
load("@rules_python//python:py_library.bzl", "py_library")
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
|
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "on_linux",
|
name = "on_linux",
|
||||||
constraint_values = ["@platforms//os:linux"],
|
constraint_values = ["@platforms//os:linux"],
|
||||||
@@ -40,95 +38,114 @@ config_setting(
|
|||||||
proto_library(
|
proto_library(
|
||||||
name = "assignment_proto",
|
name = "assignment_proto",
|
||||||
srcs = ["assignment.proto"],
|
srcs = ["assignment.proto"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "assignment_cc_proto",
|
name = "assignment_cc_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":assignment_proto"],
|
deps = [":assignment_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
proto_library(
|
proto_library(
|
||||||
name = "search_limit_proto",
|
name = "search_limit_proto",
|
||||||
srcs = ["search_limit.proto"],
|
srcs = ["search_limit.proto"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "search_limit_cc_proto",
|
name = "search_limit_cc_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":search_limit_proto"],
|
deps = [":search_limit_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
java_proto_library(
|
java_proto_library(
|
||||||
name = "search_limit_java_proto",
|
name = "search_limit_java_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":search_limit_proto"],
|
deps = [":search_limit_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
proto_library(
|
proto_library(
|
||||||
name = "demon_profiler_proto",
|
name = "demon_profiler_proto",
|
||||||
srcs = ["demon_profiler.proto"],
|
srcs = ["demon_profiler.proto"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "demon_profiler_cc_proto",
|
name = "demon_profiler_cc_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":demon_profiler_proto"],
|
deps = [":demon_profiler_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
proto_library(
|
proto_library(
|
||||||
name = "search_stats_proto",
|
name = "search_stats_proto",
|
||||||
srcs = ["search_stats.proto"],
|
srcs = ["search_stats.proto"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "search_stats_cc_proto",
|
name = "search_stats_cc_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":search_stats_proto"],
|
deps = [":search_stats_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
java_proto_library(
|
java_proto_library(
|
||||||
name = "search_stats_java_proto",
|
name = "search_stats_java_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":search_stats_proto"],
|
deps = [":search_stats_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
proto_library(
|
proto_library(
|
||||||
name = "solver_parameters_proto",
|
name = "solver_parameters_proto",
|
||||||
srcs = ["solver_parameters.proto"],
|
srcs = ["solver_parameters.proto"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "solver_parameters_cc_proto",
|
name = "solver_parameters_cc_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":solver_parameters_proto"],
|
deps = [":solver_parameters_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
java_proto_library(
|
java_proto_library(
|
||||||
name = "solver_parameters_java_proto",
|
name = "solver_parameters_java_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":solver_parameters_proto"],
|
deps = [":solver_parameters_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_proto_library(
|
py_proto_library(
|
||||||
name = "assignment_py_pb2",
|
name = "assignment_py_pb2",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":assignment_proto"],
|
deps = [":assignment_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_proto_library(
|
py_proto_library(
|
||||||
name = "search_limit_py_pb2",
|
name = "search_limit_py_pb2",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":search_limit_proto"],
|
deps = [":search_limit_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_proto_library(
|
py_proto_library(
|
||||||
name = "demon_profiler_py_pb2",
|
name = "demon_profiler_py_pb2",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":demon_profiler_proto"],
|
deps = [":demon_profiler_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_proto_library(
|
py_proto_library(
|
||||||
name = "search_stats_py_pb2",
|
name = "search_stats_py_pb2",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":search_stats_proto"],
|
deps = [":search_stats_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_proto_library(
|
py_proto_library(
|
||||||
name = "solver_parameters_py_pb2",
|
name = "solver_parameters_py_pb2",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":solver_parameters_proto"],
|
deps = [":solver_parameters_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
py_library(
|
py_library(
|
||||||
name = "constraint_solver_py_pb2",
|
name = "constraint_solver_py_pb2",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":assignment_py_pb2",
|
":assignment_py_pb2",
|
||||||
":demon_profiler_py_pb2",
|
":demon_profiler_py_pb2",
|
||||||
@@ -180,6 +197,7 @@ cc_library(
|
|||||||
"constraint_solver.h",
|
"constraint_solver.h",
|
||||||
"constraint_solveri.h",
|
"constraint_solveri.h",
|
||||||
],
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":assignment_cc_proto",
|
":assignment_cc_proto",
|
||||||
":demon_profiler_cc_proto",
|
":demon_profiler_cc_proto",
|
||||||
|
|||||||
@@ -7412,9 +7412,6 @@ void IntVar::SetValues(const std::vector<int64_t>& values) {
|
|||||||
default: {
|
default: {
|
||||||
// TODO(user): use a clean and safe SortedUniqueCopy() class
|
// TODO(user): use a clean and safe SortedUniqueCopy() class
|
||||||
// that uses a global, static shared (and locked) storage.
|
// that uses a global, static shared (and locked) storage.
|
||||||
// TODO(user): [optional] consider porting
|
|
||||||
// STLSortAndRemoveDuplicates from ortools/base/stl_util.h to the
|
|
||||||
// existing base/stl_util.h and using it here.
|
|
||||||
// TODO(user): We could filter out values not in the var.
|
// TODO(user): We could filter out values not in the var.
|
||||||
std::vector<int64_t>& tmp = solver()->tmp_vector_;
|
std::vector<int64_t>& tmp = solver()->tmp_vector_;
|
||||||
tmp.clear();
|
tmp.clear();
|
||||||
|
|||||||
@@ -2939,11 +2939,12 @@ MatrixEntry SingletonPreprocessor::GetSingletonColumnMatrixEntry(
|
|||||||
return MatrixEntry(e.row(), col, e.coefficient());
|
return MatrixEntry(e.row(), col, e.coefficient());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// COV_NF_START
|
||||||
// This shouldn't happen.
|
// This shouldn't happen.
|
||||||
LOG(DFATAL) << "No unmarked entry in a column that is supposed to have one.";
|
LOG(DFATAL) << "No unmarked entry in a column that is supposed to have one.";
|
||||||
status_ = ProblemStatus::ABNORMAL;
|
status_ = ProblemStatus::ABNORMAL;
|
||||||
return MatrixEntry(RowIndex(0), ColIndex(0), 0.0);
|
return MatrixEntry(RowIndex(0), ColIndex(0), 0.0);
|
||||||
|
// COV_NF_END
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixEntry SingletonPreprocessor::GetSingletonRowMatrixEntry(
|
MatrixEntry SingletonPreprocessor::GetSingletonRowMatrixEntry(
|
||||||
@@ -2955,11 +2956,12 @@ MatrixEntry SingletonPreprocessor::GetSingletonRowMatrixEntry(
|
|||||||
return MatrixEntry(row, col, e.coefficient());
|
return MatrixEntry(row, col, e.coefficient());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// COV_NF_START
|
||||||
// This shouldn't happen.
|
// This shouldn't happen.
|
||||||
LOG(DFATAL) << "No unmarked entry in a row that is supposed to have one.";
|
LOG(DFATAL) << "No unmarked entry in a row that is supposed to have one.";
|
||||||
status_ = ProblemStatus::ABNORMAL;
|
status_ = ProblemStatus::ABNORMAL;
|
||||||
return MatrixEntry(RowIndex(0), ColIndex(0), 0.0);
|
return MatrixEntry(RowIndex(0), ColIndex(0), 0.0);
|
||||||
|
// COV_NF_END
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|||||||
@@ -3882,9 +3882,10 @@ void RevisedSimplex::DisplayVariableBounds() {
|
|||||||
VLOG(3) << variable_name_[col] << " = "
|
VLOG(3) << variable_name_[col] << " = "
|
||||||
<< StringifyWithFlags(lower_bounds[col]) << ";";
|
<< StringifyWithFlags(lower_bounds[col]) << ";";
|
||||||
break;
|
break;
|
||||||
default: // This should never happen.
|
default: // This should never happen.
|
||||||
LOG(DFATAL) << "Column " << col << " has no meaningful status.";
|
LOG(DFATAL) << "Column " << col // COV_NF_LINE
|
||||||
break;
|
<< " has no meaningful status."; // COV_NF_LINE
|
||||||
|
break; // COV_NF_LINE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
|
|||||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||||
load("@rules_cc//cc:cc_test.bzl", "cc_test")
|
load("@rules_cc//cc:cc_test.bzl", "cc_test")
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
|
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "on_linux",
|
name = "on_linux",
|
||||||
constraint_values = ["@platforms//os:linux"],
|
constraint_values = ["@platforms//os:linux"],
|
||||||
@@ -37,6 +35,7 @@ config_setting(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "graph",
|
name = "graph",
|
||||||
hdrs = ["graph.h"],
|
hdrs = ["graph.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":iterators",
|
":iterators",
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
@@ -50,6 +49,7 @@ cc_test(
|
|||||||
name = "graph_test",
|
name = "graph_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["graph_test.cc"],
|
srcs = ["graph_test.cc"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
":graph",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
@@ -67,6 +67,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "flow_graph",
|
name = "flow_graph",
|
||||||
hdrs = ["flow_graph.h"],
|
hdrs = ["flow_graph.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
":graph",
|
||||||
":iterators",
|
":iterators",
|
||||||
@@ -79,6 +80,7 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "bfs",
|
name = "bfs",
|
||||||
hdrs = ["bfs.h"],
|
hdrs = ["bfs.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"@abseil-cpp//absl/status",
|
"@abseil-cpp//absl/status",
|
||||||
"@abseil-cpp//absl/strings:str_format",
|
"@abseil-cpp//absl/strings:str_format",
|
||||||
@@ -88,13 +90,14 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "bounded_dijkstra",
|
name = "bounded_dijkstra",
|
||||||
hdrs = ["bounded_dijkstra.h"],
|
hdrs = ["bounded_dijkstra.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
"//ortools/base:intops",
|
"//ortools/base:intops",
|
||||||
"//ortools/base:iterator_adaptors",
|
"//ortools/base:iterator_adaptors",
|
||||||
"//ortools/base:strong_vector",
|
"//ortools/base:strong_vector",
|
||||||
"//ortools/base:threadpool",
|
"//ortools/base:threadpool",
|
||||||
"//ortools/base:top_n",
|
"//ortools/base:top_n",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
"@abseil-cpp//absl/base:core_headers",
|
"@abseil-cpp//absl/base:core_headers",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
@@ -108,12 +111,12 @@ cc_test(
|
|||||||
srcs = ["bounded_dijkstra_test.cc"],
|
srcs = ["bounded_dijkstra_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":bounded_dijkstra",
|
":bounded_dijkstra",
|
||||||
":graph",
|
|
||||||
":io",
|
|
||||||
":test_util",
|
|
||||||
"//ortools/base:dump_vars",
|
"//ortools/base:dump_vars",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
"//ortools/base:intops",
|
"//ortools/base:intops",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:io",
|
||||||
|
"//ortools/graph:test_util",
|
||||||
"//ortools/util:flat_matrix",
|
"//ortools/util:flat_matrix",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
"@abseil-cpp//absl/random",
|
"@abseil-cpp//absl/random",
|
||||||
@@ -126,6 +129,7 @@ cc_library(
|
|||||||
name = "minimum_vertex_cover",
|
name = "minimum_vertex_cover",
|
||||||
srcs = ["minimum_vertex_cover.cc"],
|
srcs = ["minimum_vertex_cover.cc"],
|
||||||
hdrs = ["minimum_vertex_cover.h"],
|
hdrs = ["minimum_vertex_cover.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":max_flow",
|
":max_flow",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
@@ -146,6 +150,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "multi_dijkstra",
|
name = "multi_dijkstra",
|
||||||
hdrs = ["multi_dijkstra.h"],
|
hdrs = ["multi_dijkstra.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base:map_util",
|
"//ortools/base:map_util",
|
||||||
"//ortools/base:types",
|
"//ortools/base:types",
|
||||||
@@ -158,14 +163,14 @@ cc_test(
|
|||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["multi_dijkstra_test.cc"],
|
srcs = ["multi_dijkstra_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":connected_components",
|
|
||||||
":graph",
|
|
||||||
":multi_dijkstra",
|
":multi_dijkstra",
|
||||||
":random_graph",
|
|
||||||
":util",
|
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
"//ortools/base:map_util",
|
"//ortools/base:map_util",
|
||||||
"//ortools/base:types",
|
"//ortools/base:types",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:connected_components",
|
||||||
|
"//ortools/graph:random_graph",
|
||||||
|
"//ortools/graph:util",
|
||||||
"@abseil-cpp//absl/container:flat_hash_map",
|
"@abseil-cpp//absl/container:flat_hash_map",
|
||||||
"@abseil-cpp//absl/container:flat_hash_set",
|
"@abseil-cpp//absl/container:flat_hash_set",
|
||||||
"@abseil-cpp//absl/random:distributions",
|
"@abseil-cpp//absl/random:distributions",
|
||||||
@@ -175,6 +180,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "bidirectional_dijkstra",
|
name = "bidirectional_dijkstra",
|
||||||
hdrs = ["bidirectional_dijkstra.h"],
|
hdrs = ["bidirectional_dijkstra.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:iterator_adaptors",
|
"//ortools/base:iterator_adaptors",
|
||||||
@@ -194,9 +200,9 @@ cc_test(
|
|||||||
deps = [
|
deps = [
|
||||||
":bidirectional_dijkstra",
|
":bidirectional_dijkstra",
|
||||||
":bounded_dijkstra",
|
":bounded_dijkstra",
|
||||||
":graph",
|
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
"//ortools/base:iterator_adaptors",
|
"//ortools/base:iterator_adaptors",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/base:log_severity",
|
"@abseil-cpp//absl/base:log_severity",
|
||||||
"@abseil-cpp//absl/random:distributions",
|
"@abseil-cpp//absl/random:distributions",
|
||||||
"@abseil-cpp//absl/strings",
|
"@abseil-cpp//absl/strings",
|
||||||
@@ -208,6 +214,7 @@ cc_library(
|
|||||||
name = "cliques",
|
name = "cliques",
|
||||||
srcs = ["cliques.cc"],
|
srcs = ["cliques.cc"],
|
||||||
hdrs = ["cliques.h"],
|
hdrs = ["cliques.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:int_type",
|
"//ortools/base:int_type",
|
||||||
@@ -243,6 +250,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "hamiltonian_path",
|
name = "hamiltonian_path",
|
||||||
hdrs = ["hamiltonian_path.h"],
|
hdrs = ["hamiltonian_path.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/util:bitset",
|
"//ortools/util:bitset",
|
||||||
"//ortools/util:saturated_arithmetic",
|
"//ortools/util:saturated_arithmetic",
|
||||||
@@ -272,13 +280,14 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "christofides",
|
name = "christofides",
|
||||||
hdrs = ["christofides.h"],
|
hdrs = ["christofides.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":eulerian_path",
|
":eulerian_path",
|
||||||
":graph",
|
|
||||||
":minimum_spanning_tree",
|
":minimum_spanning_tree",
|
||||||
":perfect_matching",
|
":perfect_matching",
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:types",
|
"//ortools/base:types",
|
||||||
|
"//ortools/graph",
|
||||||
"//ortools/linear_solver",
|
"//ortools/linear_solver",
|
||||||
"//ortools/linear_solver:linear_solver_cc_proto",
|
"//ortools/linear_solver:linear_solver_cc_proto",
|
||||||
"//ortools/util:saturated_arithmetic",
|
"//ortools/util:saturated_arithmetic",
|
||||||
@@ -304,6 +313,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "eulerian_path",
|
name = "eulerian_path",
|
||||||
hdrs = ["eulerian_path.h"],
|
hdrs = ["eulerian_path.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
],
|
],
|
||||||
@@ -314,8 +324,8 @@ cc_test(
|
|||||||
srcs = ["eulerian_path_test.cc"],
|
srcs = ["eulerian_path_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":eulerian_path",
|
":eulerian_path",
|
||||||
":graph",
|
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/base:core_headers",
|
"@abseil-cpp//absl/base:core_headers",
|
||||||
"@google_benchmark//:benchmark",
|
"@google_benchmark//:benchmark",
|
||||||
],
|
],
|
||||||
@@ -324,10 +334,11 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "minimum_spanning_tree",
|
name = "minimum_spanning_tree",
|
||||||
hdrs = ["minimum_spanning_tree.h"],
|
hdrs = ["minimum_spanning_tree.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":connected_components",
|
|
||||||
"//ortools/base:adjustable_priority_queue",
|
"//ortools/base:adjustable_priority_queue",
|
||||||
"//ortools/base:types",
|
"//ortools/base:types",
|
||||||
|
"//ortools/graph:connected_components",
|
||||||
"//ortools/util:vector_or_function",
|
"//ortools/util:vector_or_function",
|
||||||
"@abseil-cpp//absl/types:span",
|
"@abseil-cpp//absl/types:span",
|
||||||
],
|
],
|
||||||
@@ -337,10 +348,10 @@ cc_test(
|
|||||||
name = "minimum_spanning_tree_test",
|
name = "minimum_spanning_tree_test",
|
||||||
srcs = ["minimum_spanning_tree_test.cc"],
|
srcs = ["minimum_spanning_tree_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":minimum_spanning_tree",
|
":minimum_spanning_tree",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
"//ortools/base:types",
|
"//ortools/base:types",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/base:core_headers",
|
"@abseil-cpp//absl/base:core_headers",
|
||||||
"@abseil-cpp//absl/random:distributions",
|
"@abseil-cpp//absl/random:distributions",
|
||||||
"@abseil-cpp//absl/types:span",
|
"@abseil-cpp//absl/types:span",
|
||||||
@@ -351,10 +362,11 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "one_tree_lower_bound",
|
name = "one_tree_lower_bound",
|
||||||
hdrs = ["one_tree_lower_bound.h"],
|
hdrs = ["one_tree_lower_bound.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":christofides",
|
":christofides",
|
||||||
":graph",
|
|
||||||
":minimum_spanning_tree",
|
":minimum_spanning_tree",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/log",
|
"@abseil-cpp//absl/log",
|
||||||
"@abseil-cpp//absl/types:span",
|
"@abseil-cpp//absl/types:span",
|
||||||
],
|
],
|
||||||
@@ -377,6 +389,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "shortest_paths",
|
name = "shortest_paths",
|
||||||
hdrs = ["shortest_paths.h"],
|
hdrs = ["shortest_paths.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:adjustable_priority_queue",
|
"//ortools/base:adjustable_priority_queue",
|
||||||
@@ -398,10 +411,10 @@ cc_test(
|
|||||||
srcs = ["shortest_paths_test.cc"],
|
srcs = ["shortest_paths_test.cc"],
|
||||||
tags = ["noasan"], # Times out occasionally in ASAN mode.
|
tags = ["noasan"], # Times out occasionally in ASAN mode.
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":shortest_paths",
|
":shortest_paths",
|
||||||
":strongly_connected_components",
|
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:strongly_connected_components",
|
||||||
"@abseil-cpp//absl/base:core_headers",
|
"@abseil-cpp//absl/base:core_headers",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
"@abseil-cpp//absl/random",
|
"@abseil-cpp//absl/random",
|
||||||
@@ -411,6 +424,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "k_shortest_paths",
|
name = "k_shortest_paths",
|
||||||
hdrs = ["k_shortest_paths.h"],
|
hdrs = ["k_shortest_paths.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":bounded_dijkstra",
|
":bounded_dijkstra",
|
||||||
":shortest_paths",
|
":shortest_paths",
|
||||||
@@ -428,11 +442,11 @@ cc_test(
|
|||||||
name = "k_shortest_paths_test",
|
name = "k_shortest_paths_test",
|
||||||
srcs = ["k_shortest_paths_test.cc"],
|
srcs = ["k_shortest_paths_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":io",
|
|
||||||
":k_shortest_paths",
|
":k_shortest_paths",
|
||||||
":shortest_paths",
|
":shortest_paths",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:io",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
"@abseil-cpp//absl/random:distributions",
|
"@abseil-cpp//absl/random:distributions",
|
||||||
@@ -445,10 +459,12 @@ cc_test(
|
|||||||
proto_library(
|
proto_library(
|
||||||
name = "flow_problem_proto",
|
name = "flow_problem_proto",
|
||||||
srcs = ["flow_problem.proto"],
|
srcs = ["flow_problem.proto"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "flow_problem_cc_proto",
|
name = "flow_problem_cc_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [":flow_problem_proto"],
|
deps = [":flow_problem_proto"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,10 +473,11 @@ cc_library(
|
|||||||
name = "max_flow",
|
name = "max_flow",
|
||||||
srcs = ["max_flow.cc"],
|
srcs = ["max_flow.cc"],
|
||||||
hdrs = ["max_flow.h"],
|
hdrs = ["max_flow.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":flow_problem_cc_proto",
|
":flow_problem_cc_proto",
|
||||||
":generic_max_flow",
|
":generic_max_flow",
|
||||||
":graph",
|
"//ortools/graph",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -481,6 +498,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "generic_max_flow",
|
name = "generic_max_flow",
|
||||||
hdrs = ["generic_max_flow.h"],
|
hdrs = ["generic_max_flow.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":flow_problem_cc_proto",
|
":flow_problem_cc_proto",
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
@@ -495,11 +513,11 @@ cc_test(
|
|||||||
size = "medium",
|
size = "medium",
|
||||||
srcs = ["generic_max_flow_test.cc"],
|
srcs = ["generic_max_flow_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":flow_graph",
|
|
||||||
":generic_max_flow",
|
":generic_max_flow",
|
||||||
":graph",
|
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:flow_graph",
|
||||||
"//ortools/linear_solver",
|
"//ortools/linear_solver",
|
||||||
"@abseil-cpp//absl/random",
|
"@abseil-cpp//absl/random",
|
||||||
"@abseil-cpp//absl/random:bit_gen_ref",
|
"@abseil-cpp//absl/random:bit_gen_ref",
|
||||||
@@ -520,10 +538,11 @@ cc_library(
|
|||||||
"on_windows": ["/Zc:preprocessor"],
|
"on_windows": ["/Zc:preprocessor"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":generic_max_flow",
|
":generic_max_flow",
|
||||||
":graph",
|
|
||||||
"//ortools/base:mathutil",
|
"//ortools/base:mathutil",
|
||||||
|
"//ortools/graph",
|
||||||
"//ortools/util:saturated_arithmetic",
|
"//ortools/util:saturated_arithmetic",
|
||||||
"//ortools/util:stats",
|
"//ortools/util:stats",
|
||||||
"//ortools/util:zvector",
|
"//ortools/util:zvector",
|
||||||
@@ -549,7 +568,7 @@ cc_test(
|
|||||||
"@abseil-cpp//absl/strings:str_format",
|
"@abseil-cpp//absl/strings:str_format",
|
||||||
"@abseil-cpp//absl/types:span",
|
"@abseil-cpp//absl/types:span",
|
||||||
"@google_benchmark//:benchmark",
|
"@google_benchmark//:benchmark",
|
||||||
":graph",
|
"//ortools/graph",
|
||||||
# Using CLP because GLOP is too slow in non-opt mode.
|
# Using CLP because GLOP is too slow in non-opt mode.
|
||||||
"//ortools/algorithms:binary_search",
|
"//ortools/algorithms:binary_search",
|
||||||
"//ortools/linear_solver",
|
"//ortools/linear_solver",
|
||||||
@@ -561,15 +580,15 @@ cc_binary(
|
|||||||
name = "solve_flow_model",
|
name = "solve_flow_model",
|
||||||
srcs = ["solve_flow_model.cc"],
|
srcs = ["solve_flow_model.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":flow_graph",
|
|
||||||
":flow_problem_cc_proto",
|
":flow_problem_cc_proto",
|
||||||
":generic_max_flow",
|
":generic_max_flow",
|
||||||
":graph",
|
|
||||||
":min_cost_flow",
|
":min_cost_flow",
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:file",
|
"//ortools/base:file",
|
||||||
"//ortools/base:path",
|
"//ortools/base:path",
|
||||||
"//ortools/base:timer",
|
"//ortools/base:timer",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:flow_graph",
|
||||||
"//ortools/util:file_util",
|
"//ortools/util:file_util",
|
||||||
"//ortools/util:filelineiter",
|
"//ortools/util:filelineiter",
|
||||||
"//ortools/util:stats",
|
"//ortools/util:stats",
|
||||||
@@ -590,9 +609,10 @@ cc_library(
|
|||||||
name = "assignment",
|
name = "assignment",
|
||||||
srcs = ["assignment.cc"],
|
srcs = ["assignment.cc"],
|
||||||
hdrs = ["assignment.h"],
|
hdrs = ["assignment.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":linear_assignment",
|
":linear_assignment",
|
||||||
|
"//ortools/graph",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -613,9 +633,9 @@ cc_test(
|
|||||||
name = "line_graph_test",
|
name = "line_graph_test",
|
||||||
srcs = ["line_graph_test.cc"],
|
srcs = ["line_graph_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":line_graph",
|
":line_graph",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/base:core_headers",
|
"@abseil-cpp//absl/base:core_headers",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -626,9 +646,10 @@ cc_library(
|
|||||||
name = "linear_assignment",
|
name = "linear_assignment",
|
||||||
srcs = ["linear_assignment.cc"],
|
srcs = ["linear_assignment.cc"],
|
||||||
hdrs = ["linear_assignment.h"],
|
hdrs = ["linear_assignment.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":iterators",
|
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
|
"//ortools/graph:iterators",
|
||||||
"//ortools/util:permutation",
|
"//ortools/util:permutation",
|
||||||
"//ortools/util:zvector",
|
"//ortools/util:zvector",
|
||||||
"@abseil-cpp//absl/flags:flag",
|
"@abseil-cpp//absl/flags:flag",
|
||||||
@@ -641,9 +662,9 @@ cc_test(
|
|||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["linear_assignment_test.cc"],
|
srcs = ["linear_assignment_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":linear_assignment",
|
":linear_assignment",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/flags:flag",
|
"@abseil-cpp//absl/flags:flag",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
"@abseil-cpp//absl/random:distributions",
|
"@abseil-cpp//absl/random:distributions",
|
||||||
@@ -656,10 +677,11 @@ cc_library(
|
|||||||
name = "dag_connectivity",
|
name = "dag_connectivity",
|
||||||
srcs = ["dag_connectivity.cc"],
|
srcs = ["dag_connectivity.cc"],
|
||||||
hdrs = ["dag_connectivity.h"],
|
hdrs = ["dag_connectivity.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":topologicalsorter",
|
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:container_logging",
|
"//ortools/base:container_logging",
|
||||||
|
"//ortools/graph:topologicalsorter",
|
||||||
"//ortools/util:bitset",
|
"//ortools/util:bitset",
|
||||||
"@abseil-cpp//absl/types:span",
|
"@abseil-cpp//absl/types:span",
|
||||||
],
|
],
|
||||||
@@ -681,6 +703,7 @@ cc_library(
|
|||||||
name = "perfect_matching",
|
name = "perfect_matching",
|
||||||
srcs = ["perfect_matching.cc"],
|
srcs = ["perfect_matching.cc"],
|
||||||
hdrs = ["perfect_matching.h"],
|
hdrs = ["perfect_matching.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:adjustable_priority_queue",
|
"//ortools/base:adjustable_priority_queue",
|
||||||
@@ -699,9 +722,10 @@ cc_library(
|
|||||||
name = "dag_shortest_path",
|
name = "dag_shortest_path",
|
||||||
srcs = ["dag_shortest_path.cc"],
|
srcs = ["dag_shortest_path.cc"],
|
||||||
hdrs = ["dag_shortest_path.h"],
|
hdrs = ["dag_shortest_path.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
"//ortools/graph",
|
||||||
":topologicalsorter",
|
"//ortools/graph:topologicalsorter",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
"@abseil-cpp//absl/log",
|
"@abseil-cpp//absl/log",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
@@ -715,11 +739,12 @@ cc_library(
|
|||||||
name = "dag_constrained_shortest_path",
|
name = "dag_constrained_shortest_path",
|
||||||
srcs = ["dag_constrained_shortest_path.cc"],
|
srcs = ["dag_constrained_shortest_path.cc"],
|
||||||
hdrs = ["dag_constrained_shortest_path.h"],
|
hdrs = ["dag_constrained_shortest_path.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":dag_shortest_path",
|
":dag_shortest_path",
|
||||||
":graph",
|
|
||||||
":topologicalsorter",
|
|
||||||
"//ortools/base:threadpool",
|
"//ortools/base:threadpool",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:topologicalsorter",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
"@abseil-cpp//absl/base:log_severity",
|
"@abseil-cpp//absl/base:log_severity",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
@@ -732,6 +757,7 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "rooted_tree",
|
name = "rooted_tree",
|
||||||
hdrs = ["rooted_tree.h"],
|
hdrs = ["rooted_tree.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base:status_macros",
|
"//ortools/base:status_macros",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
@@ -754,9 +780,9 @@ cc_test(
|
|||||||
name = "rooted_tree_test",
|
name = "rooted_tree_test",
|
||||||
srcs = ["rooted_tree_test.cc"],
|
srcs = ["rooted_tree_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
|
||||||
":rooted_tree",
|
":rooted_tree",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
"@abseil-cpp//absl/random",
|
"@abseil-cpp//absl/random",
|
||||||
@@ -785,12 +811,12 @@ cc_test(
|
|||||||
srcs = ["dag_shortest_path_test.cc"],
|
srcs = ["dag_shortest_path_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":dag_shortest_path",
|
":dag_shortest_path",
|
||||||
":graph",
|
|
||||||
":io",
|
|
||||||
"//ortools/base:dump_vars",
|
"//ortools/base:dump_vars",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
"//ortools/base:intops",
|
"//ortools/base:intops",
|
||||||
"//ortools/base:strong_vector",
|
"//ortools/base:strong_vector",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:io",
|
||||||
"//ortools/util:flat_matrix",
|
"//ortools/util:flat_matrix",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
"@abseil-cpp//absl/log:check",
|
"@abseil-cpp//absl/log:check",
|
||||||
@@ -806,10 +832,10 @@ cc_test(
|
|||||||
srcs = ["dag_constrained_shortest_path_test.cc"],
|
srcs = ["dag_constrained_shortest_path_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
":dag_constrained_shortest_path",
|
":dag_constrained_shortest_path",
|
||||||
":graph",
|
|
||||||
":io",
|
|
||||||
"//ortools/base:dump_vars",
|
"//ortools/base:dump_vars",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/graph",
|
||||||
|
"//ortools/graph:io",
|
||||||
"//ortools/math_opt/cpp:math_opt",
|
"//ortools/math_opt/cpp:math_opt",
|
||||||
"//ortools/math_opt/solvers:cp_sat_solver",
|
"//ortools/math_opt/solvers:cp_sat_solver",
|
||||||
"@abseil-cpp//absl/algorithm:container",
|
"@abseil-cpp//absl/algorithm:container",
|
||||||
@@ -830,6 +856,7 @@ cc_library(
|
|||||||
hdrs = [
|
hdrs = [
|
||||||
"connected_components.h",
|
"connected_components.h",
|
||||||
],
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
"//ortools/base:map_util",
|
"//ortools/base:map_util",
|
||||||
@@ -843,6 +870,7 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "io",
|
name = "io",
|
||||||
hdrs = ["graph_io.h"],
|
hdrs = ["graph_io.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
":graph",
|
||||||
"//ortools/base:numbers",
|
"//ortools/base:numbers",
|
||||||
@@ -856,12 +884,14 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "iterators",
|
name = "iterators",
|
||||||
hdrs = ["iterators.h"],
|
hdrs = ["iterators.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_test(
|
cc_test(
|
||||||
name = "iterators_test",
|
name = "iterators_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["iterators_test.cc"],
|
srcs = ["iterators_test.cc"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":iterators",
|
":iterators",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
@@ -873,6 +903,7 @@ cc_library(
|
|||||||
name = "random_graph",
|
name = "random_graph",
|
||||||
srcs = ["random_graph.cc"],
|
srcs = ["random_graph.cc"],
|
||||||
hdrs = ["random_graph.h"],
|
hdrs = ["random_graph.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
":graph",
|
||||||
"//ortools/base:logging",
|
"//ortools/base:logging",
|
||||||
@@ -889,6 +920,7 @@ cc_library(
|
|||||||
hdrs = [
|
hdrs = [
|
||||||
"strongly_connected_components.h",
|
"strongly_connected_components.h",
|
||||||
],
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
],
|
],
|
||||||
@@ -898,6 +930,7 @@ cc_library(
|
|||||||
name = "topologicalsorter",
|
name = "topologicalsorter",
|
||||||
srcs = ["topologicalsorter.cc"],
|
srcs = ["topologicalsorter.cc"],
|
||||||
hdrs = ["topologicalsorter.h"],
|
hdrs = ["topologicalsorter.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
":graph",
|
||||||
"//ortools/base",
|
"//ortools/base",
|
||||||
@@ -916,6 +949,7 @@ cc_library(
|
|||||||
name = "util",
|
name = "util",
|
||||||
srcs = ["util.cc"],
|
srcs = ["util.cc"],
|
||||||
hdrs = ["util.h"],
|
hdrs = ["util.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":connected_components",
|
":connected_components",
|
||||||
":graph",
|
":graph",
|
||||||
@@ -929,6 +963,7 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "test_util",
|
name = "test_util",
|
||||||
hdrs = ["test_util.h"],
|
hdrs = ["test_util.h"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
":graph",
|
":graph",
|
||||||
"//ortools/base:types",
|
"//ortools/base:types",
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/base/log_severity.h"
|
#include "absl/base/log_severity.h"
|
||||||
#include "absl/container/flat_hash_map.h"
|
|
||||||
#include "absl/random/distributions.h"
|
#include "absl/random/distributions.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
#include "absl/types/span.h"
|
#include "absl/types/span.h"
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ std::pair<DistanceType, std::vector<NodeIndex>> SimpleOneToOneShortestPath(
|
|||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// TODO(user): We should move `is_strong_int` to util/intops/strong_int.h.
|
// TODO(user): We should move `is_strong_int` to ortools/base/strong_int.h.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_strong_int : std::false_type {};
|
struct is_strong_int : std::false_type {};
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ struct GraphPathWithLength {
|
|||||||
|
|
||||||
// A wrapper that holds the memory needed to run many constrained shortest path
|
// A wrapper that holds the memory needed to run many constrained shortest path
|
||||||
// computations efficiently on the given DAG (on which resources do not change).
|
// computations efficiently on the given DAG (on which resources do not change).
|
||||||
// `GraphType` can use one of the interfaces defined in `util/graph/graph.h`.
|
// `GraphType` can use one of the interfaces defined in `ortools/graph/graph.h`.
|
||||||
template <class GraphType>
|
template <class GraphType>
|
||||||
class ConstrainedShortestPathsOnDagWrapper {
|
class ConstrainedShortestPathsOnDagWrapper {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ std::vector<PathWithLength> KShortestPathsOnDag(
|
|||||||
// A wrapper that holds the memory needed to run many shortest path computations
|
// A wrapper that holds the memory needed to run many shortest path computations
|
||||||
// efficiently on the given DAG. One call of `RunShortestPathOnDag()` has time
|
// efficiently on the given DAG. One call of `RunShortestPathOnDag()` has time
|
||||||
// complexity O(|E| + |V|) and space complexity O(|V|).
|
// complexity O(|E| + |V|) and space complexity O(|V|).
|
||||||
// `GraphType` can use any of the interfaces defined in `util/graph/graph.h`.
|
// `GraphType` can use any of the interfaces defined in `ortools/graph/graph.h`.
|
||||||
// `ArcLengthContainer` can be any container of doubles.
|
// `ArcLengthContainer` can be any container of doubles.
|
||||||
template <class GraphType, typename ArcLengthContainer = std::vector<double>>
|
template <class GraphType, typename ArcLengthContainer = std::vector<double>>
|
||||||
class ShortestPathsOnDagWrapper {
|
class ShortestPathsOnDagWrapper {
|
||||||
@@ -160,7 +160,7 @@ class ShortestPathsOnDagWrapper {
|
|||||||
// computations efficiently on the given DAG. One call of
|
// computations efficiently on the given DAG. One call of
|
||||||
// `RunKShortestPathOnDag()` has time complexity O(|E| + k|V|log(d)) where d is
|
// `RunKShortestPathOnDag()` has time complexity O(|E| + k|V|log(d)) where d is
|
||||||
// the mean degree of the graph and space complexity O(k|V|).
|
// the mean degree of the graph and space complexity O(k|V|).
|
||||||
// `GraphType` can use any of the interfaces defined in `util/graph/graph.h`.
|
// `GraphType` can use any of the interfaces defined in `ortools/graph/graph.h`.
|
||||||
// IMPORTANT: Only use if `path_count > 1` (k > 1) otherwise use
|
// IMPORTANT: Only use if `path_count > 1` (k > 1) otherwise use
|
||||||
// `ShortestPathsOnDagWrapper`.
|
// `ShortestPathsOnDagWrapper`.
|
||||||
template <class GraphType, typename ArcLengthContainer = std::vector<double>>
|
template <class GraphType, typename ArcLengthContainer = std::vector<double>>
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class MaxFlowStatusClass {
|
|||||||
// associated to an unique reverse arc going in the opposite direction
|
// associated to an unique reverse arc going in the opposite direction
|
||||||
// 'head -> tail'. We must also have reverse[reverse[arc]] = arc.
|
// 'head -> tail'. We must also have reverse[reverse[arc]] = arc.
|
||||||
//
|
//
|
||||||
// This works with all the reverse arc graphs from 'util/graph/graph.h' and
|
// This works with all the reverse arc graphs from 'ortools/graph/graph.h' and
|
||||||
// uses the API defined there.
|
// uses the API defined there.
|
||||||
//
|
//
|
||||||
// We actually support two kind of graphs with "reverse" arcs depending on the
|
// We actually support two kind of graphs with "reverse" arcs depending on the
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
// If the chosen graph type requires a call to `Build()`, the user is expected
|
// If the chosen graph type requires a call to `Build()`, the user is expected
|
||||||
// to perform this call, possibly after tweaking the graph.
|
// to perform this call, possibly after tweaking the graph.
|
||||||
//
|
//
|
||||||
// Consider using `CompleteGraph` (util/graph/graph.h) instead of this function
|
// Consider using `CompleteGraph` (ortools/graph/graph.h) instead of this
|
||||||
// in production code, as it uses constant memory to store the graph. Instead,
|
// function in production code, as it uses constant memory to store the graph.
|
||||||
// this function explicitly creates the graph using the template type, which is
|
// Instead, this function explicitly creates the graph using the template type,
|
||||||
// mostly useful for tests or when you have to tweak the graph after creation
|
// which is mostly useful for tests or when you have to tweak the graph after
|
||||||
// (i.e. a complete graph is just the core of your final graph).
|
// creation (i.e. a complete graph is just the core of your final graph).
|
||||||
//
|
//
|
||||||
// Args:
|
// Args:
|
||||||
// num_nodes: The number of nodes in the graph.
|
// num_nodes: The number of nodes in the graph.
|
||||||
@@ -89,11 +89,11 @@ Graph GenerateCompleteUndirectedBipartiteGraph(
|
|||||||
// If the chosen graph type requires a call to `Build()`, the user is expected
|
// If the chosen graph type requires a call to `Build()`, the user is expected
|
||||||
// to perform this call, possibly after tweaking the graph.
|
// to perform this call, possibly after tweaking the graph.
|
||||||
//
|
//
|
||||||
// Consider using `CompleteBipartiteGraph` (util/graph/graph.h) instead of this
|
// Consider using `CompleteBipartiteGraph` (ortools/graph/graph.h) instead of
|
||||||
// function in production code, as it uses constant memory to store the graph.
|
// this function in production code, as it uses constant memory to store the
|
||||||
// Instead, this function explicitly creates the graph using the template type,
|
// graph. Instead, this function explicitly creates the graph using the template
|
||||||
// which is mostly useful for tests or when you have to tweak the graph after
|
// type, which is mostly useful for tests or when you have to tweak the graph
|
||||||
// creation (i.e. a complete graph is just the core of your final graph).
|
// after creation (i.e. a complete graph is just the core of your final graph).
|
||||||
//
|
//
|
||||||
// Args:
|
// Args:
|
||||||
// num_nodes_1: The number of nodes in the first part of the graph.
|
// num_nodes_1: The number of nodes in the first part of the graph.
|
||||||
|
|||||||
@@ -165,12 +165,12 @@ absl::Status WriteGraphToFile(const Graph& graph, const std::string& filename,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// COV_NF_START
|
||||||
if (fclose(f) != 0) {
|
if (fclose(f) != 0) {
|
||||||
return absl::Status(absl::StatusCode::kInternal,
|
return absl::Status(absl::StatusCode::kInternal,
|
||||||
"Could not close file '" + filename + "'");
|
"Could not close file '" + filename + "'");
|
||||||
}
|
}
|
||||||
|
// COV_NF_END
|
||||||
return ::absl::OkStatus();
|
return ::absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ MPSolver::ResultStatus CBCInterface::Solve(const MPSolverParameters& param) {
|
|||||||
|
|
||||||
VLOG(1) << "cbc result status: " << tmp_status;
|
VLOG(1) << "cbc result status: " << tmp_status;
|
||||||
/* Final status of problem
|
/* Final status of problem
|
||||||
(info from cbc/.../CbcSolver.cpp,
|
(info from third_party/cbc/.../CbcSolver.cpp,
|
||||||
See http://cs?q="cbc+status"+file:CbcSolver.cpp)
|
See http://cs?q="cbc+status"+file:CbcSolver.cpp)
|
||||||
Some of these can be found out by is...... functions
|
Some of these can be found out by is...... functions
|
||||||
-1 before branchAndBound
|
-1 before branchAndBound
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -673,9 +674,7 @@ class Model:
|
|||||||
|
|
||||||
def new_bool_var(self, name: Optional[str] = None) -> Variable:
|
def new_bool_var(self, name: Optional[str] = None) -> Variable:
|
||||||
"""Creates a 0-1 variable with the given name."""
|
"""Creates a 0-1 variable with the given name."""
|
||||||
return self.new_var(
|
return self.new_var(0, 1, True, name) # numpy-scalars
|
||||||
0, 1, True, name
|
|
||||||
) # pytype: disable=wrong-arg-types # numpy-scalars
|
|
||||||
|
|
||||||
def new_constant(self, value: NumberT) -> Variable:
|
def new_constant(self, value: NumberT) -> Variable:
|
||||||
"""Declares a constant variable."""
|
"""Declares a constant variable."""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ ScipSeparationResult RunSeparation(internal::ScipCallbackRunner* runner,
|
|||||||
CHECK_OK(SCIP_TO_STATUS(SCIPreleaseRow(scip, &row)));
|
CHECK_OK(SCIP_TO_STATUS(SCIPreleaseRow(scip, &row)));
|
||||||
// TODO(user): when infeasible is true, it better to have the scip
|
// TODO(user): when infeasible is true, it better to have the scip
|
||||||
// return status be cutoff instead of cutting plane added (e.g. see
|
// return status be cutoff instead of cutting plane added (e.g. see
|
||||||
// cs/scip/src/scip/cons_knapsack.c). However, as we use
|
// cs/third_party/scip/src/scip/cons_knapsack.c). However, as we use
|
||||||
// SCIPaddRow(), it isn't clear this will even happen.
|
// SCIPaddRow(), it isn't clear this will even happen.
|
||||||
if (result != ScipSeparationResult::kLazyConstraintAdded) {
|
if (result != ScipSeparationResult::kLazyConstraintAdded) {
|
||||||
// NOTE(user): if we have already found a violated lazy constraint,
|
// NOTE(user): if we have already found a violated lazy constraint,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ MPModelRequest ReadMipModel(const std::string& input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPSolutionResponse LocalSolve(const MPModelRequest& request_proto) {
|
MPSolutionResponse LocalSolve(const MPModelRequest& request_proto) {
|
||||||
// TODO(or-core-team): Why doesn't this use MPSolver::SolveWithProto() ?
|
// TODO(user): Why doesn't this use MPSolver::SolveWithProto() ?
|
||||||
|
|
||||||
// Create the solver, we use the name of the model as the solver name.
|
// Create the solver, we use the name of the model as the solver name.
|
||||||
MPSolver solver(request_proto.model().name(),
|
MPSolver solver(request_proto.model().name(),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
load("@pip_deps//:requirements.bzl", "requirement")
|
load("@pip_deps//:requirements.bzl", "requirement")
|
||||||
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
|
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
|
||||||
load("@rules_python//python:defs.bzl", "py_test")
|
load("@rules_python//python:py_test.bzl", "py_test")
|
||||||
|
|
||||||
package(default_visibility = ["//ortools/math_opt:__subpackages__"])
|
package(default_visibility = ["//ortools/math_opt:__subpackages__"])
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||||
|
load("@rules_cc//cc:cc_test.bzl", "cc_test")
|
||||||
|
|
||||||
# External users should depend only on ":math_opt" and include
|
# External users should depend only on ":math_opt" and include
|
||||||
# "math_opt.h". Hence other libraries are private.
|
# "math_opt.h". Hence other libraries are private.
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 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.
|
||||||
|
|
||||||
from ortools.math_opt.python.elemental import elemental
|
from ortools.math_opt.python.elemental import elemental
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class BindingsTest(compare_proto.MathOptProtoAssertions, absltest.TestCase):
|
|||||||
def test_bad_element_type_raises(self):
|
def test_bad_element_type_raises(self):
|
||||||
e = cpp_elemental.CppElemental()
|
e = cpp_elemental.CppElemental()
|
||||||
with self.assertRaisesRegex(TypeError, "incompatible function arguments"):
|
with self.assertRaisesRegex(TypeError, "incompatible function arguments"):
|
||||||
e.add_elements(-42, 1) # pytype: disable=wrong-arg-types
|
e.add_elements(-42, 1)
|
||||||
|
|
||||||
def test_attr0(self):
|
def test_attr0(self):
|
||||||
e = cpp_elemental.CppElemental()
|
e = cpp_elemental.CppElemental()
|
||||||
@@ -294,14 +294,14 @@ class BindingsTest(compare_proto.MathOptProtoAssertions, absltest.TestCase):
|
|||||||
def test_attr0_bad_attr_id_raises(self):
|
def test_attr0_bad_attr_id_raises(self):
|
||||||
e = cpp_elemental.CppElemental()
|
e = cpp_elemental.CppElemental()
|
||||||
with self.assertRaisesRegex(TypeError, "incompatible function arguments"):
|
with self.assertRaisesRegex(TypeError, "incompatible function arguments"):
|
||||||
e.get_attrs(-42, np.array([1])) # pytype: disable=wrong-arg-types
|
e.get_attrs(-42, np.array([1]))
|
||||||
# Note: `assertRaisesRegex` does not seem to work with multiline regexps.
|
# Note: `assertRaisesRegex` does not seem to work with multiline regexps.
|
||||||
with self.assertRaisesRegex(TypeError, "incompatible function arguments"):
|
with self.assertRaisesRegex(TypeError, "incompatible function arguments"):
|
||||||
e.get_attrs(_VARIABLE, ()) # pytype: disable=wrong-arg-types
|
e.get_attrs(_VARIABLE, ())
|
||||||
with self.assertRaisesRegex(TypeError, "attr: BoolAttr0"):
|
with self.assertRaisesRegex(TypeError, "attr: BoolAttr0"):
|
||||||
e.get_attrs(_VARIABLE, ()) # pytype: disable=wrong-arg-types
|
e.get_attrs(_VARIABLE, ())
|
||||||
with self.assertRaisesRegex(TypeError, "attr: DoubleAttr1"):
|
with self.assertRaisesRegex(TypeError, "attr: DoubleAttr1"):
|
||||||
e.get_attrs(_VARIABLE, ()) # pytype: disable=wrong-arg-types
|
e.get_attrs(_VARIABLE, ())
|
||||||
|
|
||||||
def test_attr1_bad_element_id_raises(self):
|
def test_attr1_bad_element_id_raises(self):
|
||||||
e = cpp_elemental.CppElemental()
|
e = cpp_elemental.CppElemental()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
load("@pip_deps//:requirements.bzl", "requirement")
|
load("@pip_deps//:requirements.bzl", "requirement")
|
||||||
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
|
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
|
||||||
load("@rules_python//python:defs.bzl", "py_test")
|
load("@rules_python//python:py_test.bzl", "py_test")
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
load("@pip_deps//:requirements.bzl", "requirement")
|
load("@pip_deps//:requirements.bzl", "requirement")
|
||||||
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
load("@rules_python//python:py_library.bzl", "py_library")
|
||||||
|
load("@rules_python//python:py_test.bzl", "py_test")
|
||||||
|
|
||||||
# External users should depend only on ":mathopt" and import "mathopt".
|
# External users should depend only on ":mathopt" and import "mathopt".
|
||||||
# Hence other libraries are private.
|
# Hence other libraries are private.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
load("@pip_deps//:requirements.bzl", "requirement")
|
load("@pip_deps//:requirements.bzl", "requirement")
|
||||||
load("@rules_python//python:defs.bzl", "py_library")
|
load("@rules_python//python:py_library.bzl", "py_library")
|
||||||
|
|
||||||
package(default_visibility = [
|
package(default_visibility = [
|
||||||
"//ortools/math_opt/elemental/python:__subpackages__",
|
"//ortools/math_opt/elemental/python:__subpackages__",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ py_library(
|
|||||||
deps = [
|
deps = [
|
||||||
":proto_converter",
|
":proto_converter",
|
||||||
"//ortools/service/v1:optimization_py_pb2",
|
"//ortools/service/v1:optimization_py_pb2",
|
||||||
|
"@protobuf//:protobuf_python",
|
||||||
requirement("requests"),
|
requirement("requests"),
|
||||||
"//ortools/math_opt:rpc_py_pb2",
|
"//ortools/math_opt:rpc_py_pb2",
|
||||||
"//ortools/math_opt/python:mathopt",
|
"//ortools/math_opt/python:mathopt",
|
||||||
"@protobuf//:protobuf_python",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class ModelSetObjectiveTest(absltest.TestCase):
|
|||||||
x = mod.add_variable()
|
x = mod.add_variable()
|
||||||
|
|
||||||
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
||||||
mod.maximize_linear_objective(x * x) # pytype: disable=wrong-arg-types
|
mod.maximize_linear_objective(x * x)
|
||||||
|
|
||||||
def test_maximize_quadratic_objective(self) -> None:
|
def test_maximize_quadratic_objective(self) -> None:
|
||||||
mod = model.Model()
|
mod = model.Model()
|
||||||
@@ -125,7 +125,7 @@ class ModelSetObjectiveTest(absltest.TestCase):
|
|||||||
x = mod.add_variable()
|
x = mod.add_variable()
|
||||||
|
|
||||||
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
||||||
mod.minimize_linear_objective(x * x) # pytype: disable=wrong-arg-types
|
mod.minimize_linear_objective(x * x)
|
||||||
|
|
||||||
def test_minimize_quadratic_objective(self) -> None:
|
def test_minimize_quadratic_objective(self) -> None:
|
||||||
mod = model.Model()
|
mod = model.Model()
|
||||||
@@ -176,9 +176,7 @@ class ModelSetObjectiveTest(absltest.TestCase):
|
|||||||
x = mod.add_variable()
|
x = mod.add_variable()
|
||||||
|
|
||||||
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
||||||
mod.set_linear_objective(
|
mod.set_linear_objective(x * x, is_maximize=True)
|
||||||
x * x, is_maximize=True
|
|
||||||
) # pytype: disable=wrong-arg-types
|
|
||||||
|
|
||||||
def test_set_objective_quadratic_objective(self) -> None:
|
def test_set_objective_quadratic_objective(self) -> None:
|
||||||
mod = model.Model()
|
mod = model.Model()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ class ModelTest(compare_proto.MathOptProtoAssertions, parameterized.TestCase):
|
|||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
TypeError, "Unsupported type for expr argument.*str"
|
TypeError, "Unsupported type for expr argument.*str"
|
||||||
):
|
):
|
||||||
mod.add_linear_constraint(expr="string") # pytype: disable=wrong-arg-types
|
mod.add_linear_constraint(expr="string")
|
||||||
|
|
||||||
with self.assertRaisesRegex(ValueError, ".*infinite offset."):
|
with self.assertRaisesRegex(ValueError, ".*infinite offset."):
|
||||||
mod.add_linear_constraint(expr=math.inf, lb=0.0)
|
mod.add_linear_constraint(expr=math.inf, lb=0.0)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -60,9 +60,7 @@ class NormalizedLinearInequalityTest(absltest.TestCase):
|
|||||||
mod = model.Model()
|
mod = model.Model()
|
||||||
x = mod.add_variable()
|
x = mod.add_variable()
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
normalized_inequality.NormalizedLinearInequality(
|
normalized_inequality.NormalizedLinearInequality(lb=1.0, expr=x * x, ub=2.0)
|
||||||
lb=1.0, expr=x * x, ub=2.0
|
|
||||||
) # pytype: disable=wrong-arg-types
|
|
||||||
|
|
||||||
def test_as_normalized_inequality_from_parts(self) -> None:
|
def test_as_normalized_inequality_from_parts(self) -> None:
|
||||||
mod = model.Model()
|
mod = model.Model()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class LinearObjectiveTest(parameterized.TestCase):
|
|||||||
mod, obj = _model_and_objective(primary)
|
mod, obj = _model_and_objective(primary)
|
||||||
x = mod.add_variable()
|
x = mod.add_variable()
|
||||||
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
||||||
obj.add_linear(x * x) # pytype: disable=wrong-arg-types
|
obj.add_linear(x * x)
|
||||||
|
|
||||||
def test_set_to_linear(self, primary: bool) -> None:
|
def test_set_to_linear(self, primary: bool) -> None:
|
||||||
mod, obj = _model_and_objective(primary)
|
mod, obj = _model_and_objective(primary)
|
||||||
@@ -188,7 +188,7 @@ class LinearObjectiveTest(parameterized.TestCase):
|
|||||||
mod, obj = _model_and_objective(primary)
|
mod, obj = _model_and_objective(primary)
|
||||||
x = mod.add_variable()
|
x = mod.add_variable()
|
||||||
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
with self.assertRaisesRegex(TypeError, "Quadratic"):
|
||||||
obj.set_to_linear_expression(x * x) # pytype: disable=wrong-arg-types
|
obj.set_to_linear_expression(x * x)
|
||||||
|
|
||||||
def test_set_to_expression(self, primary: bool) -> None:
|
def test_set_to_expression(self, primary: bool) -> None:
|
||||||
mod, obj = _model_and_objective(primary)
|
mod, obj = _model_and_objective(primary)
|
||||||
@@ -453,9 +453,7 @@ class AuxiliaryObjectiveTest(absltest.TestCase):
|
|||||||
def test_invalid_id_type(self) -> None:
|
def test_invalid_id_type(self) -> None:
|
||||||
elemental = cpp_elemental.CppElemental()
|
elemental = cpp_elemental.CppElemental()
|
||||||
with self.assertRaisesRegex(TypeError, "obj_id type"):
|
with self.assertRaisesRegex(TypeError, "obj_id type"):
|
||||||
objectives.AuxiliaryObjective(
|
objectives.AuxiliaryObjective(elemental, "dog")
|
||||||
elemental, "dog"
|
|
||||||
) # pytype: disable=wrong-arg-types
|
|
||||||
|
|
||||||
def test_eq(self) -> None:
|
def test_eq(self) -> None:
|
||||||
mod1 = model.Model()
|
mod1 = model.Model()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class SolveResultAuxiliaryFunctionsTest(absltest.TestCase):
|
|||||||
with self.assertRaisesRegex(KeyError, ".*string"):
|
with self.assertRaisesRegex(KeyError, ".*string"):
|
||||||
res.variable_values([y, "string"])
|
res.variable_values([y, "string"])
|
||||||
with self.assertRaisesRegex(TypeError, ".*int"):
|
with self.assertRaisesRegex(TypeError, ".*int"):
|
||||||
res.variable_values(20) # pytype: disable=wrong-arg-types
|
res.variable_values(20)
|
||||||
|
|
||||||
def test_primal_solution_no_feasible(self) -> None:
|
def test_primal_solution_no_feasible(self) -> None:
|
||||||
mod = model.Model(name="test_model")
|
mod = model.Model(name="test_model")
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
load("@pip_deps//:requirements.bzl", "requirement")
|
load("@pip_deps//:requirements.bzl", "requirement")
|
||||||
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
load("@rules_python//python:py_library.bzl", "py_library")
|
||||||
|
load("@rules_python//python:py_test.bzl", "py_test")
|
||||||
|
|
||||||
package(default_visibility = ["//ortools/math_opt:__subpackages__"])
|
package(default_visibility = ["//ortools/math_opt:__subpackages__"])
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -313,9 +314,7 @@ class LinearBase(metaclass=abc.ABCMeta):
|
|||||||
|
|
||||||
def __eq__(
|
def __eq__(
|
||||||
self, rhs: LinearTypes
|
self, rhs: LinearTypes
|
||||||
) -> (
|
) -> BoundedLinearExpression: # overriding-return-type-checks
|
||||||
BoundedLinearExpression
|
|
||||||
): # pytype: disable=signature-mismatch # overriding-return-type-checks
|
|
||||||
# Note: when rhs is a QuadraticBase, this will cause rhs.__eq__(self) to be
|
# Note: when rhs is a QuadraticBase, this will cause rhs.__eq__(self) to be
|
||||||
# invoked, which is defined.
|
# invoked, which is defined.
|
||||||
if isinstance(rhs, QuadraticBase):
|
if isinstance(rhs, QuadraticBase):
|
||||||
@@ -326,11 +325,7 @@ class LinearBase(metaclass=abc.ABCMeta):
|
|||||||
_raise_binary_operator_type_error("==", type(self), type(rhs))
|
_raise_binary_operator_type_error("==", type(self), type(rhs))
|
||||||
return BoundedLinearExpression(0.0, self - rhs, 0.0)
|
return BoundedLinearExpression(0.0, self - rhs, 0.0)
|
||||||
|
|
||||||
def __ne__(
|
def __ne__(self, rhs: LinearTypes) -> NoReturn: # overriding-return-type-checks
|
||||||
self, rhs: LinearTypes
|
|
||||||
) -> (
|
|
||||||
NoReturn
|
|
||||||
): # pytype: disable=signature-mismatch # overriding-return-type-checks
|
|
||||||
_raise_ne_not_supported()
|
_raise_ne_not_supported()
|
||||||
|
|
||||||
@typing.overload
|
@typing.overload
|
||||||
@@ -505,20 +500,14 @@ class QuadraticBase(metaclass=abc.ABCMeta):
|
|||||||
|
|
||||||
def __eq__(
|
def __eq__(
|
||||||
self, rhs: QuadraticTypes
|
self, rhs: QuadraticTypes
|
||||||
) -> (
|
) -> BoundedQuadraticExpression: # overriding-return-type-checks
|
||||||
BoundedQuadraticExpression
|
|
||||||
): # pytype: disable=signature-mismatch # overriding-return-type-checks
|
|
||||||
if isinstance(rhs, (int, float)):
|
if isinstance(rhs, (int, float)):
|
||||||
return BoundedQuadraticExpression(rhs, self, rhs)
|
return BoundedQuadraticExpression(rhs, self, rhs)
|
||||||
if not isinstance(rhs, (LinearBase, QuadraticBase)):
|
if not isinstance(rhs, (LinearBase, QuadraticBase)):
|
||||||
_raise_binary_operator_type_error("==", type(self), type(rhs))
|
_raise_binary_operator_type_error("==", type(self), type(rhs))
|
||||||
return BoundedQuadraticExpression(0.0, self - rhs, 0.0)
|
return BoundedQuadraticExpression(0.0, self - rhs, 0.0)
|
||||||
|
|
||||||
def __ne__(
|
def __ne__(self, rhs: QuadraticTypes) -> NoReturn: # overriding-return-type-checks
|
||||||
self, rhs: QuadraticTypes
|
|
||||||
) -> (
|
|
||||||
NoReturn
|
|
||||||
): # pytype: disable=signature-mismatch # overriding-return-type-checks
|
|
||||||
_raise_ne_not_supported()
|
_raise_ne_not_supported()
|
||||||
|
|
||||||
@typing.overload
|
@typing.overload
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ struct SolutionHintTestParams {
|
|||||||
std::optional<SolveParameters> two_hint_params;
|
std::optional<SolveParameters> two_hint_params;
|
||||||
|
|
||||||
// A testing::ContainsRegex-compatible regex for the expected hint-acceptance
|
// A testing::ContainsRegex-compatible regex for the expected hint-acceptance
|
||||||
// message. see #regular-expression-syntax)
|
// message. see http://go/gunitadvanced#regular-expression-syntax)
|
||||||
std::string hint_accepted_message_regex;
|
std::string hint_accepted_message_regex;
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& out,
|
friend std::ostream& operator<<(std::ostream& out,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
|
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
|
||||||
|
load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library")
|
||||||
load("@protobuf//bazel:proto_library.bzl", "proto_library")
|
load("@protobuf//bazel:proto_library.bzl", "proto_library")
|
||||||
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
|
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
|
||||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||||
@@ -25,6 +26,12 @@ proto_library(
|
|||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
java_proto_library(
|
||||||
|
name = "gscip_java_proto",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [":gscip_proto"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_proto_library(
|
cc_proto_library(
|
||||||
name = "gscip_cc_proto",
|
name = "gscip_cc_proto",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
@@ -236,9 +243,9 @@ cc_test(
|
|||||||
":gscip_cc_proto",
|
":gscip_cc_proto",
|
||||||
":gscip_from_mp_model_proto",
|
":gscip_from_mp_model_proto",
|
||||||
":gscip_testing",
|
":gscip_testing",
|
||||||
"//ortools/base:parse_test_proto",
|
|
||||||
"//ortools/base:gmock",
|
"//ortools/base:gmock",
|
||||||
"//ortools/base:gmock_main",
|
"//ortools/base:gmock_main",
|
||||||
|
"//ortools/base:parse_test_proto",
|
||||||
"//ortools/linear_solver:linear_solver_cc_proto",
|
"//ortools/linear_solver:linear_solver_cc_proto",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -27,10 +26,11 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "ortools/base/gmock.h"
|
#include "ortools/base/gmock.h"
|
||||||
#include "ortools/base/logging.h"
|
#include "ortools/base/logging.h"
|
||||||
#include "ortools/base/status_macros.h"
|
|
||||||
#include "ortools/math_opt/solvers/gscip/gscip.h"
|
#include "ortools/math_opt/solvers/gscip/gscip.h"
|
||||||
#include "ortools/math_opt/solvers/gscip/gscip.pb.h"
|
#include "ortools/math_opt/solvers/gscip/gscip.pb.h"
|
||||||
|
#include "scip/def.h"
|
||||||
#include "scip/type_event.h"
|
#include "scip/type_event.h"
|
||||||
|
#include "scip/type_retcode.h"
|
||||||
#include "scip/type_var.h"
|
#include "scip/type_var.h"
|
||||||
|
|
||||||
namespace operations_research {
|
namespace operations_research {
|
||||||
@@ -193,7 +193,7 @@ TEST(GScipEventHandlerDeathTest, ErrorReturnedByInit) {
|
|||||||
struct FailingHandler : public GScipEventHandler {
|
struct FailingHandler : public GScipEventHandler {
|
||||||
FailingHandler() : GScipEventHandler({.name = "failing handler"}) {}
|
FailingHandler() : GScipEventHandler({.name = "failing handler"}) {}
|
||||||
|
|
||||||
SCIP_RETCODE Init(GScip* const gscip) override { return SCIP_ERROR; }
|
SCIP_RETCODE Init(GScip* const /*gscip*/) override { return SCIP_ERROR; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returning an error in Init() will not only make the Solve() fail, but will
|
// Returning an error in Init() will not only make the Solve() fail, but will
|
||||||
@@ -233,7 +233,7 @@ TEST(GScipEventHandlerDeathTest, ErrorReturnedByExit) {
|
|||||||
struct FailingHandler : public GScipEventHandler {
|
struct FailingHandler : public GScipEventHandler {
|
||||||
FailingHandler() : GScipEventHandler({.name = "failing handler"}) {}
|
FailingHandler() : GScipEventHandler({.name = "failing handler"}) {}
|
||||||
|
|
||||||
SCIP_RETCODE Exit(GScip* const gscip) override { return SCIP_ERROR; }
|
SCIP_RETCODE Exit(GScip* const /*gscip*/) override { return SCIP_ERROR; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// See the comment in ErrorReturnedByInit test.
|
// See the comment in ErrorReturnedByInit test.
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# Notebook utilities for OR-Tools.
|
# Notebook utilities for OR-Tools.
|
||||||
|
|
||||||
load("@ortools_notebook_deps//:requirements.bzl", "requirement")
|
load("@ortools_notebook_deps//:requirements.bzl", "requirement")
|
||||||
|
load("@pip_deps//:requirements.bzl", "requirement")
|
||||||
load("@rules_python//python:py_binary.bzl", "py_binary")
|
load("@rules_python//python:py_binary.bzl", "py_binary")
|
||||||
|
|
||||||
py_binary(
|
py_binary(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
|
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
|
||||||
|
load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library")
|
||||||
load("@protobuf//bazel:proto_library.bzl", "proto_library")
|
load("@protobuf//bazel:proto_library.bzl", "proto_library")
|
||||||
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
|
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import "ortools/service/v1/mathopt/sparse_containers.proto";
|
|||||||
|
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
option java_package = "com.google.ortools.service.v1.mathopt";
|
option java_package = "com.google.ortools.service.v1.mathopt";
|
||||||
|
|
||||||
option csharp_namespace = "Google.OrTools.Service";
|
option csharp_namespace = "Google.OrTools.Service";
|
||||||
|
|
||||||
// As used below, we define "#variables" = size(VariablesProto.ids).
|
// As used below, we define "#variables" = size(VariablesProto.ids).
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import "ortools/service/v1/mathopt/sparse_containers.proto";
|
|||||||
|
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
option java_package = "com.google.ortools.service.v1.mathopt";
|
option java_package = "com.google.ortools.service.v1.mathopt";
|
||||||
|
|
||||||
option csharp_namespace = "Google.OrTools.Service";
|
option csharp_namespace = "Google.OrTools.Service";
|
||||||
|
|
||||||
// A suggested starting solution for the solver.
|
// A suggested starting solution for the solver.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import "google/protobuf/duration.proto";
|
|||||||
|
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
option java_package = "com.google.ortools.service.v1.mathopt";
|
option java_package = "com.google.ortools.service.v1.mathopt";
|
||||||
|
|
||||||
option csharp_namespace = "Google.OrTools.Service";
|
option csharp_namespace = "Google.OrTools.Service";
|
||||||
|
|
||||||
// The solvers supported by MathOpt.
|
// The solvers supported by MathOpt.
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import "ortools/service/v1/mathopt/solver_resources.proto";
|
|||||||
|
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
option java_package = "com.google.ortools.service.v1";
|
option java_package = "com.google.ortools.service.v1";
|
||||||
|
|
||||||
option csharp_namespace = "Google.OrTools.Service";
|
option csharp_namespace = "Google.OrTools.Service";
|
||||||
|
|
||||||
// A One Platform API exposing a set of optimization solvers for high-level
|
// A One Platform API exposing a set of optimization solvers for high-level
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -406,7 +406,6 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "random_engine",
|
name = "random_engine",
|
||||||
hdrs = ["random_engine.h"],
|
hdrs = ["random_engine.h"],
|
||||||
deps = [],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
# Copyright 2010-2025 Google LLC
|
# Copyright 2010-2025 Google LLC
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
|||||||
Reference in New Issue
Block a user