1030 lines
27 KiB
Python
1030 lines
27 KiB
Python
# Copyright 2010-2025 Google LLC
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
|
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
|
load("//bazel:run_binary_test.bzl", "run_binary_test")
|
|
|
|
# Description:
|
|
# C++ examples for operations_research.
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
cc_binary(
|
|
name = "binpacking_2d_sat",
|
|
srcs = [
|
|
"binpacking_2d_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:mathutil",
|
|
"//ortools/base:path",
|
|
"//ortools/packing:binpacking_2d_parser",
|
|
"//ortools/packing:multiple_dimensions_bin_packing_cc_proto",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/sat:cp_model_solver",
|
|
"//ortools/sat:sat_parameters_cc_proto",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "binpacking_2d_sat_class01_instance2_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = [
|
|
"binpacking_2d_sat.cc",
|
|
],
|
|
=======
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
args = ["--input $(rootpath //ortools/packing/testdata:Class_01.2bp) --instance 2"],
|
|
binary = ":binpacking_2d_sat",
|
|
data = ["//ortools/packing/testdata:Class_01.2bp"],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "constraint_programming_cp",
|
|
srcs = ["constraint_programming_cp.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/constraint_solver:cp",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "constraint_programming_cp_test",
|
|
size = "small",
|
|
binary = ":constraint_programming_cp",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "costas_array_sat",
|
|
srcs = ["costas_array_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:types",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "costas_array_sat_model1_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = ["costas_array_sat.cc"],
|
|
args = [
|
|
"--minsize=6 --maxsize=6 --model=1",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
=======
|
|
args = ["--minsize=6 --maxsize=6 --model=1"],
|
|
binary = ":costas_array_sat",
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "costas_array_sat_model2_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = ["costas_array_sat.cc"],
|
|
args = [
|
|
"--minsize=6 --maxsize=6 --model=2",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
=======
|
|
args = ["--minsize=6 --maxsize=6 --model=2"],
|
|
binary = ":costas_array_sat",
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "costas_array_sat_model3_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = ["costas_array_sat.cc"],
|
|
args = [
|
|
"--minsize=6 --maxsize=6 --model=3",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
=======
|
|
args = ["--minsize=6 --maxsize=6 --model=3"],
|
|
binary = ":costas_array_sat",
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
)
|
|
|
|
cc_binary(
|
|
name = "cryptarithm_sat",
|
|
srcs = ["cryptarithm_sat.cc"],
|
|
deps = ["//ortools/sat:cp_model"],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "cryptarithm_sat_test",
|
|
size = "small",
|
|
binary = ":cryptarithm_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "dobble_ls",
|
|
srcs = ["dobble_ls.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:map_util",
|
|
"//ortools/base:types",
|
|
"//ortools/constraint_solver:cp",
|
|
"//ortools/util:bitset",
|
|
"@abseil-cpp//absl/random",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "dobble_ls_test",
|
|
size = "medium",
|
|
args = ["--time_limit_in_ms=10000"],
|
|
binary = ":dobble_ls",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "golomb_sat",
|
|
srcs = ["golomb_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "golomb_sat_test",
|
|
size = "medium",
|
|
args = ["--size 5"],
|
|
binary = ":golomb_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "knapsack_2d_sat",
|
|
srcs = [
|
|
"knapsack_2d_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/packing:binpacking_2d_parser",
|
|
"//ortools/packing:multiple_dimensions_bin_packing_cc_proto",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_solver",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/types:span",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "knapsack_2d_sat_class01_instance2_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = [
|
|
"knapsack_2d_sat.cc",
|
|
],
|
|
=======
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
args = ["--input $(rootpath //ortools/packing/testdata:Class_01.2bp) --instance 2"],
|
|
binary = ":knapsack_2d_sat",
|
|
data = ["//ortools/packing/testdata:Class_01.2bp"],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "jobshop_sat",
|
|
srcs = [
|
|
"jobshop_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/graph:connected_components",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/sat:cp_model_solver",
|
|
"//ortools/sat:sat_parameters_cc_proto",
|
|
"//ortools/scheduling:jobshop_scheduling_cc_proto",
|
|
"//ortools/scheduling:jobshop_scheduling_parser",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
"@protobuf",
|
|
"@protobuf//:wrappers_cc_proto",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "jobshop_sat_ft06",
|
|
size = "small",
|
|
<<<<<<< HEAD
|
|
srcs = [
|
|
"jobshop_sat.cc",
|
|
],
|
|
=======
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
args = ["--input $(rootpath //ortools/scheduling/testdata:ft06)"],
|
|
binary = ":jobshop_sat",
|
|
data = ["//ortools/scheduling/testdata:ft06"],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "magic_sequence_sat",
|
|
srcs = ["magic_sequence_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "magic_sequence_sat_test",
|
|
size = "medium",
|
|
binary = ":magic_sequence_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "multi_knapsack_sat",
|
|
srcs = [
|
|
"multi_knapsack_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "multi_knapsack_sat_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = [
|
|
"multi_knapsack_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
],
|
|
=======
|
|
binary = ":multi_knapsack_sat",
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
)
|
|
|
|
cc_binary(
|
|
name = "shift_minimization_sat",
|
|
srcs = [
|
|
"shift_minimization_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"//ortools/util:filelineiter",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "shift_minimization_sat_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = [
|
|
"shift_minimization_sat.cc",
|
|
],
|
|
args = ["--input $(rootpath //examples/cpp:shift_minimization.dat)"],
|
|
data = ["//examples/cpp:shift_minimization.dat"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:file",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"//ortools/util:filelineiter",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
=======
|
|
args = ["--input $(rootpath :shift_minimization.dat)"],
|
|
binary = ":shift_minimization_sat",
|
|
data = [":shift_minimization.dat"],
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
)
|
|
|
|
cc_binary(
|
|
name = "weighted_tardiness_sat",
|
|
srcs = [
|
|
"weighted_tardiness_sat.cc",
|
|
],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/sat:cp_model_solver",
|
|
"//ortools/sat:model",
|
|
"//ortools/sat:sat_parameters_cc_proto",
|
|
"//ortools/util:filelineiter",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "weighted_tardiness_sat_test",
|
|
size = "medium",
|
|
<<<<<<< HEAD
|
|
srcs = [
|
|
"weighted_tardiness_sat.cc",
|
|
],
|
|
args = ["--input $(rootpath //examples/cpp:wt40.txt)"],
|
|
data = ["//examples/cpp:wt40.txt"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:file",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_solver",
|
|
"//ortools/sat:disjunctive",
|
|
"//ortools/sat:integer",
|
|
"//ortools/sat:integer_expr",
|
|
"//ortools/sat:intervals",
|
|
"//ortools/sat:model",
|
|
"//ortools/sat:optimization",
|
|
"//ortools/sat:precedences",
|
|
"//ortools/sat:sat_solver",
|
|
"//ortools/util:filelineiter",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/strings",
|
|
"@protobuf",
|
|
],
|
|
=======
|
|
args = ["--input $(rootpath :wt40.txt)"],
|
|
binary = ":weighted_tardiness_sat",
|
|
data = [":wt40.txt"],
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
)
|
|
|
|
cc_binary(
|
|
name = "magic_square_sat",
|
|
srcs = ["magic_square_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "magic_square_sat_test",
|
|
size = "medium",
|
|
binary = ":magic_square_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "network_routing_sat",
|
|
srcs = ["network_routing_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/graph",
|
|
"//ortools/graph:shortest_paths",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:model",
|
|
"//ortools/util:sorted_interval_list",
|
|
"//ortools/util:time_limit",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/container:flat_hash_set",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/random:distributions",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@abseil-cpp//absl/strings:string_view",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "network_routing_sat_test",
|
|
size = "medium",
|
|
args = [
|
|
"--clients=10",
|
|
"--backbones=5",
|
|
"--demands=10",
|
|
"--traffic_min=5",
|
|
"--traffic_max=10",
|
|
"--min_client_degree=2",
|
|
"--max_client_degree=5",
|
|
"--min_backbone_degree=3",
|
|
"--max_backbone_degree=5",
|
|
"--max_capacity=20",
|
|
"--fixed_charge_cost=10",
|
|
],
|
|
binary = ":network_routing_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "nqueens",
|
|
srcs = ["nqueens.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:map_util",
|
|
"//ortools/base:types",
|
|
"//ortools/constraint_solver:cp",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "nqueens_test",
|
|
size = "small",
|
|
binary = ":nqueens",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "sports_scheduling_sat",
|
|
srcs = ["sports_scheduling_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/sat:model",
|
|
"//ortools/util:sorted_interval_list",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "sports_scheduling_sat_test",
|
|
size = "medium",
|
|
binary = ":sports_scheduling_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "pdptw",
|
|
srcs = ["pdptw.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:mathutil",
|
|
"//ortools/base:timer",
|
|
"//ortools/constraint_solver:cp",
|
|
"//ortools/routing",
|
|
"//ortools/routing:enums_cc_proto",
|
|
"//ortools/routing:index_manager",
|
|
"//ortools/routing:parameters",
|
|
"//ortools/routing:parameters_cc_proto",
|
|
"//ortools/routing:types",
|
|
"//ortools/routing/parsers:lilim_parser",
|
|
"//ortools/routing/parsers:simple_graph",
|
|
"@abseil-cpp//absl/algorithm:container",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
# Routing examples.
|
|
cc_binary(
|
|
name = "random_tsp",
|
|
srcs = ["random_tsp.cc"],
|
|
deps = [
|
|
<<<<<<< HEAD
|
|
"//ortools/base",
|
|
"//ortools/constraint_solver:routing",
|
|
"//ortools/util:random_engine",
|
|
"@abseil-cpp//absl/strings",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "pdptw",
|
|
srcs = ["pdptw.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:file",
|
|
"//ortools/base:mathutil",
|
|
"//ortools/constraint_solver:routing",
|
|
"//ortools/routing/parsers:lilim_parser",
|
|
=======
|
|
"//ortools/constraint_solver:cp",
|
|
"//ortools/routing",
|
|
"//ortools/routing:index_manager",
|
|
"//ortools/routing:parameters",
|
|
"//ortools/routing:parameters_cc_proto",
|
|
"//ortools/util:random_engine",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
>>>>>>> 3b384e83a4 ([bazel] Update examples)
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/log:initialize",
|
|
"@abseil-cpp//absl/random",
|
|
"@abseil-cpp//absl/strings",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
# Linear and integer programming examples.
|
|
cc_binary(
|
|
name = "integer_programming",
|
|
srcs = ["integer_programming.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/linear_solver",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "integer_programming_test",
|
|
size = "small",
|
|
binary = ":integer_programming",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "linear_programming",
|
|
srcs = ["linear_programming.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/linear_solver",
|
|
"//ortools/linear_solver:linear_solver_cc_proto",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "linear_programming_test",
|
|
size = "small",
|
|
binary = ":linear_programming",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "linear_solver_protocol_buffers",
|
|
srcs = ["linear_solver_protocol_buffers.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/linear_solver:linear_solver_cc_proto",
|
|
"//ortools/linear_solver:solve_mp_model",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "linear_solver_protocol_buffers_test",
|
|
size = "small",
|
|
binary = ":linear_solver_protocol_buffers",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "strawberry_fields_with_column_generation",
|
|
srcs = ["strawberry_fields_with_column_generation.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/linear_solver",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "strawberry_fields_with_column_generation_test",
|
|
size = "large",
|
|
args = ["--colgen_instance=4"],
|
|
binary = ":strawberry_fields_with_column_generation",
|
|
)
|
|
|
|
# Dimacs assignment problems
|
|
cc_library(
|
|
name = "print_dimacs_assignment",
|
|
hdrs = ["print_dimacs_assignment.h"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:file",
|
|
"//ortools/graph:linear_assignment",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "parse_dimacs_assignment",
|
|
srcs = ["parse_dimacs_assignment.cc"],
|
|
hdrs = ["parse_dimacs_assignment.h"],
|
|
deps = [
|
|
"//ortools/graph:linear_assignment",
|
|
"//ortools/util:filelineiter",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "dimacs_assignment",
|
|
srcs = ["dimacs_assignment.cc"],
|
|
deps = [
|
|
":parse_dimacs_assignment",
|
|
":print_dimacs_assignment",
|
|
"//ortools/algorithms:hungarian",
|
|
"//ortools/base",
|
|
"//ortools/base:timer",
|
|
"//ortools/graph",
|
|
"//ortools/graph:linear_assignment",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
# MPS driver for LP and MIP.
|
|
cc_binary(
|
|
name = "mps_driver",
|
|
srcs = ["mps_driver.cc"],
|
|
copts = ["-Wfloat-conversion"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:file",
|
|
"//ortools/base:timer",
|
|
"//ortools/glop:lp_solver",
|
|
"//ortools/glop:parameters_cc_proto",
|
|
"//ortools/lp_data",
|
|
"//ortools/lp_data:base",
|
|
"//ortools/lp_data:mps_reader",
|
|
"//ortools/lp_data:proto_utils",
|
|
"//ortools/util:file_util",
|
|
"//ortools/util:proto_tools",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/status",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "mps_driver_test",
|
|
size = "small",
|
|
args = ["--input $(rootpath //ortools/linear_solver/testdata:maximization.mps)"],
|
|
binary = ":mps_driver",
|
|
data = ["//ortools/linear_solver/testdata:maximization.mps"],
|
|
)
|
|
|
|
# Linear Assignment C++ Example
|
|
cc_binary(
|
|
name = "linear_assignment_api",
|
|
srcs = ["linear_assignment_api.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/graph",
|
|
"//ortools/graph:linear_assignment",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "linear_assignment_api_test",
|
|
size = "small",
|
|
binary = ":linear_assignment_api",
|
|
)
|
|
|
|
# Flow C++ Example
|
|
cc_binary(
|
|
name = "flow_api",
|
|
srcs = ["flow_api.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/graph",
|
|
"//ortools/graph:generic_max_flow",
|
|
"//ortools/graph:min_cost_flow",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "flow_api_test",
|
|
size = "small",
|
|
binary = ":flow_api",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "max_flow",
|
|
srcs = ["max_flow.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/graph",
|
|
"//ortools/graph:generic_max_flow",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "max_flow_test",
|
|
size = "small",
|
|
binary = ":max_flow",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "min_cost_flow",
|
|
srcs = ["min_cost_flow.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/graph:min_cost_flow",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:globals",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "min_cost_flow_test",
|
|
size = "small",
|
|
binary = ":min_cost_flow",
|
|
)
|
|
|
|
# Frequency Assignment Problem
|
|
cc_library(
|
|
name = "fap_parser",
|
|
srcs = ["fap_parser.cc"],
|
|
hdrs = ["fap_parser.h"],
|
|
deps = [
|
|
"//ortools/base:file",
|
|
"//ortools/base:map_util",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/container:flat_hash_map",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "fap_model_printer",
|
|
srcs = ["fap_model_printer.cc"],
|
|
hdrs = ["fap_model_printer.h"],
|
|
deps = [
|
|
":fap_parser",
|
|
"//ortools/base:logging",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "fap_utilities",
|
|
srcs = ["fap_utilities.cc"],
|
|
hdrs = ["fap_utilities.h"],
|
|
deps = [
|
|
":fap_parser",
|
|
"//ortools/base",
|
|
"//ortools/base:map_util",
|
|
"//ortools/constraint_solver:cp",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "frequency_assignment_problem",
|
|
srcs = ["frequency_assignment_problem.cc"],
|
|
deps = [
|
|
":fap_model_printer",
|
|
":fap_parser",
|
|
":fap_utilities",
|
|
"//ortools/base",
|
|
"//ortools/base:map_util",
|
|
"//ortools/constraint_solver:cp",
|
|
"@abseil-cpp//absl/container:btree",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
# Quadratic assignment problem.
|
|
|
|
cc_binary(
|
|
name = "qap_sat",
|
|
srcs = ["qap_sat.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:sat_parameters_cc_proto",
|
|
"//ortools/util:qap_reader",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/strings",
|
|
"@protobuf",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "slitherlink_sat",
|
|
srcs = ["slitherlink_sat.cc"],
|
|
deps = [
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_cc_proto",
|
|
"//ortools/sat:cp_model_solver",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/log",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/strings:str_format",
|
|
"@abseil-cpp//absl/types:span",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "slitherlink_sat_test",
|
|
size = "small",
|
|
binary = ":slitherlink_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "uncapacitated_facility_location",
|
|
srcs = ["uncapacitated_facility_location.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/linear_solver",
|
|
"//ortools/util:random_engine",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/flags:usage",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/log:initialize",
|
|
"@abseil-cpp//absl/random",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "variable_intervals_sat",
|
|
srcs = ["variable_intervals_sat.cc"],
|
|
deps = [
|
|
"//ortools/sat:cp_model",
|
|
"//ortools/sat:cp_model_solver",
|
|
"//ortools/sat:sat_parameters_cc_proto",
|
|
"//ortools/util:time_limit",
|
|
"@abseil-cpp//absl/log",
|
|
],
|
|
)
|
|
|
|
run_binary_test(
|
|
name = "variable_intervals_sat_test",
|
|
size = "small",
|
|
binary = ":variable_intervals_sat",
|
|
)
|
|
|
|
cc_binary(
|
|
name = "pdlp_solve",
|
|
srcs = ["pdlp_solve.cc"],
|
|
deps = [
|
|
"//ortools/base",
|
|
"//ortools/base:file",
|
|
"//ortools/pdlp:iteration_stats",
|
|
"//ortools/pdlp:primal_dual_hybrid_gradient",
|
|
"//ortools/pdlp:quadratic_program",
|
|
"//ortools/pdlp:quadratic_program_io",
|
|
"//ortools/pdlp:solve_log_cc_proto",
|
|
"//ortools/pdlp:solvers_cc_proto",
|
|
"//ortools/port:proto_utils",
|
|
"//ortools/util:file_util",
|
|
"//ortools/util:fp_roundtrip_conv",
|
|
"//ortools/util:sigint",
|
|
"@abseil-cpp//absl/base:log_severity",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/log:check",
|
|
"@abseil-cpp//absl/log:flags",
|
|
"@abseil-cpp//absl/log:globals",
|
|
"@abseil-cpp//absl/strings",
|
|
],
|
|
)
|