Sync from google

This commit is contained in:
Corentin Le Molgat
2022-01-21 17:51:38 +01:00
parent 72db2c170a
commit a40295d79c
20 changed files with 86 additions and 90 deletions

View File

@@ -1,20 +1,20 @@
"""Helper macro to compile and test code samples."""
def code_sample_cc(name):
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/algorithms:knapsack_solver_lib",
],
)
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/algorithms:knapsack_solver_lib",
],
)
native.cc_test(
name = name+"_test",
size = "small",
srcs = [name + ".cc"],
deps = [
":"+name,
"//ortools/algorithms:knapsack_solver_lib",
],
)
native.cc_test(
name = name + "_test",
size = "small",
srcs = [name + ".cc"],
deps = [
":" + name,
"//ortools/algorithms:knapsack_solver_lib",
],
)

View File

@@ -156,6 +156,7 @@ cc_library(
],
hdrs = [
"file.h",
"helpers.h",
],
deps = [
":base",

17
ortools/base/helpers.h Normal file
View File

@@ -0,0 +1,17 @@
// Copyright 2010-2021 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.
#ifndef OR_TOOLS_BASE_HELPERS_H_
#define OR_TOOLS_BASE_HELPERS_H_
#endif // OR_TOOLS_BASE_HELPERS_H_

View File

@@ -254,6 +254,5 @@ const std::vector<sat::BinaryClause>& ProblemState::NewlyAddedBinaryClauses()
void ProblemState::SynchronizationDone() {
binary_clause_manager_.ClearNewlyAdded();
}
} // namespace bop
} // namespace operations_research

View File

@@ -280,7 +280,6 @@ struct LearnedInfo {
// New binary clauses.
std::vector<sat::BinaryClause> binary_clauses;
};
} // namespace bop
} // namespace operations_research
#endif // OR_TOOLS_BOP_BOP_BASE_H_

View File

@@ -131,7 +131,6 @@ message BopParameters {
// Use Large Neighborhood Search based on the LP relaxation.
optional bool use_lp_lns = 12 [default = true];
// Whether we use sat propagation to choose the lns neighbourhood.
optional bool use_sat_to_choose_lns_neighbourhood = 15 [default = true];
@@ -271,7 +270,6 @@ message BopParameters {
// overhead can be "absorbed" by the other threads.
optional double decomposed_problem_min_time_in_seconds = 36 [default = 0.0];
// The first solutions based on guided SAT will work in chunk of that many
// conflicts at the time. This allows to simulate parallelism between the
// different guiding strategy on a single core.

View File

@@ -61,7 +61,6 @@ bool UpdateProblemStateBasedOnStatus(BopOptimizerBase::Status status,
return false;
}
} // anonymous namespace
//------------------------------------------------------------------------------

View File

@@ -1009,7 +1009,6 @@ class IntVarLocalSearchHandler {
IntVarLocalSearchHandler>::OnStart;
// clang-format on
#endif // SWIGPYTHON
// clang-format off
%rename(IntVarLocalSearchOperatorTemplate)
VarLocalSearchOperator<IntVar, int64_t, IntVarLocalSearchHandler>;

View File

@@ -174,7 +174,7 @@ public static class IntVarArrayHelper
}
}
// TODO(user): Try to move this code back to the .swig with @define macros.
// TODO(user): Try to move this code back to the .i with @define macros.
public partial class IntVarVector : IDisposable,
System.Collections.IEnumerable
#if !SWIG_DOTNET_1

View File

@@ -405,7 +405,7 @@ namespace operations_research {
// Methods:
%rename (Add) Solver::AddConstraint;
// Rename NewSearch and EndSearch to add pinning. See the overrides of
// NewSearch in ../../open_source/csharp/constraint_solver/SolverHelper.cs
// NewSearch in ../../csharp/constraint_solver/SolverHelper.cs
%rename (NewSearchAux) Solver::NewSearch;
%rename (EndSearchAux) Solver::EndSearch;
@@ -966,7 +966,7 @@ PROTO2_RETURN(operations_research::CpModel,
namespace operations_research {
// Globals
// IMPORTANT(corentinl): Global will be placed in operations_research_constraint_solver.cs
// IMPORTANT(user): Global will be placed in operations_research_constraint_solver.cs
// Ignored:
%ignore FillValues;
} // namespace operations_research

View File

@@ -92,5 +92,4 @@ class CallPyDecisionBuilder : public operations_research::DecisionBuilder {
PyObject* str_func_;
};
#endif // OR_TOOLS_CONSTRAINT_SOLVER_PYTHON_PYWRAPCP_UTIL_H_

View File

@@ -14,6 +14,7 @@
#include "ortools/constraint_solver/routing_parameters.h"
#include <cstdint>
#include <string>
#include "absl/strings/str_cat.h"
#include "absl/time/time.h"

View File

@@ -1,29 +1,28 @@
"""Helper macro to compile and test code samples."""
def code_sample_cc(name):
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/base",
"//ortools/constraint_solver:cp",
"//ortools/constraint_solver:routing",
"//ortools/constraint_solver:routing_enums_cc_proto",
"//ortools/constraint_solver:routing_flags",
],
)
native.cc_test(
name = name+"_test",
size = "small",
srcs = [name + ".cc"],
deps = [
":"+name,
"//ortools/base",
"//ortools/constraint_solver:cp",
"//ortools/constraint_solver:routing",
"//ortools/constraint_solver:routing_enums_cc_proto",
"//ortools/constraint_solver:routing_flags",
],
)
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/base",
"//ortools/constraint_solver:cp",
"//ortools/constraint_solver:routing",
"//ortools/constraint_solver:routing_enums_cc_proto",
"//ortools/constraint_solver:routing_flags",
],
)
native.cc_test(
name = name + "_test",
size = "small",
srcs = [name + ".cc"],
deps = [
":" + name,
"//ortools/base",
"//ortools/constraint_solver:cp",
"//ortools/constraint_solver:routing",
"//ortools/constraint_solver:routing_enums_cc_proto",
"//ortools/constraint_solver:routing_flags",
],
)

View File

@@ -1,15 +0,0 @@
# Description:
# These files tells minizinc how to translate a minizinc file (.mzn)
# into a flatzinc one (.fzn).
#
# The name of each file is fixed, and each should describe how to
# interpret a given predicate.
package(default_visibility = ["//visibility:public"])
# Definition files (.mzn).
filegroup(
name = "minizinc_files",
srcs = glob(["*.mzn"]),
)

View File

@@ -20,6 +20,7 @@
#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/timer.h"

View File

@@ -1,24 +1,24 @@
"""Helper macro to compile and test code samples."""
def code_sample_cc(name):
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/base",
"//ortools/glop:lp_solver",
"//ortools/lp_data",
],
)
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/base",
"//ortools/glop:lp_solver",
"//ortools/lp_data",
],
)
native.cc_test(
name = name+"_test",
size = "small",
srcs = [name + ".cc"],
deps = [
":"+name,
"//ortools/base",
"//ortools/glop:lp_solver",
"//ortools/lp_data",
],
)
native.cc_test(
name = name + "_test",
size = "small",
srcs = [name + ".cc"],
deps = [
":" + name,
"//ortools/base",
"//ortools/glop:lp_solver",
"//ortools/lp_data",
],
)

View File

@@ -681,8 +681,6 @@ extern std::function<int(GRBmodel *model, int i)> GRBgettuneresult;
extern std::function<int(GRBmodel *model, int i, char **logP)> GRBgettunelog;
extern std::function<int(GRBmodel *model, GRBmodel *ignore, GRBmodel *hint)> GRBtunemodeladv;
extern std::function<int(GRBmodel *model)> GRBsync;
} // namespace operations_research
#endif // OR_TOOLS_GUROBI_ENVIRONMENT_H_

View File

@@ -138,7 +138,7 @@ public class VarEquality : LinearConstraint
private bool equality_;
}
// TODO(user): Try to move this code back to the .swig with @define macros.
// TODO(user): Try to move this code back to the .i with @define macros.
public partial class MPConstraintVector : IDisposable,
System.Collections.IEnumerable
#if !SWIG_DOTNET_1

View File

@@ -190,7 +190,7 @@ public partial class Variable
}
}
// TODO(user): Try to move this code back to the .swig with @define macros.
// TODO(user): Try to move this code back to the .i with @define macros.
public partial class MPVariableVector : IDisposable,
System.Collections.IEnumerable
#if !SWIG_DOTNET_1

View File

@@ -14,6 +14,7 @@
#ifndef OR_TOOLS_MATH_OPT_CPP_SOLUTION_H_
#define OR_TOOLS_MATH_OPT_CPP_SOLUTION_H_
#include <cstdint>
#include <optional>
#include "absl/types/optional.h"