Skip to content

Commit 3d7f967

Browse files
committed
rearchitecture of the cp library
1 parent b8e9997 commit 3d7f967

53 files changed

Lines changed: 8711 additions & 8519 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ortools/constraint_solver/BUILD.bazel

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,72 @@ py_library(
124124
# ----- Constraint Programming core engine -----
125125

126126
# This is the main library.
127-
# TODO(user): split this monolithic library into independent components.
128-
# Do the same for others.
127+
cc_library(
128+
name = "hash",
129+
hdrs = ["hash.h"],
130+
visibility = ["//visibility:public"],
131+
deps = [
132+
"@abseil-cpp//absl/hash",
133+
"@abseil-cpp//absl/log:check",
134+
],
135+
)
136+
137+
cc_library(
138+
name = "model_cache",
139+
srcs = ["model_cache.cc"],
140+
hdrs = ["model_cache.h"],
141+
visibility = ["//visibility:public"],
142+
deps = [
143+
":hash",
144+
"//ortools/base:stl_util",
145+
"@abseil-cpp//absl/flags:flag",
146+
"@abseil-cpp//absl/log:check",
147+
],
148+
)
149+
150+
cc_library(
151+
name = "reversible_engine",
152+
srcs = ["reversible_engine.cc"],
153+
hdrs = ["reversible_engine.h"],
154+
visibility = ["//visibility:public"],
155+
deps = [
156+
":solver_parameters_cc_proto",
157+
"//ortools/base:gzipstring",
158+
"@abseil-cpp//absl/log",
159+
"@abseil-cpp//absl/log:check",
160+
"@abseil-cpp//absl/strings:string_view",
161+
"@zlib",
162+
],
163+
)
164+
165+
cc_library(
166+
name = "reversible_data",
167+
srcs = ["reversible_data.cc"],
168+
hdrs = ["reversible_data.h"],
169+
visibility = ["//visibility:public"],
170+
deps = [
171+
":reversible_engine",
172+
"//ortools/util:bitset",
173+
"@abseil-cpp//absl/log:check",
174+
"@abseil-cpp//absl/strings",
175+
],
176+
)
177+
178+
cc_library(
179+
name = "utilities",
180+
srcs = ["utilities.cc"],
181+
hdrs = ["utilities.h"],
182+
visibility = ["//visibility:public"],
183+
deps = ["@abseil-cpp//absl/log:check"],
184+
)
185+
129186
cc_library(
130187
name = "cp",
131188
srcs = [
132189
"alldiff_cst.cc",
133190
"assignment.cc",
134191
"constraint_solver.cc",
192+
"constraint_solver_factory.cc",
135193
"constraints.cc",
136194
"count_cst.cc",
137195
"default_search.cc",
@@ -144,7 +202,6 @@ cc_library(
144202
"graph_constraints.cc",
145203
"interval.cc",
146204
"local_search.cc",
147-
"model_cache.cc",
148205
"pack.cc",
149206
"range_cst.cc",
150207
"resource.cc",
@@ -156,7 +213,6 @@ cc_library(
156213
"table.cc",
157214
"timetabling.cc",
158215
"trace.cc",
159-
"utilities.cc",
160216
"variables.cc",
161217
"visitor.cc",
162218
],
@@ -176,7 +232,6 @@ cc_library(
176232
"graph_constraints.h",
177233
"interval.h",
178234
"local_search.h",
179-
"model_cache.h",
180235
"pack.h",
181236
"range_cst.h",
182237
"sched_expr.h",
@@ -185,16 +240,19 @@ cc_library(
185240
"table.h",
186241
"timetabling.h",
187242
"trace.h",
188-
"utilities.h",
189243
"variables.h",
190244
"visitor.h",
191245
],
192246
visibility = ["//visibility:public"],
193247
deps = [
194248
":assignment_cc_proto",
249+
":model_cache",
250+
":reversible_data",
251+
":reversible_engine",
195252
":search_limit_cc_proto",
196253
":search_stats_cc_proto",
197254
":solver_parameters_cc_proto",
255+
":utilities",
198256
"//ortools/base:base_export",
199257
"//ortools/base:bitmap",
200258
"//ortools/base:file",
@@ -228,7 +286,6 @@ cc_library(
228286
"@abseil-cpp//absl/container:flat_hash_map",
229287
"@abseil-cpp//absl/container:flat_hash_set",
230288
"@abseil-cpp//absl/flags:flag",
231-
"@abseil-cpp//absl/hash",
232289
"@abseil-cpp//absl/log",
233290
"@abseil-cpp//absl/log:check",
234291
"@abseil-cpp//absl/log:vlog_is_on",
@@ -238,6 +295,5 @@ cc_library(
238295
"@abseil-cpp//absl/strings:str_format",
239296
"@abseil-cpp//absl/time",
240297
"@abseil-cpp//absl/types:span",
241-
"@zlib",
242298
],
243299
)

ortools/constraint_solver/alldiff_cst.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
#include "absl/strings/string_view.h"
2424
#include "ortools/constraint_solver/constraint_solver.h"
25-
#include "ortools/constraint_solver/utilities.h"
25+
#include "ortools/constraint_solver/reversible_data.h"
26+
#include "ortools/constraint_solver/visitor.h"
2627

2728
namespace operations_research {
2829

ortools/constraint_solver/assignment.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "ortools/base/safe_hash_map.h"
3535
#include "ortools/constraint_solver/assignment.pb.h"
3636
#include "ortools/constraint_solver/constraint_solver.h"
37+
#include "ortools/constraint_solver/interval.h"
3738
#include "ortools/constraint_solver/sequence_var.h"
3839

3940
namespace operations_research {

0 commit comments

Comments
 (0)