Skip to content

Commit 5863a63

Browse files
committed
export from google3
1 parent 0f16563 commit 5863a63

37 files changed

+117
-60
lines changed

.pylintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
# pygtk.require().
88
#init-hook=
99

10-
# Add files or directories to the blacklist. They should be base names, not
10+
# Add files or directories to the denylist. They should be base names, not
1111
# paths.
1212
ignore=CVS
1313

14-
# Add files or directories matching the regex patterns to the blacklist. The
14+
# Add files or directories matching the regex patterns to the denylist. The
1515
# regex matches against base names, not paths.
1616
ignore-patterns=
1717

bazel/README.md

+30-28
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,55 @@ You'll need:
4444

4545
Here the list of supported solvers:
4646

47-
* CP-SAT
48-
* GLOP
49-
* GLPK
50-
* PDLP
51-
* SCIP
47+
* CP-SAT
48+
* GLOP
49+
* GLPK
50+
* PDLP
51+
* SCIP
5252

5353
## Dependencies
5454

5555
OR-Tools depends on several mandatory libraries.
5656

57-
* Eigen
58-
* Google Abseil-cpp,
59-
* Google Protobuf,
60-
* Google Gtest,
61-
* Bliss,
62-
* SCIP,
63-
* GLPK (GNU Linear Programming Kit)
57+
* Eigen
58+
* Google Abseil-cpp,
59+
* Google Protobuf,
60+
* Google Gtest,
61+
* Bliss,
62+
* SCIP,
63+
* GLPK (GNU Linear Programming Kit)
6464

6565
## Compilation
6666

6767
You must compile OR-Tools using C++20:
6868

69-
* on UNIX:
69+
* on UNIX:
7070

71-
```sh
72-
bazel build --cxxopt=-std=c++17 ...
73-
```
74-
* on Windows when using MSVC:
71+
```sh
72+
bazel build --cxxopt=-std=c++17 ...
73+
```
7574

76-
```sh
77-
bazel build --cxxopt="-std:c++20" ...
78-
```
75+
* on Windows when using MSVC:
76+
77+
```sh
78+
bazel build --cxxopt="-std:c++20" ...
79+
```
7980

8081
## Testing
8182

8283
You may run tests using:
8384

84-
* on UNIX:
85+
* on UNIX:
86+
87+
```sh
88+
bazel test --cxxopt=-std=c++17 ...
89+
```
8590

86-
```sh
87-
bazel test --cxxopt=-std=c++17 ...
88-
```
89-
* on Windows when using MSVC:
91+
* on Windows when using MSVC:
9092

91-
```sh
92-
bazel test --cxxopt="-std:c++20" ...
93-
```
93+
```sh
94+
bazel test --cxxopt="-std:c++20" ...
95+
```
9496

9597
## Integration
9698

examples/cpp/course_scheduling.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "examples/cpp/course_scheduling.h"
1515

16+
#include <algorithm>
1617
#include <cmath>
1718
#include <vector>
1819

@@ -22,11 +23,11 @@
2223
#include "absl/strings/str_cat.h"
2324
#include "absl/strings/str_format.h"
2425
#include "absl/strings/str_split.h"
25-
#include "examples/cpp/course_scheduling.pb.h"
2626
#include "ortools/base/logging.h"
2727
#include "ortools/base/mathutil.h"
2828
#include "ortools/base/status_macros.h"
2929
#include "ortools/linear_solver/linear_solver.h"
30+
#include "ortools/scheduling/course_scheduling.pb.h"
3031

3132
namespace operations_research {
3233

examples/cpp/course_scheduling.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include "absl/container/flat_hash_set.h"
2121
#include "absl/status/status.h"
2222
#include "absl/strings/str_format.h"
23-
#include "examples/cpp/course_scheduling.pb.h"
2423
#include "ortools/linear_solver/linear_solver.h"
2524
#include "ortools/sat/cp_model.pb.h"
25+
#include "ortools/scheduling/course_scheduling.pb.h"
2626

2727
namespace operations_research {
2828
class CourseSchedulingSolver {

examples/dotnet/CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2010-2022 Google LLC
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
114
if(NOT BUILD_DOTNET_EXAMPLES)
215
return()
316
endif()

ortools/base/strong_int.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -366,20 +366,20 @@ class StrongIntRange {
366366
public:
367367
using value_type = IntType;
368368
using difference_type = IntType;
369-
using reference = const IntType &;
370-
using pointer = const IntType *;
369+
using reference = const IntType&;
370+
using pointer = const IntType*;
371371
using iterator_category = std::input_iterator_tag;
372372

373373
explicit StrongIntRangeIterator(IntType initial) : current_(initial) {}
374-
bool operator!=(const StrongIntRangeIterator &other) const {
374+
bool operator!=(const StrongIntRangeIterator& other) const {
375375
return current_ != other.current_;
376376
}
377-
bool operator==(const StrongIntRangeIterator &other) const {
377+
bool operator==(const StrongIntRangeIterator& other) const {
378378
return current_ == other.current_;
379379
}
380380
value_type operator*() const { return current_; }
381381
pointer operator->() const { return &current_; }
382-
StrongIntRangeIterator &operator++() {
382+
StrongIntRangeIterator& operator++() {
383383
++current_;
384384
return *this;
385385
}

ortools/constraint_solver/routing.cc

-3
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@
3737
#include "absl/container/flat_hash_set.h"
3838
#include "absl/flags/flag.h"
3939
#include "absl/functional/bind_front.h"
40-
#include "absl/memory/memory.h"
41-
#include "absl/meta/type_traits.h"
4240
#include "absl/status/statusor.h"
4341
#include "absl/strings/str_cat.h"
4442
#include "absl/strings/str_format.h"
45-
#include "absl/strings/str_join.h"
4643
#include "absl/strings/string_view.h"
4744
#include "absl/time/time.h"
4845
#include "ortools/base/int_type.h"

ortools/constraint_solver/routing_filters.cc

-6
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,20 @@
3131
#include <utility>
3232
#include <vector>
3333

34-
#include "absl/algorithm/container.h"
3534
#include "absl/container/btree_set.h"
3635
#include "absl/container/flat_hash_map.h"
3736
#include "absl/container/flat_hash_set.h"
3837
#include "absl/flags/flag.h"
39-
#include "absl/memory/memory.h"
40-
#include "absl/strings/str_join.h"
4138
#include "absl/strings/string_view.h"
42-
#include "ortools/base/int_type.h"
4339
#include "ortools/base/integral_types.h"
4440
#include "ortools/base/logging.h"
45-
#include "ortools/base/map_util.h"
4641
#include "ortools/base/small_map.h"
4742
#include "ortools/base/strong_vector.h"
4843
#include "ortools/constraint_solver/constraint_solver.h"
4944
#include "ortools/constraint_solver/constraint_solveri.h"
5045
#include "ortools/constraint_solver/routing.h"
5146
#include "ortools/constraint_solver/routing_lp_scheduling.h"
5247
#include "ortools/constraint_solver/routing_parameters.pb.h"
53-
#include "ortools/graph/min_cost_flow.h"
5448
#include "ortools/util/bitset.h"
5549
#include "ortools/util/piecewise_linear_function.h"
5650
#include "ortools/util/saturated_arithmetic.h"

ortools/constraint_solver/routing_lp_scheduling.cc

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <utility>
2424
#include <vector>
2525

26-
#include "absl/memory/memory.h"
27-
#include "absl/strings/str_join.h"
2826
#include "absl/time/time.h"
2927
#include "ortools/base/logging.h"
3028
#include "ortools/base/mathutil.h"

ortools/constraint_solver/routing_lp_scheduling.h

-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <vector>
2727

2828
#include "absl/container/flat_hash_map.h"
29-
#include "absl/memory/memory.h"
3029
#include "absl/time/time.h"
3130
#include "ortools/base/logging.h"
3231
#include "ortools/base/mathutil.h"
@@ -38,10 +37,8 @@
3837
#include "ortools/lp_data/lp_types.h"
3938
#include "ortools/sat/cp_model.pb.h"
4039
#include "ortools/sat/cp_model_solver.h"
41-
#include "ortools/sat/lp_utils.h"
4240
#include "ortools/sat/model.h"
4341
#include "ortools/sat/sat_parameters.pb.h"
44-
#include "ortools/util/saturated_arithmetic.h"
4542
#include "ortools/util/sorted_interval_list.h"
4643

4744
namespace operations_research {

ortools/linear_solver/model_validator.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ ExtractValidMPModelOrPopulateResponseStatus(const MPModelRequest& request,
701701
LazyMutableCopy<MPModelProto> model(request.model());
702702
if (request.has_model_delta()) {
703703
// NOTE(user): This library needs to be portable, so we can't include
704-
// ortools/base/file.h; see ../port/file.h.
704+
// ortools/base/helpers.h; see ../port/file.h.
705705
std::string contents;
706706
const absl::Status file_read_status = PortableFileGetContents(
707707
request.model_delta().baseline_model_file_path(), &contents);

ortools/linear_solver/samples/assignment_mip.py

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def main():
3636
# [START solver]
3737
# Create the mip solver with the SCIP backend.
3838
solver = pywraplp.Solver.CreateSolver('SCIP')
39+
3940
if not solver:
4041
return
4142
# [END solver]

ortools/linear_solver/samples/assignment_task_sizes_mip.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def main():
4646
# [START solver]
4747
# Create the mip solver with the SCIP backend.
4848
solver = pywraplp.Solver.CreateSolver('SCIP')
49+
4950
if not solver:
5051
return
5152
# [END solver]

ortools/linear_solver/samples/bin_packing_mip.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def main():
4242
# [START solver]
4343
# Create the mip solver with the SCIP backend.
4444
solver = pywraplp.Solver.CreateSolver('SCIP')
45+
4546
if not solver:
4647
return
4748
# [END solver]

ortools/linear_solver/samples/multiple_knapsack_mip.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START program]
1516
"""Solve a multiple knapsack problem using a MIP solver."""
1617
# [START import]

ortools/linear_solver/samples/stigler_diet.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START program]
1516
"""The Stigler diet problem.
1617

ortools/math_opt/tools/mathopt_solve_main.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ absl::Status RunSolver() {
284284

285285
// Optionally prints the problem.
286286
if (absl::GetFlag(FLAGS_print_model)) {
287-
std::cout << model;
287+
std::cout << *model;
288288
std::cout.flush();
289289
}
290290

ortools/port/file.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace operations_research {
2323

24-
// See ortools/base/file.h
24+
// See ortools/base/helpers.h
2525
::absl::Status PortableFileSetContents(absl::string_view file_name,
2626
absl::string_view content);
2727

ortools/sat/samples/assignment_groups_sat.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START program]
1516
"""Solve assignment problem for given group of workers."""
1617
# [START import]

ortools/sat/samples/assignment_task_sizes_sat.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START program]
1516
"""Solve a simple assignment problem."""
1617
# [START import]

ortools/sat/samples/assignment_teams_sat.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START program]
1516
"""Solve a simple assignment problem."""
1617
# [START import]

ortools/sat/samples/code_samples.bzl

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2010-2022 Google LLC
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
114
"""Helper macro to compile and test code samples."""
215

316
load("@rules_python//python:defs.bzl", "py_binary")
+14-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
# Copyright 2010-2022 Google LLC
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
214

315
declare -r DIR="${TEST_SRCDIR}/com_google_ortools/ortools/sat/samples"
416

517
function test::ortools::code_samples_sat_cc() {
618
"${DIR}/$1_cc"
719
}
820

9-
test::ortools::code_samples_sat_cc $1
21+
test::ortools::code_samples_sat_cc $1

ortools/sat/samples/code_samples_py_test.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
# Copyright 2010-2022 Google LLC
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
214

315
declare -r DIR="${TEST_SRCDIR}/com_google_ortools/ortools/sat/samples"
416

ortools/sat/samples/cp_is_fun_sat.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START program]
1516
"""Cryptarithmetic puzzle.
1617

0 commit comments

Comments
 (0)