all libraries compiles under bazel
This commit is contained in:
48
WORKSPACE
48
WORKSPACE
@@ -1,48 +1,52 @@
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
|
||||
|
||||
#Import the gflags files.
|
||||
git_repository(
|
||||
name = "com_github_gflags_gflags",
|
||||
name = "com_github_gflags_gflags",
|
||||
commit = "f8a0efe03aa69b3336d8e228b37d4ccb17324b88",
|
||||
remote = "https://github.com/gflags/gflags.git",
|
||||
tag = "v2.2.2",
|
||||
)
|
||||
|
||||
#Import the glog files.
|
||||
new_git_repository(
|
||||
name = "com_github_glog_glog",
|
||||
name = "com_github_glog_glog",
|
||||
build_file = "//bazel:glog.BUILD",
|
||||
remote = "https://github.com/google/glog.git",
|
||||
tag = "v0.3.5",
|
||||
)
|
||||
|
||||
# proto_library rules implicitly depend on @com_google_protobuf//:protoc,
|
||||
# which is the proto-compiler.
|
||||
# This statement defines the @com_google_protobuf repo.
|
||||
http_archive(
|
||||
name = "com_google_protobuf",
|
||||
urls = ["https://github.com/google/protobuf/archive/b4b0e304be5a68de3d0ee1af9b286f958750f5e4.zip"],
|
||||
strip_prefix = "protobuf-b4b0e304be5a68de3d0ee1af9b286f958750f5e4",
|
||||
sha256 = "ff771a662fb6bd4d3cc209bcccedef3e93980a49f71df1e987f6afa3bcdcba3a",
|
||||
sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2",
|
||||
strip_prefix = "protobuf-3.6.1.3",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.6.1.3.zip"],
|
||||
)
|
||||
|
||||
# cc_proto_library rules implicitly depend on
|
||||
# @com_google_protobuf_cc//:cc_toolchain, which is the C++ proto runtime
|
||||
# (base classes and common utilities).
|
||||
http_archive(
|
||||
name = "com_google_protobuf_cc",
|
||||
urls = ["https://github.com/google/protobuf/archive/b4b0e304be5a68de3d0ee1af9b286f958750f5e4.zip"],
|
||||
strip_prefix = "protobuf-b4b0e304be5a68de3d0ee1af9b286f958750f5e4",
|
||||
sha256 = "ff771a662fb6bd4d3cc209bcccedef3e93980a49f71df1e987f6afa3bcdcba3a",
|
||||
sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2",
|
||||
strip_prefix = "protobuf-3.6.1.3",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.6.1.3.zip"],
|
||||
)
|
||||
|
||||
new_http_archive(
|
||||
http_archive(
|
||||
name = "gtest",
|
||||
url = "https://github.com/google/googletest/archive/release-1.8.0.zip",
|
||||
build_file = "//bazel:gtest.BUILD",
|
||||
strip_prefix = "googletest-release-1.8.0/googletest",
|
||||
url = "https://github.com/google/googletest/archive/release-1.8.0.zip",
|
||||
)
|
||||
|
||||
new_http_archive(
|
||||
name = "glpk",
|
||||
url = "http://ftp.gnu.org/gnu/glpk/glpk-4.52.tar.gz",
|
||||
sha256 = "9a5dab356268b4f177c33e00ddf8164496dc2434e83bd1114147024df983a3bb",
|
||||
build_file = "//bazel:glpk.BUILD",
|
||||
http_archive(
|
||||
name = "com_google_absl",
|
||||
sha256 = "fe4d9e424dc25ee57695509cf6c5a7dd582a7ac1ca1efb92713fb439b3e8b1c6",
|
||||
urls = ["https://github.com/abseil/abseil-cpp/archive/20181200.zip"],
|
||||
strip_prefix = "abseil-cpp-20181200",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "glpk",
|
||||
build_file = "//bazel:glpk.BUILD",
|
||||
sha256 = "9a5dab356268b4f177c33e00ddf8164496dc2434e83bd1114147024df983a3bb",
|
||||
url = "http://ftp.gnu.org/gnu/glpk/glpk-4.52.tar.gz",
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@ cc_library(
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:hash",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -20,7 +21,7 @@ cc_test(
|
||||
"//ortools/base",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@gtest//:main",
|
||||
],
|
||||
)
|
||||
@@ -59,6 +60,20 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "knapsack_solver_for_cuts",
|
||||
srcs = ["knapsack_solver_for_cuts.cc"],
|
||||
hdrs = ["knapsack_solver_for_cuts.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:ptr_util",
|
||||
"//ortools/util:time_limit",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "dense_doubly_linked_list",
|
||||
hdrs = ["dense_doubly_linked_list.h"],
|
||||
@@ -74,7 +89,8 @@ cc_library(
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:murmur",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -84,7 +100,7 @@ cc_library(
|
||||
hdrs = ["sparse_permutation.h"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -95,7 +111,7 @@ cc_library(
|
||||
deps = [
|
||||
":sparse_permutation",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -109,11 +125,12 @@ cc_library(
|
||||
":dynamic_permutation",
|
||||
":sparse_permutation",
|
||||
"//ortools/base",
|
||||
"//ortools/base:canonical_errors",
|
||||
"//ortools/base:status",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/graph",
|
||||
"//ortools/graph:iterators",
|
||||
"//ortools/graph:util",
|
||||
"//ortools/util:iterators",
|
||||
"//ortools/util:stats",
|
||||
"//ortools/util:time_limit",
|
||||
],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "ortools/algorithms/hungarian.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ortools/base/integral_types.h"
|
||||
#include "ortools/base/macros.h"
|
||||
@@ -15,19 +15,19 @@ namespace operations_research {
|
||||
// result as well as whether the result is the expected one.
|
||||
|
||||
void GenericCheck(const int expected_assignment_size,
|
||||
const std::unordered_map<int, int>& direct_assignment,
|
||||
const std::unordered_map<int, int>& reverse_assignment,
|
||||
const absl::flat_hash_map<int, int>& direct_assignment,
|
||||
const absl::flat_hash_map<int, int>& reverse_assignment,
|
||||
const int expected_agents[], const int expected_tasks[]) {
|
||||
EXPECT_EQ(expected_assignment_size, direct_assignment.size());
|
||||
EXPECT_EQ(expected_assignment_size, reverse_assignment.size());
|
||||
for (int i = 0; i < expected_assignment_size; ++i) {
|
||||
EXPECT_EQ(FindOrDie(direct_assignment, expected_agents[i]),
|
||||
EXPECT_EQ(gtl::FindOrDie(direct_assignment, expected_agents[i]),
|
||||
expected_tasks[i]);
|
||||
EXPECT_EQ(FindOrDie(reverse_assignment, expected_tasks[i]),
|
||||
EXPECT_EQ(gtl::FindOrDie(reverse_assignment, expected_tasks[i]),
|
||||
expected_agents[i]);
|
||||
}
|
||||
for (const auto& direct_iter : direct_assignment) {
|
||||
EXPECT_EQ(FindOrDie(reverse_assignment, direct_iter.second),
|
||||
EXPECT_EQ(gtl::FindOrDie(reverse_assignment, direct_iter.second),
|
||||
direct_iter.first)
|
||||
<< direct_iter.first << " -> " << direct_iter.second;
|
||||
}
|
||||
@@ -36,8 +36,8 @@ void GenericCheck(const int expected_assignment_size,
|
||||
void TestMinimization(const std::vector<std::vector<double> >& cost,
|
||||
const int expected_assignment_size,
|
||||
const int expected_agents[], const int expected_tasks[]) {
|
||||
std::unordered_map<int, int> direct_assignment;
|
||||
std::unordered_map<int, int> reverse_assignment;
|
||||
absl::flat_hash_map<int, int> direct_assignment;
|
||||
absl::flat_hash_map<int, int> reverse_assignment;
|
||||
MinimizeLinearAssignment(cost, &direct_assignment, &reverse_assignment);
|
||||
SCOPED_TRACE("Minimization");
|
||||
GenericCheck(expected_assignment_size, direct_assignment, reverse_assignment,
|
||||
@@ -47,8 +47,8 @@ void TestMinimization(const std::vector<std::vector<double> >& cost,
|
||||
void TestMaximization(const std::vector<std::vector<double> >& cost,
|
||||
const int expected_assignment_size,
|
||||
const int expected_agents[], const int expected_tasks[]) {
|
||||
std::unordered_map<int, int> direct_assignment;
|
||||
std::unordered_map<int, int> reverse_assignment;
|
||||
absl::flat_hash_map<int, int> direct_assignment;
|
||||
absl::flat_hash_map<int, int> reverse_assignment;
|
||||
MaximizeLinearAssignment(cost, &direct_assignment, &reverse_assignment);
|
||||
SCOPED_TRACE("Maximization");
|
||||
GenericCheck(expected_assignment_size, direct_assignment, reverse_assignment,
|
||||
|
||||
@@ -8,7 +8,6 @@ cc_library(
|
||||
"integral_types.h",
|
||||
"logging.h",
|
||||
"macros.h",
|
||||
"port.h",
|
||||
],
|
||||
deps = [
|
||||
"@com_github_gflags_gflags//:gflags",
|
||||
@@ -26,7 +25,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
cc_library(
|
||||
name = "status",
|
||||
hdrs = [
|
||||
@@ -58,6 +56,13 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "ptr_util",
|
||||
hdrs = [
|
||||
"ptr_util.h",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sysinfo",
|
||||
srcs = [
|
||||
@@ -68,7 +73,7 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
":strings",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -83,11 +88,22 @@ cc_library(
|
||||
deps = [
|
||||
":base",
|
||||
":status",
|
||||
":strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "filelineiter",
|
||||
hdrs = ["filelineiter.h"],
|
||||
deps = [
|
||||
":base",
|
||||
":file",
|
||||
":status",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "recordio",
|
||||
srcs = [
|
||||
@@ -101,25 +117,20 @@ cc_library(
|
||||
":base",
|
||||
":file",
|
||||
":status",
|
||||
":strings",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "filelinereader",
|
||||
srcs = [
|
||||
"filelinereader.cc",
|
||||
],
|
||||
name = "protoutil",
|
||||
hdrs = [
|
||||
"filelinereader.h",
|
||||
"protoutil.h",
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
":callback",
|
||||
":file",
|
||||
":status",
|
||||
":strings",
|
||||
":statusor",
|
||||
":timer",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
],
|
||||
)
|
||||
@@ -132,7 +143,7 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
":strings",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
],
|
||||
)
|
||||
@@ -176,7 +187,7 @@ cc_library(
|
||||
deps = [
|
||||
":base",
|
||||
":hash",
|
||||
":strings",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -210,6 +221,13 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "canonical_errors",
|
||||
hdrs = [
|
||||
"canonical_errors.h",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "stl_util",
|
||||
hdrs = [
|
||||
@@ -240,28 +258,17 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "strongly_connected_components",
|
||||
hdrs = [
|
||||
"strongly_connected_components.h",
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "timer",
|
||||
srcs = [
|
||||
"time_support.cc",
|
||||
"timer.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"time_support.h",
|
||||
"timer.h",
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
"@com_google_absl//absl/time",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -304,19 +311,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "mutex",
|
||||
srcs = [
|
||||
"mutex.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"mutex.h",
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "threadpool",
|
||||
srcs = [
|
||||
@@ -327,27 +321,6 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
":mutex",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "inlined_vector",
|
||||
hdrs = [
|
||||
"inlined_vector.h",
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "span",
|
||||
hdrs = [
|
||||
"span.h",
|
||||
],
|
||||
deps = [
|
||||
":base",
|
||||
":inlined_vector",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -31,15 +31,16 @@ cc_library(
|
||||
"//ortools/base",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
# "//ortools/glop:lp_solver",
|
||||
"//ortools/glop",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"//ortools/glop:lp_solver",
|
||||
# "//ortools/glop",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/sat:boolean_problem",
|
||||
"//ortools/sat:boolean_problem_cc_proto",
|
||||
"//ortools/sat:clause",
|
||||
"//ortools/sat:sat_base",
|
||||
"//ortools/sat:sat_solver",
|
||||
# "//ortools/thread",
|
||||
"//ortools/base:threadpool",
|
||||
"//ortools/util:stats",
|
||||
"//ortools/util:time_limit",
|
||||
],
|
||||
@@ -88,8 +89,8 @@ cc_library(
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:stl_util",
|
||||
# "//ortools/glop:lp_solver",
|
||||
"//ortools/glop",
|
||||
"//ortools/glop:lp_solver",
|
||||
#"//ortools/glop",
|
||||
"//ortools/lp_data:lp_print_utils",
|
||||
"//ortools/sat:boolean_problem",
|
||||
"//ortools/sat:boolean_problem_cc_proto",
|
||||
@@ -120,8 +121,8 @@ cc_library(
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:stl_util",
|
||||
# "//ortools/glop:lp_solver",
|
||||
"//ortools/glop",
|
||||
"//ortools/glop:lp_solver",
|
||||
#"//ortools/glop",
|
||||
"//ortools/lp_data:lp_print_utils",
|
||||
"//ortools/sat:boolean_problem",
|
||||
"//ortools/sat:boolean_problem_cc_proto",
|
||||
@@ -197,8 +198,8 @@ cc_library(
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:statusor",
|
||||
"//ortools/base:stl_util",
|
||||
# "//ortools/glop:lp_solver",
|
||||
"//ortools/glop",
|
||||
"//ortools/glop:lp_solver",
|
||||
#"//ortools/glop",
|
||||
"//ortools/sat:boolean_problem",
|
||||
"//ortools/sat:boolean_problem_cc_proto",
|
||||
"//ortools/sat:sat_solver",
|
||||
@@ -228,14 +229,14 @@ cc_library(
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:stl_util",
|
||||
# "//ortools/glop:lp_solver",
|
||||
"//ortools/glop",
|
||||
"//ortools/glop:lp_solver",
|
||||
#"//ortools/glop",
|
||||
"//ortools/lp_data:lp_print_utils",
|
||||
"//ortools/sat:boolean_problem",
|
||||
"//ortools/sat:boolean_problem_cc_proto",
|
||||
"//ortools/sat:lp_utils",
|
||||
"//ortools/sat:sat_solver",
|
||||
# "//ortools/thread",
|
||||
"//ortools/base:threadpool",
|
||||
"//ortools/util:bitset",
|
||||
"//ortools/util:stats",
|
||||
"//ortools/util:time_limit",
|
||||
@@ -262,7 +263,7 @@ cc_library(
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/glop",
|
||||
"//ortools/glop:lp_solver",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:lp_decomposer",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
# Home of constraint solver constraint_solver
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "assignment_proto",
|
||||
@@ -10,6 +14,21 @@ cc_proto_library(
|
||||
deps = [":assignment_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "search_limit_proto",
|
||||
srcs = ["search_limit.proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "search_limit_cc_proto",
|
||||
deps = [":search_limit_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "search_limit_java_proto",
|
||||
deps = [":search_limit_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "demon_profiler_proto",
|
||||
srcs = ["demon_profiler.proto"],
|
||||
@@ -20,27 +39,6 @@ cc_proto_library(
|
||||
deps = [":demon_profiler_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "model_proto",
|
||||
srcs = ["model.proto"],
|
||||
deps = [":search_limit_proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "model_cc_proto",
|
||||
deps = [":model_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "search_limit_proto",
|
||||
srcs = ["search_limit.proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "search_limit_cc_proto",
|
||||
deps = [":search_limit_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "solver_parameters_proto",
|
||||
srcs = ["solver_parameters.proto"],
|
||||
@@ -51,14 +49,39 @@ cc_proto_library(
|
||||
deps = ["solver_parameters_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "solver_parameters_java_proto",
|
||||
deps = [":solver_parameters_proto"],
|
||||
)
|
||||
|
||||
#py_proto_library(
|
||||
# name = "assignment_py_pb2",
|
||||
# deps = [":assignment_proto"],
|
||||
#)
|
||||
|
||||
#py_proto_library(
|
||||
# name = "search_limit_py_pb2",
|
||||
# deps = [":search_limit_proto"],
|
||||
#)
|
||||
|
||||
#py_proto_library(
|
||||
# name = "demon_profiler_py_pb2",
|
||||
# deps = [":demon_profiler_proto"],
|
||||
#)
|
||||
|
||||
#py_proto_library(
|
||||
# name = "solver_parameters_py_pb2",
|
||||
# deps = [":solver_parameters_proto"],
|
||||
#)
|
||||
|
||||
# ----- Constraint Programming core engine -----
|
||||
|
||||
# This is the main library.
|
||||
cc_library(
|
||||
name = "cp",
|
||||
srcs = [
|
||||
"ac4_mdd_reset_table.cc",
|
||||
"ac4r_table.cc",
|
||||
"alldiff_cst.cc",
|
||||
"assignment.cc",
|
||||
"collect_variables.cc",
|
||||
"constraint_solver.cc",
|
||||
"constraints.cc",
|
||||
"count_cst.cc",
|
||||
@@ -70,17 +93,13 @@ cc_library(
|
||||
"expr_array.cc",
|
||||
"expr_cst.cc",
|
||||
"expressions.cc",
|
||||
"gcc.cc",
|
||||
"graph_constraints.cc",
|
||||
"interval.cc",
|
||||
"io.cc",
|
||||
"local_search.cc",
|
||||
"model_cache.cc",
|
||||
"nogoods.cc",
|
||||
"pack.cc",
|
||||
"range_cst.cc",
|
||||
"resource.cc",
|
||||
"sat_constraint.cc",
|
||||
"sched_constraints.cc",
|
||||
"sched_expr.cc",
|
||||
"sched_search.cc",
|
||||
@@ -88,46 +107,43 @@ cc_library(
|
||||
"table.cc",
|
||||
"timetabling.cc",
|
||||
"trace.cc",
|
||||
"tree_monitor.cc",
|
||||
"utilities.cc",
|
||||
"visitor.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"constraint_solver.h",
|
||||
"constraint_solveri.h",
|
||||
"sat_constraint.h",
|
||||
],
|
||||
copts = [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-deprecated",
|
||||
],
|
||||
linkopts = ["-lz"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":assignment_cc_proto",
|
||||
":demon_profiler_cc_proto",
|
||||
":model_cc_proto",
|
||||
":search_limit_cc_proto",
|
||||
":solver_parameters_cc_proto",
|
||||
"//ortools/base",
|
||||
"//ortools/base:callback",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:recordio",
|
||||
"//ortools/base:sysinfo",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/time",
|
||||
# "//third_party/zlib:zlibonly",
|
||||
"//ortools/base:bitmap",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:mathutil",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:recordio",
|
||||
"//ortools/base:small_map",
|
||||
"//ortools/base:status",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:strings",
|
||||
# "//ortools/base:strings:human_readable",
|
||||
# "//util/gzip:gzipstring",
|
||||
"//ortools/base:hash",
|
||||
# "//util/hash:jenkins",
|
||||
# "//util/math:fastmath",
|
||||
"//ortools/base:mathutil",
|
||||
"//ortools/graph:hamiltonian_path",
|
||||
"//ortools/sat:sat_solver",
|
||||
"//ortools/util:bitset",
|
||||
"//ortools/util:cached_log",
|
||||
"//ortools/util:iterators",
|
||||
"//ortools/util:monoid_operation_tree",
|
||||
"//ortools/util:piecewise_linear_function",
|
||||
"//ortools/util:range_minimum_query",
|
||||
@@ -136,30 +152,31 @@ cc_library(
|
||||
"//ortools/util:string_array",
|
||||
"//ortools/util:tuple_set",
|
||||
"//ortools/util:vector_map",
|
||||
"//ortools/util:xml_helper",
|
||||
"//ortools/base:bitmap",
|
||||
# "//ortools/util/regexp/re2",
|
||||
# "//ortools/util/textprogressbar",
|
||||
# "//ortools/util/time:clock",
|
||||
# "//ortools/util/time:datetime",
|
||||
"//ortools/base:random",
|
||||
# "//util/regexp/re2",
|
||||
"//ortools/base:status",
|
||||
# "//util/textprogressbar",
|
||||
"//ortools/base:timer",
|
||||
# "//util/zippy",
|
||||
],
|
||||
)
|
||||
|
||||
# Routing
|
||||
|
||||
cc_proto_library(
|
||||
name = "routing_enums_cc_proto",
|
||||
deps = ["routing_enums_proto"],
|
||||
)
|
||||
# ----- Routing and ArcRouting -----
|
||||
|
||||
proto_library(
|
||||
name = "routing_enums_proto",
|
||||
srcs = ["routing_enums.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "routing_parameters_cc_proto",
|
||||
deps = ["routing_parameters_proto"],
|
||||
name = "routing_enums_cc_proto",
|
||||
deps = [":routing_enums_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "routing_enums_java_proto",
|
||||
deps = [":routing_enums_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
@@ -168,6 +185,43 @@ proto_library(
|
||||
deps = [
|
||||
":routing_enums_proto",
|
||||
":solver_parameters_proto",
|
||||
"@com_google_protobuf_cc//:duration_proto",
|
||||
"//ortools/util:optional_boolean_proto",
|
||||
],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "routing_parameters_cc_proto",
|
||||
deps = [":routing_parameters_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "routing_parameters_java_proto",
|
||||
deps = [":routing_parameters_proto"],
|
||||
)
|
||||
|
||||
#py_proto_library(
|
||||
# name = "routing_parameters_py_pb2",
|
||||
# deps = [":routing_parameters_proto"],
|
||||
#)
|
||||
|
||||
cc_library(
|
||||
name = "routing_parameters",
|
||||
srcs = ["routing_parameters.cc"],
|
||||
hdrs = ["routing_parameters.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":cp",
|
||||
":routing_enums_cc_proto",
|
||||
":routing_parameters_cc_proto",
|
||||
":solver_parameters_cc_proto",
|
||||
"//ortools/base",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/time",
|
||||
"//ortools/util:optional_boolean_cc_proto",
|
||||
"//ortools/base:statusor",
|
||||
"//ortools/base:protoutil",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -177,25 +231,25 @@ cc_library(
|
||||
"routing_flags.cc",
|
||||
],
|
||||
hdrs = ["routing_flags.h"],
|
||||
copts = [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-deprecated",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":cp",
|
||||
":routing_enums_cc_proto",
|
||||
":routing_parameters",
|
||||
":routing_parameters_cc_proto",
|
||||
"//ortools/base",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
"@com_google_absl//absl/time",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/util:optional_boolean_cc_proto",
|
||||
"//ortools/base:protoutil",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "routing_types",
|
||||
hdrs = ["routing_types.h"],
|
||||
copts = [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-deprecated",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:int_type",
|
||||
@@ -206,50 +260,79 @@ cc_library(
|
||||
name = "routing_neighborhoods",
|
||||
srcs = ["routing_neighborhoods.cc"],
|
||||
hdrs = ["routing_neighborhoods.h"],
|
||||
copts = [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-deprecated",
|
||||
],
|
||||
deps = [
|
||||
":cp",
|
||||
":routing_types",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "routing_index_manager",
|
||||
srcs = ["routing_index_manager.cc"],
|
||||
hdrs = ["routing_index_manager.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":routing_types",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:map_util",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "routing",
|
||||
srcs = [
|
||||
"routing.cc",
|
||||
"routing_flow.cc",
|
||||
"routing_lp_scheduling.cc",
|
||||
"routing_search.cc",
|
||||
],
|
||||
hdrs = ["routing.h"],
|
||||
copts = [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-deprecated",
|
||||
hdrs = [
|
||||
"routing.h",
|
||||
"routing_lp_scheduling.h",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":model_cc_proto",
|
||||
":cp",
|
||||
":routing_enums_cc_proto",
|
||||
":routing_index_manager",
|
||||
":routing_neighborhoods",
|
||||
":routing_parameters",
|
||||
":routing_parameters_cc_proto",
|
||||
":routing_types",
|
||||
"//ortools/base",
|
||||
"//ortools/base:adjustable_priority_queue",
|
||||
"//ortools/base:hash",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/hash",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/time",
|
||||
# "//third_party/kdtree",
|
||||
"//ortools/graph",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:small_map",
|
||||
"//ortools/base:small_ordered_set",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/constraint_solver:cp",
|
||||
"//ortools/graph",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:murmur",
|
||||
"//ortools/glop:lp_solver",
|
||||
"//ortools/graph:christofides",
|
||||
"//ortools/graph:connectivity",
|
||||
"//ortools/graph:linear_assignment",
|
||||
"//ortools/graph:min_cost_flow",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/sat:theta_tree",
|
||||
"//ortools/util:bitset",
|
||||
"//ortools/util:optional_boolean_cc_proto",
|
||||
"//ortools/util:range_query_function",
|
||||
"//ortools/util:saturated_arithmetic",
|
||||
"//ortools/util:sorted_interval_list",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
"//ortools/base:adjustable_priority_queue",
|
||||
"//ortools/base:protoutil",
|
||||
],
|
||||
)
|
||||
|
||||
51
ortools/data/BUILD
Normal file
51
ortools/data/BUILD
Normal file
@@ -0,0 +1,51 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
proto_library(
|
||||
name = "jobshop_scheduling_proto",
|
||||
srcs = ["jobshop_scheduling.proto"],
|
||||
deps = [
|
||||
"@com_google_protobuf//:wrappers_proto",
|
||||
],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "jobshop_scheduling_cc_proto",
|
||||
deps = [":jobshop_scheduling_proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "jobshop_scheduling_parser",
|
||||
srcs = ["jobshop_scheduling_parser.cc"],
|
||||
hdrs = ["jobshop_scheduling_parser.h"],
|
||||
deps = [
|
||||
":jobshop_scheduling_cc_proto",
|
||||
"//ortools/base",
|
||||
"//ortools/base:filelineiter",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_protobuf//:protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "rcpsp_proto",
|
||||
srcs = ["rcpsp.proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "rcpsp_cc_proto",
|
||||
deps = [":rcpsp_proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "rcpsp_parser",
|
||||
srcs = ["rcpsp_parser.cc"],
|
||||
hdrs = ["rcpsp_parser.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":rcpsp_cc_proto",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:filelineiter",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "absl/strings/numbers.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "google/protobuf/wrappers.pb.h"
|
||||
#include "ortools/base/commandlineflags.h"
|
||||
#include "ortools/base/filelineiter.h"
|
||||
#include "ortools/base/integral_types.h"
|
||||
#include "ortools/base/logging.h"
|
||||
|
||||
@@ -19,22 +19,15 @@ cc_library(
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/util:iterators",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"//ortools/graph:iterators",
|
||||
"//ortools/util:string_array",
|
||||
],
|
||||
)
|
||||
|
||||
#cc_test(
|
||||
# name = "model_test",
|
||||
# size = "small",
|
||||
# srcs = ["model_test.cc"],
|
||||
# deps = [
|
||||
# ":model",
|
||||
# "//@gtest//:main",
|
||||
# ],
|
||||
#)
|
||||
|
||||
cc_library(
|
||||
name = "parser_yacc_lib",
|
||||
srcs = ["parser.tab.cc"],
|
||||
@@ -44,15 +37,15 @@ cc_library(
|
||||
"parser_util.h",
|
||||
],
|
||||
copts = [
|
||||
# "-Xclang-only=-Wno-implicit-fallthrough",
|
||||
"$(STACK_FRAME_UNLIMITED)", # parser.tab.cc
|
||||
],
|
||||
deps = [
|
||||
":model",
|
||||
"//ortools/base",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:mathutil",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/util:string_array",
|
||||
],
|
||||
)
|
||||
@@ -61,12 +54,13 @@ cc_library(
|
||||
name = "parser_lex_lib",
|
||||
srcs = ["parser.yy.cc"],
|
||||
copts = [
|
||||
# "-Xclang-only=-Wno-implicit-fallthrough",
|
||||
"-Wno-unused-function", # parser.yy.cc
|
||||
],
|
||||
deps = [
|
||||
":parser_yacc_lib",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -81,24 +75,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
#cc_test(
|
||||
# name = "parser_test",
|
||||
# size = "small",
|
||||
# srcs = ["parser_test.cc"],
|
||||
# data = [
|
||||
# "testdata/M12.fzn",
|
||||
# "testdata/alpha.fzn",
|
||||
# "testdata/golomb.fzn",
|
||||
# ],
|
||||
# deps = [
|
||||
# ":model",
|
||||
# ":parser_lib",
|
||||
# "//@gtest//:main",
|
||||
# "//ortools/base:file",
|
||||
# "//ortools/base:file:path",
|
||||
# ],
|
||||
#)
|
||||
|
||||
cc_library(
|
||||
name = "presolve",
|
||||
srcs = ["presolve.cc"],
|
||||
@@ -109,26 +85,13 @@ cc_library(
|
||||
"//ortools/base",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/graph:cliques",
|
||||
"//ortools/util:saturated_arithmetic",
|
||||
"//ortools/util:vector_map",
|
||||
],
|
||||
)
|
||||
|
||||
#cc_test(
|
||||
# name = "presolve_test",
|
||||
# size = "small",
|
||||
# srcs = ["presolve_test.cc"],
|
||||
# deps = [
|
||||
# ":model",
|
||||
# ":presolve",
|
||||
# "//@gtest//:main",
|
||||
# "//ortools/base:file",
|
||||
# "//ortools/base:file:path",
|
||||
# ],
|
||||
#)
|
||||
|
||||
cc_library(
|
||||
name = "checker",
|
||||
srcs = ["checker.cc"],
|
||||
@@ -139,7 +102,8 @@ cc_library(
|
||||
"//ortools/base",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -182,7 +146,7 @@ cc_library(
|
||||
deps = [
|
||||
":logging",
|
||||
"//ortools/base",
|
||||
"//ortools/base:mutex",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"//ortools/constraint_solver:cp",
|
||||
],
|
||||
)
|
||||
@@ -269,8 +233,9 @@ cc_library(
|
||||
":model",
|
||||
":solver",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/base:map_util",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base:threadpool",
|
||||
"//ortools/sat:cp_constraints",
|
||||
"//ortools/sat:cp_model_cc_proto",
|
||||
"//ortools/sat:cp_model_solver",
|
||||
@@ -284,8 +249,10 @@ cc_library(
|
||||
"//ortools/sat:optimization",
|
||||
"//ortools/sat:sat_solver",
|
||||
"//ortools/sat:table",
|
||||
"//ortools/util:sigint",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "fz",
|
||||
srcs = ["fz.cc"],
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "ortools/flatzinc/model.h"
|
||||
#include "ortools/flatzinc/parser.h"
|
||||
#include "ortools/flatzinc/presolve.h"
|
||||
#include "ortools/flatzinc/reporting.h"
|
||||
//#include "ortools/flatzinc/reporting.h"
|
||||
|
||||
DEFINE_int32(time_limit, 0, "time limit in ms.");
|
||||
DEFINE_bool(all_solutions, false, "Search for all solutions.");
|
||||
|
||||
@@ -1,4 +1,176 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Floating-point code in this directory must not be compiled with
|
||||
# dangerous optimizations. For example do not assume that FP expressions
|
||||
# are associative. This is what -fno-fast-math is for.
|
||||
SAFE_FP_CODE = ["-fno-fast-math"]
|
||||
|
||||
# Revised Simplex LP solver.
|
||||
|
||||
cc_library(
|
||||
name = "revised_simplex",
|
||||
srcs = ["revised_simplex.cc"],
|
||||
hdrs = ["revised_simplex.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":dual_edge_norms",
|
||||
":entering_variable",
|
||||
":initial_basis",
|
||||
":parameters_cc_proto",
|
||||
":primal_edge_norms",
|
||||
":reduced_costs",
|
||||
":status",
|
||||
":update_row",
|
||||
":variable_values",
|
||||
":variables_info",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_print_utils",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:matrix_utils",
|
||||
"//ortools/lp_data:sparse_row",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:random_engine",
|
||||
"//ortools/util:time_limit",
|
||||
],
|
||||
)
|
||||
|
||||
# Update row.
|
||||
|
||||
cc_library(
|
||||
name = "update_row",
|
||||
srcs = ["update_row.cc"],
|
||||
hdrs = ["update_row.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":parameters_cc_proto",
|
||||
":variables_info",
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
# Variables info.
|
||||
|
||||
cc_library(
|
||||
name = "variables_info",
|
||||
srcs = ["variables_info.cc"],
|
||||
hdrs = ["variables_info.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:sparse",
|
||||
],
|
||||
)
|
||||
|
||||
# LU factorization of sparse matrices.
|
||||
|
||||
cc_library(
|
||||
name = "lu_factorization",
|
||||
srcs = ["lu_factorization.cc"],
|
||||
hdrs = ["lu_factorization.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":markowitz",
|
||||
":parameters_cc_proto",
|
||||
":status",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:sparse",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "markowitz",
|
||||
srcs = ["markowitz.cc"],
|
||||
hdrs = ["markowitz.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":parameters_cc_proto",
|
||||
":status",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:sparse",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
# Basis representations (Eta and LU).
|
||||
|
||||
cc_library(
|
||||
name = "basis_representation",
|
||||
srcs = ["basis_representation.cc"],
|
||||
hdrs = ["basis_representation.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":lu_factorization",
|
||||
":parameters_cc_proto",
|
||||
":rank_one_update",
|
||||
":status",
|
||||
"//ortools/base",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:sparse",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "rank_one_update",
|
||||
hdrs = ["rank_one_update.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":status",
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:sparse",
|
||||
],
|
||||
)
|
||||
|
||||
# Initial basis.
|
||||
|
||||
cc_library(
|
||||
name = "initial_basis",
|
||||
srcs = ["initial_basis.cc"],
|
||||
hdrs = ["initial_basis.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":markowitz",
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:sparse",
|
||||
],
|
||||
)
|
||||
|
||||
# Function status.
|
||||
|
||||
cc_library(
|
||||
name = "status",
|
||||
srcs = ["status.cc"],
|
||||
hdrs = ["status.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
],
|
||||
)
|
||||
|
||||
# Glop parameters.
|
||||
|
||||
cc_proto_library(
|
||||
name = "parameters_cc_proto",
|
||||
@@ -10,75 +182,152 @@ proto_library(
|
||||
srcs = ["parameters.proto"],
|
||||
)
|
||||
|
||||
SAFE_FP_CODE = ["-fno-fast-math"]
|
||||
# Dual edge norms.
|
||||
|
||||
# GLOP library with minimal external dependencies for easier use on
|
||||
# portable targets (e.g., Android, iOS).
|
||||
# We define a separate target to:
|
||||
# * Avoid select(), which doesn't work with blaze query
|
||||
# * Define ANDROID_JNI, which is necessary for portable build
|
||||
cc_library(
|
||||
name = "glop",
|
||||
srcs = [
|
||||
"basis_representation.cc",
|
||||
"dual_edge_norms.cc",
|
||||
"entering_variable.cc",
|
||||
"initial_basis.cc",
|
||||
"lp_solver.cc",
|
||||
"lu_factorization.cc",
|
||||
"markowitz.cc",
|
||||
"preprocessor.cc",
|
||||
"primal_edge_norms.cc",
|
||||
"reduced_costs.cc",
|
||||
"revised_simplex.cc",
|
||||
"status.cc",
|
||||
"update_row.cc",
|
||||
"variable_values.cc",
|
||||
"variables_info.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"basis_representation.h",
|
||||
"dual_edge_norms.h",
|
||||
"entering_variable.h",
|
||||
"initial_basis.h",
|
||||
"lp_solver.h",
|
||||
"lu_factorization.h",
|
||||
"markowitz.h",
|
||||
"preprocessor.h",
|
||||
"primal_edge_norms.h",
|
||||
"rank_one_update.h",
|
||||
"reduced_costs.h",
|
||||
"revised_simplex.h",
|
||||
"status.h",
|
||||
"update_row.h",
|
||||
"variable_values.h",
|
||||
"variables_info.h",
|
||||
],
|
||||
name = "dual_edge_norms",
|
||||
srcs = ["dual_edge_norms.cc"],
|
||||
hdrs = ["dual_edge_norms.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":parameters_cc_proto",
|
||||
"//ortools/base",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:random",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/linear_solver:linear_solver_cc_proto",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_print_utils",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
# Primal edge norms.
|
||||
|
||||
cc_library(
|
||||
name = "primal_edge_norms",
|
||||
srcs = ["primal_edge_norms.cc"],
|
||||
hdrs = ["primal_edge_norms.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":parameters_cc_proto",
|
||||
":update_row",
|
||||
":variables_info",
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "reduced_costs",
|
||||
srcs = ["reduced_costs.cc"],
|
||||
hdrs = ["reduced_costs.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":parameters_cc_proto",
|
||||
":primal_edge_norms",
|
||||
":status",
|
||||
":update_row",
|
||||
":variables_info",
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/util:random_engine",
|
||||
"//ortools/util:stats",
|
||||
"//ortools/base:random",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "variable_values",
|
||||
srcs = ["variable_values.cc"],
|
||||
hdrs = ["variable_values.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":variables_info",
|
||||
"//ortools/base",
|
||||
"//ortools/graph:iterators",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
# Primal pricing rules.
|
||||
|
||||
cc_library(
|
||||
name = "entering_variable",
|
||||
srcs = ["entering_variable.cc"],
|
||||
hdrs = ["entering_variable.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":basis_representation",
|
||||
":parameters_cc_proto",
|
||||
":primal_edge_norms",
|
||||
":reduced_costs",
|
||||
":status",
|
||||
":update_row",
|
||||
":variables_info",
|
||||
"//ortools/base",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/port:proto_utils",
|
||||
"//ortools/util:bitset",
|
||||
"//ortools/base:random",
|
||||
"//ortools/util:random_engine",
|
||||
"//ortools/util:stats",
|
||||
],
|
||||
)
|
||||
|
||||
# Preprocessor.
|
||||
|
||||
cc_library(
|
||||
name = "preprocessor",
|
||||
srcs = ["preprocessor.cc"],
|
||||
hdrs = ["preprocessor.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":parameters_cc_proto",
|
||||
":revised_simplex",
|
||||
":status",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_data_utils",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:matrix_scaler",
|
||||
"//ortools/lp_data:matrix_utils",
|
||||
"//ortools/lp_data:proto_utils",
|
||||
"//ortools/lp_data:sparse",
|
||||
"//ortools/lp_data:sparse_row",
|
||||
"//ortools/util:bitset",
|
||||
"//ortools/util:file_util",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:iterators",
|
||||
"//ortools/util:random_engine",
|
||||
"//ortools/util:stats",
|
||||
"//ortools/util:time_limit",
|
||||
],
|
||||
)
|
||||
|
||||
# LP Solver.
|
||||
|
||||
cc_library(
|
||||
name = "lp_solver",
|
||||
srcs = ["lp_solver.cc"],
|
||||
hdrs = ["lp_solver.h"],
|
||||
copts = SAFE_FP_CODE,
|
||||
deps = [
|
||||
":parameters_cc_proto",
|
||||
":preprocessor",
|
||||
":status",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/strings:strings",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/lp_data:base",
|
||||
"//ortools/lp_data:lp_utils",
|
||||
"//ortools/lp_data:proto_utils",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:time_limit",
|
||||
"//ortools/util:file_util",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ cc_library(
|
||||
name = "graph",
|
||||
hdrs = ["graph.h"],
|
||||
deps = [
|
||||
":iterators",
|
||||
"//ortools/base",
|
||||
"//ortools/util:iterators",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -23,21 +23,27 @@ cc_library(
|
||||
srcs = ["util.cc"],
|
||||
hdrs = ["util.h"],
|
||||
deps = [
|
||||
":connected_components",
|
||||
":graph",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:map_util",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "iterators",
|
||||
hdrs = ["iterators.h"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "io",
|
||||
hdrs = ["io.h"],
|
||||
deps = [
|
||||
":graph",
|
||||
"//ortools/base:filelineiter",
|
||||
"//ortools/base:status",
|
||||
"//ortools/base:statusor",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/util:filelineiter",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -81,7 +87,9 @@ cc_library(
|
||||
# "//ortools/base:int_type_indexed_bitmap",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:recordio",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings",
|
||||
# "//ortools/thread",
|
||||
# "//ortools/util/coding:prefixvarint",
|
||||
],
|
||||
@@ -112,7 +120,7 @@ cc_library(
|
||||
# deps = [
|
||||
# "//ortools/base",
|
||||
# "//ortools/base:iterator_adaptors",
|
||||
# "//ortools/base:strings",
|
||||
# "@com_google_absl//absl/strings",
|
||||
# "//ortools/thread",
|
||||
# ],
|
||||
#)
|
||||
@@ -126,7 +134,8 @@ cc_library(
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/util:time_limit",
|
||||
],
|
||||
)
|
||||
@@ -181,7 +190,7 @@ cc_library(
|
||||
":christofides",
|
||||
":minimum_spanning_tree",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -196,7 +205,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
#cc_library(
|
||||
# name = "shortest_paths",
|
||||
# srcs = ["shortest_paths.cc"],
|
||||
@@ -242,6 +250,7 @@ cc_library(
|
||||
":graph",
|
||||
":graphs",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/memory",
|
||||
"//ortools/util:stats",
|
||||
"//ortools/util:zvector",
|
||||
],
|
||||
@@ -282,13 +291,40 @@ cc_library(
|
||||
deps = [
|
||||
":ebert_graph",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
# "//ortools/testing/production_stub/public:gunit_prod",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/util:permutation",
|
||||
"//ortools/util:zvector",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "connected_components",
|
||||
srcs = [
|
||||
"connected_components.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"connected_components.h",
|
||||
],
|
||||
deps = [
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"//ortools/base",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:ptr_util",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "strongly_connected_components",
|
||||
hdrs = [
|
||||
"strongly_connected_components.h",
|
||||
],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
],
|
||||
)
|
||||
|
||||
#cc_library(
|
||||
# name = "biconnected",
|
||||
# srcs = ["biconnected.cc"],
|
||||
|
||||
@@ -1,15 +1,39 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# If you want to use the GLPK solver, build with '--define USE_GLPK=' (or add
|
||||
# it to your bazel.rc file). This will download, build and link to GLPK.
|
||||
config_setting(
|
||||
name = "with_glpk",
|
||||
values = { "define": "USE_GLPK=" }
|
||||
values = {"define": "USE_GLPK="},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "with_bop",
|
||||
values = {"define": "USE_BOP="},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "with_cplex",
|
||||
values = {"define": "USE_CPLEX="},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "with_cbc",
|
||||
values = {"define": "USE_CBC="},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "with_clp",
|
||||
values = {"define": "USE_CLP="},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "with_gurobi",
|
||||
values = {"define": "USE_GUROBI="},
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "linear_solver_proto",
|
||||
srcs = ["linear_solver.proto"],
|
||||
deps = ["//ortools/util:optional_boolean_proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
@@ -17,55 +41,86 @@ cc_proto_library(
|
||||
deps = [":linear_solver_proto"],
|
||||
)
|
||||
|
||||
# You can include the interfaces to different solvers by invoking '--define'
|
||||
# flags. By default only GLOP interface is included.
|
||||
#
|
||||
# For instance, if you want to use the GLPK solver, build with
|
||||
# '--define USE_GLPK=' (or add it to your bazel.rc file). This will download,
|
||||
# build and link to GLPK.
|
||||
#
|
||||
# Currently compiling with '--define USE_BOP=' flag is broken due to the
|
||||
# circular dependency:
|
||||
# .-> //ortools/linear_solver:linear_solver
|
||||
# | //ortools/bop:integral_solver
|
||||
# | //ortools/bop:bop_solver
|
||||
# | //ortools/bop:complete_optimizer
|
||||
# | //ortools/sat:optimization
|
||||
# `-- //ortools/linear_solver:linear_solver
|
||||
|
||||
cc_library(
|
||||
name = "linear_solver",
|
||||
srcs = [
|
||||
"bop_interface.cc",
|
||||
"glop_interface.cc",
|
||||
"glop_utils.cc",
|
||||
"linear_expr.cc",
|
||||
"linear_solver.cc",
|
||||
"model_exporter.cc",
|
||||
"model_validator.cc",
|
||||
] + select({
|
||||
"glop_interface.cc",
|
||||
"glop_utils.cc",
|
||||
] + select({
|
||||
":with_bop": ["bop_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":with_cbc": ["cbc_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":with_clp": ["clp_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":with_cplex": ["cplex_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":with_glpk": ["glpk_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":with_gurobi": ["gurobi_interface.cc"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
hdrs = [
|
||||
"glop_interface.cc",
|
||||
"glop_utils.h",
|
||||
"linear_expr.h",
|
||||
"linear_solver.h",
|
||||
"model_exporter.h",
|
||||
"model_validator.h",
|
||||
],
|
||||
copts = [
|
||||
"-DUSE_GLOP",
|
||||
"-DUSE_BOP",
|
||||
],
|
||||
defines = [
|
||||
"HAVE_CONFIG_H"
|
||||
] + select({
|
||||
":with_glpk": ["USE_GLPK"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
"USE_GLOP=",
|
||||
],
|
||||
deps = [
|
||||
":linear_solver_cc_proto",
|
||||
"//ortools/base:timer",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:accurate_sum",
|
||||
"//ortools/base:canonical_errors",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:map_util",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"@com_google_absl//absl/types:optional",
|
||||
"//ortools/base:status",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:random",
|
||||
"//ortools/bop:bop_parameters_cc_proto",
|
||||
"//ortools/bop:integral_solver",
|
||||
"//ortools/glop",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base:timer",
|
||||
"//ortools/glop:lp_solver",
|
||||
"//ortools/glop:parameters_cc_proto",
|
||||
"//ortools/lp_data",
|
||||
"//ortools/port:file",
|
||||
"//ortools/port:proto_utils",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:proto_tools",
|
||||
] + select({
|
||||
":with_bop": [
|
||||
"//ortools/bop:bop_parameters_cc_proto",
|
||||
"//ortools/bop:integral_solver",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":with_glpk": ["@glpk//:glpk"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
|
||||
@@ -41,8 +41,9 @@ cc_library(
|
||||
":base",
|
||||
":permutation",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/util:iterators",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/graph:iterators",
|
||||
"//ortools/util:return_macros",
|
||||
],
|
||||
)
|
||||
@@ -56,6 +57,7 @@ cc_library(
|
||||
":base",
|
||||
":sparse_vector",
|
||||
"//ortools/base",
|
||||
"//ortools/base:random",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -86,7 +88,8 @@ cc_library(
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:strings",
|
||||
"//ortools/base:random",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/util:fp_utils",
|
||||
"//ortools/util:return_macros",
|
||||
],
|
||||
@@ -104,6 +107,9 @@ cc_library(
|
||||
"//ortools/base",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/glop:parameters_cc_proto",
|
||||
"//ortools/glop:revised_simplex",
|
||||
"//ortools/glop:status",
|
||||
"//ortools/util:fp_utils",
|
||||
],
|
||||
)
|
||||
@@ -127,7 +133,6 @@ cc_library(
|
||||
":base",
|
||||
":lp_print_utils",
|
||||
":lp_utils",
|
||||
":matrix_scaler",
|
||||
":matrix_utils",
|
||||
":permutation",
|
||||
":sparse",
|
||||
@@ -135,11 +140,26 @@ cc_library(
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/glop:parameters_cc_proto",
|
||||
"//ortools/util:fp_utils",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "lp_data_utils",
|
||||
srcs = ["lp_data_utils.cc"],
|
||||
hdrs = ["lp_data_utils.h"],
|
||||
deps = [
|
||||
":base",
|
||||
":lp_data",
|
||||
":matrix_scaler",
|
||||
"//ortools/glop:parameters_cc_proto",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "lp_utils",
|
||||
srcs = ["lp_utils.cc"],
|
||||
@@ -176,7 +196,7 @@ cc_library(
|
||||
# ":base",
|
||||
# ":lp_data",
|
||||
# "//ortools/base",
|
||||
# "//ortools/base:strings",
|
||||
# "@com_google_absl//absl/strings",
|
||||
# "//ortools/util/regexp/re2",
|
||||
# ],
|
||||
#)
|
||||
@@ -200,7 +220,8 @@ cc_library(
|
||||
deps = [
|
||||
":base",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/util:rational_approximation",
|
||||
],
|
||||
)
|
||||
@@ -229,17 +250,13 @@ cc_library(
|
||||
":lp_print_utils",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
# "//ortools/base:file:path",
|
||||
"//ortools/base:filelinereader",
|
||||
"//ortools/base:filelineiter",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:int_type",
|
||||
"//ortools/base:int_type_indexed_vector",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:status",
|
||||
"//ortools/base:strings",
|
||||
# "//ortools/file/localfile",
|
||||
# "//ortools/file/memfile",
|
||||
# "//ortools/file/zipfile",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -271,6 +288,7 @@ cc_library(
|
||||
"//ortools/algorithms:dynamic_partition",
|
||||
"//ortools/base",
|
||||
"//ortools/base:hash",
|
||||
"//ortools/base:mutex",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"//ortools/glop:parameters_cc_proto",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -18,3 +18,30 @@ cc_library(
|
||||
"//ortools/base:sysinfo",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "file",
|
||||
srcs = [
|
||||
"file_nonport.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"file.h",
|
||||
],
|
||||
deps = [
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:status",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "proto_utils",
|
||||
hdrs = [
|
||||
"proto_utils.h",
|
||||
],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_protobuf_cc//:protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -387,7 +387,7 @@ void PresolveContext::FullyEncodeVariable(int var) {
|
||||
for (int64 v = interval.start; v <= interval.end; ++v) {
|
||||
const int lit = NewBoolVar();
|
||||
AddImplyInDomain(lit, var, Domain(v));
|
||||
AddImplyInDomain(NegatedRef(lit), var, Domain(v).Complement());
|
||||
// AddImplyInDomain(NegatedRef(lit), var, Domain(v).Complement());
|
||||
expanded_variables[var][v] = lit;
|
||||
}
|
||||
}
|
||||
@@ -2326,12 +2326,14 @@ bool PresolveAutomaton(ConstraintProto* ct, PresolveContext* context) {
|
||||
context->UpdateRuleStats("automaton: reduce variable domains");
|
||||
}
|
||||
|
||||
const int true_literal = context->GetOrCreateConstantVar(1);
|
||||
|
||||
// Encode reachable states for each time point.
|
||||
std::vector<absl::flat_hash_map<int64, int>> state_literals(n + 1);
|
||||
for (int time = 0; time < n; ++time) {
|
||||
if (reachable_states[time].size() == 1) {
|
||||
const int64 state = *reachable_states[time].begin();
|
||||
state_literals[time][state] = context->GetOrCreateConstantVar(1);
|
||||
state_literals[time][state] = true_literal;
|
||||
} else if (reachable_states[time].size() == 2) {
|
||||
const int lit = context->NewBoolVar();
|
||||
auto it = reachable_states[time].begin();
|
||||
@@ -2345,6 +2347,7 @@ bool PresolveAutomaton(ConstraintProto* ct, PresolveContext* context) {
|
||||
context->working_model->add_constraints()->mutable_bool_or();
|
||||
BoolArgumentProto* const at_most_one =
|
||||
context->working_model->add_constraints()->mutable_at_most_one();
|
||||
|
||||
for (const int64 state : reachable_states[time]) {
|
||||
const int lit = context->NewBoolVar();
|
||||
state_literals[time][state] = lit;
|
||||
@@ -2360,20 +2363,12 @@ bool PresolveAutomaton(ConstraintProto* ct, PresolveContext* context) {
|
||||
}
|
||||
|
||||
// Encode each transition.
|
||||
for (int time = 0; time + 1 < n; ++time) {
|
||||
absl::flat_hash_map<int, int> num_incident_arcs;
|
||||
for (int t = 0; t < proto.transition_tail_size(); ++t) {
|
||||
const int64 tail = proto.transition_tail(t);
|
||||
const int64 label = proto.transition_label(t);
|
||||
const int64 head = proto.transition_head(t);
|
||||
|
||||
if (!gtl::ContainsKey(reachable_states[time], tail)) continue;
|
||||
if (!context->DomainContains(vars[time], label)) continue;
|
||||
if (!gtl::ContainsKey(reachable_states[time + 1], head)) continue;
|
||||
num_incident_arcs[head]++;
|
||||
}
|
||||
|
||||
absl::flat_hash_map<int, std::vector<int>> heads_per_state_lit;
|
||||
for (int time = 0; time < n; ++time) {
|
||||
BoolArgumentProto* const bool_or =
|
||||
context->working_model->add_constraints()->mutable_bool_or();
|
||||
BoolArgumentProto* const at_most_one =
|
||||
context->working_model->add_constraints()->mutable_at_most_one();
|
||||
|
||||
for (int t = 0; t < proto.transition_tail_size(); ++t) {
|
||||
const int64 tail = proto.transition_tail(t);
|
||||
const int64 label = proto.transition_label(t);
|
||||
@@ -2383,52 +2378,21 @@ bool PresolveAutomaton(ConstraintProto* ct, PresolveContext* context) {
|
||||
if (!context->DomainContains(vars[time], label)) continue;
|
||||
if (!gtl::ContainsKey(reachable_states[time + 1], head)) continue;
|
||||
|
||||
const int next_lit = state_literals[time + 1][head];
|
||||
CHECK(gtl::ContainsKey(state_literals[time], tail));
|
||||
if (time != n - 1) {
|
||||
CHECK(gtl::ContainsKey(state_literals[time + 1], head));
|
||||
}
|
||||
const int tail_lit = state_literals[time][tail];
|
||||
const int label_lit = context->expanded_variables[vars[time]][label];
|
||||
const bool unique = num_incident_arcs[head] == 1;
|
||||
const int head_lit = unique ? next_lit : context->NewBoolVar();
|
||||
if (!unique) {
|
||||
heads_per_state_lit[next_lit].push_back(head_lit);
|
||||
}
|
||||
const int head_lit =
|
||||
time == n - 1 ? true_literal : state_literals[time + 1][head];
|
||||
const int transition_lit = context->NewBoolVar();
|
||||
|
||||
context->AddImplication({tail_lit, label_lit}, head_lit);
|
||||
context->AddImplication(head_lit, {tail_lit, label_lit});
|
||||
}
|
||||
context->AddImplication(transition_lit, {tail_lit, label_lit, head_lit});
|
||||
context->AddImplication({tail_lit, label_lit, head_lit}, transition_lit);
|
||||
|
||||
for (const auto& it : heads_per_state_lit) {
|
||||
BoolArgumentProto* const bool_or =
|
||||
context->working_model->add_constraints()->mutable_bool_or();
|
||||
bool_or->add_literals(NegatedRef(it.first));
|
||||
for (const int lit : it.second) {
|
||||
bool_or->add_literals(lit);
|
||||
context->AddImplication(lit, it.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{ // Last transition to a final state.
|
||||
const int last = n - 1;
|
||||
BoolArgumentProto* const reach_final_state =
|
||||
context->working_model->add_constraints()->mutable_bool_or();
|
||||
|
||||
for (int t = 0; t < proto.transition_tail_size(); ++t) {
|
||||
const int64 tail = proto.transition_tail(t);
|
||||
const int64 label = proto.transition_label(t);
|
||||
const int64 head = proto.transition_head(t);
|
||||
|
||||
if (!gtl::ContainsKey(reachable_states[last], tail)) continue;
|
||||
if (!context->DomainContains(vars[last], label)) continue;
|
||||
if (!gtl::ContainsKey(reachable_states[last + 1], head)) continue;
|
||||
|
||||
const int tail_lit = state_literals[last][tail];
|
||||
const int head_lit = context->NewBoolVar();
|
||||
const int label_lit = context->expanded_variables[vars[last]][label];
|
||||
|
||||
context->AddImplication({tail_lit, label_lit}, head_lit);
|
||||
context->AddImplication(head_lit, {tail_lit, label_lit});
|
||||
|
||||
reach_final_state->add_literals(head_lit);
|
||||
bool_or->add_literals(transition_lit);
|
||||
at_most_one->add_literals(transition_lit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3208,8 +3172,8 @@ bool PresolveOneConstraint(int c, PresolveContext* context) {
|
||||
return PresolveCumulative(ct, context);
|
||||
case ConstraintProto::ConstraintCase::kCircuit:
|
||||
return PresolveCircuit(ct, context);
|
||||
// case ConstraintProto::ConstraintCase::kAutomaton:
|
||||
// return PresolveAutomaton(ct, context);
|
||||
case ConstraintProto::ConstraintCase::kAutomaton:
|
||||
return PresolveAutomaton(ct, context);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,17 +9,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "filelineiter",
|
||||
hdrs = ["filelineiter.h"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:status",
|
||||
"//ortools/base:strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "vector_map",
|
||||
hdrs = ["vector_map.h"],
|
||||
@@ -39,6 +28,16 @@ cc_library(
|
||||
deps = ["//ortools/base"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "integer_pq",
|
||||
hdrs = [
|
||||
"integer_pq.h",
|
||||
],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cached_log",
|
||||
srcs = ["cached_log.cc"],
|
||||
@@ -53,17 +52,13 @@ cc_library(
|
||||
srcs = ["graph_export.cc"],
|
||||
hdrs = ["graph_export.h"],
|
||||
deps = [
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:status",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "iterators",
|
||||
hdrs = ["iterators.h"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "zvector",
|
||||
hdrs = ["zvector.h"],
|
||||
@@ -76,22 +71,12 @@ cc_library(
|
||||
deps = ["//ortools/base"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "xml_helper",
|
||||
srcs = ["xml_helper.cc"],
|
||||
hdrs = ["xml_helper.h"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
],
|
||||
)
|
||||
|
||||
#cc_library(
|
||||
# name = "step_function",
|
||||
# srcs = ["step_function.cc"],
|
||||
# hdrs = ["step_function.h"],
|
||||
# deps = [
|
||||
# "//ortools/base:strings",
|
||||
# "@com_google_absl//absl/strings",
|
||||
# ":iterators",
|
||||
# "//ortools/base",
|
||||
# ],
|
||||
@@ -103,7 +88,7 @@ cc_library(
|
||||
deps = [
|
||||
":bitset",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -114,7 +99,8 @@ cc_library(
|
||||
deps = [
|
||||
":saturated_arithmetic",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -124,7 +110,7 @@ cc_library(
|
||||
hdrs = ["rational_approximation.h"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -135,8 +121,10 @@ cc_library(
|
||||
deps = [
|
||||
":saturated_arithmetic",
|
||||
"//ortools/base",
|
||||
"//ortools/base:span",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/container:inlined_vector",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -162,8 +150,9 @@ cc_library(
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:stl_util",
|
||||
"//ortools/base:strings",
|
||||
# "//ortools/base:strings:human_readable",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
# "@com_google_absl//absl/strings:human_readable",
|
||||
"//ortools/port:sysinfo",
|
||||
"//ortools/base:timer",
|
||||
"//ortools/port:utf8",
|
||||
@@ -177,7 +166,9 @@ cc_library(
|
||||
deps = [
|
||||
":running_stat",
|
||||
"//ortools/base",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base:sysinfo",
|
||||
"//ortools/base:timer",
|
||||
],
|
||||
@@ -221,7 +212,7 @@ cc_library(
|
||||
srcs = ["file_util.cc"],
|
||||
hdrs = ["file_util.h"],
|
||||
deps = [
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:hash",
|
||||
@@ -239,7 +230,7 @@ cc_library(
|
||||
srcs = ["proto_tools.cc"],
|
||||
hdrs = ["proto_tools.h"],
|
||||
deps = [
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:hash",
|
||||
@@ -251,6 +242,16 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "optional_boolean_proto",
|
||||
srcs = ["optional_boolean.proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
name = "optional_boolean_cc_proto",
|
||||
deps = [":optional_boolean_proto"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "functions_swig_helpers",
|
||||
hdrs = [
|
||||
@@ -290,7 +291,16 @@ cc_library(
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
"//ortools/base:map_util",
|
||||
"//ortools/base:strings",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sigint",
|
||||
srcs = ["sigint.cc"],
|
||||
hdrs = ["sigint.h"],
|
||||
deps = [
|
||||
"//ortools/base",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -309,14 +319,14 @@ cc_library(
|
||||
# hdrs = ["tsplib_parser.h"],
|
||||
# visibility = ["//visibility:public"],
|
||||
# deps = [
|
||||
# "//ortools/base:strings",
|
||||
# "@com_google_absl//absl/strings",
|
||||
# ":filelineiter",
|
||||
# "//ortools/base",
|
||||
# "//ortools/base:file",
|
||||
# "//ortools/base:file:path",
|
||||
# "//ortools/base:map_util",
|
||||
# "//ortools/base:mathutil",
|
||||
# "///ortools/base:strings",
|
||||
# "/@com_google_absl//absl/strings",
|
||||
# "//file/zipfile",
|
||||
# "//util/regexp/re2",
|
||||
# ],
|
||||
@@ -328,7 +338,7 @@ cc_library(
|
||||
# hdrs = ["pdtsp_parser.h"],
|
||||
# visibility = ["//visibility:public"],
|
||||
# deps = [
|
||||
# "//ortools/base:strings",
|
||||
# "@com_google_absl//absl/strings",
|
||||
# ":filelineiter",
|
||||
# "//ortools/base",
|
||||
# "//ortools/base:file",
|
||||
@@ -343,26 +353,13 @@ cc_library(
|
||||
# hdrs = ["bp_parser.h"],
|
||||
# visibility = ["//visibility:public"],
|
||||
# deps = [
|
||||
# "//ortools/base:strings",
|
||||
# "@com_google_absl//absl/strings",
|
||||
# ":filelineiter",
|
||||
# "//ortools/base",
|
||||
# "//ortools/base:file",
|
||||
# ],
|
||||
#)
|
||||
|
||||
cc_library(
|
||||
name = "rcpsp_parser",
|
||||
srcs = ["rcpsp_parser.cc"],
|
||||
hdrs = ["rcpsp_parser.h"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":filelineiter",
|
||||
"//ortools/base",
|
||||
"//ortools/base:file",
|
||||
"//ortools/base:strings",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sort",
|
||||
hdrs = ["sort.h"],
|
||||
|
||||
Reference in New Issue
Block a user