ortools: export from google3

This commit is contained in:
Corentin Le Molgat
2025-07-07 15:39:14 +02:00
parent 43aa85125b
commit 781ead7283
11 changed files with 41 additions and 33 deletions

View File

@@ -51,7 +51,7 @@
namespace operations_research {
// Sorts an array of int, double, or other numeric types. Up to ~10x faster than
// std::sort() when size ≥ 8k: go/radix-sort-bench. See file-level comment.
// std::sort() when size ≥ 8k. See file-level comment for more details.
template <typename T>
void RadixSort(
absl::Span<T> values,

View File

@@ -189,7 +189,6 @@ class IntType {
}
// Note that this may change from time to time without notice.
// See .
struct Hasher {
size_t operator()(const IntType& arg) const {
return static_cast<size_t>(arg.value());

View File

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

View File

@@ -20,7 +20,7 @@ option java_package = "com.google.ortools.constraintsolver";
option java_multiple_files = true;
// We set the outer classname to something other than 'SearchLimit', which is
// in conflict with the SWIG-generated class in the same directory (see
// java/constraint_solver.i).
// java/constraint_solver.swig).
option java_outer_classname = "SearchLimitProtobuf";
option csharp_namespace = "Google.OrTools.ConstraintSolver";

View File

@@ -638,8 +638,6 @@ struct GraphTraits {
// + (ArcIndexType + NodeIndexType) * arc_capacity().
// - Has an efficient Tail() but need an extra NodeIndexType/arc memory for it.
// - Never changes the initial arc index returned by AddArc().
//
// All graphs should be -compatible, but we haven't tested that.
template <typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
class ListGraph : public BaseGraph<NodeIndexType, ArcIndexType, false> {
typedef BaseGraph<NodeIndexType, ArcIndexType, false> Base;

View File

@@ -17,7 +17,9 @@
#define UTIL_GRAPH_IO_H_
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <memory>
#include <numeric>
#include <string>
@@ -29,10 +31,9 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "ortools/base/numbers.h"
#include "ortools/graph/graph.h"
#include "ortools/util/filelineiter.h"
namespace util {

View File

@@ -313,8 +313,6 @@ typedef ::util::internal::DenseIntTopologicalSorterTpl<
// TopologicalSorter requires that all nodes and edges be added before
// traversing the nodes, otherwise it will die with a fatal error.
//
// TopologicalSorter is -compatible
//
// Note(user): since all the real work is done by
// DenseIntTopologicalSorterTpl, and this class is a template, we inline
// every function here in the .h.

View File

@@ -18,18 +18,17 @@
#include <algorithm>
#include <cstdint>
#include <map>
#include <limits>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "absl/container/btree_map.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/inlined_vector.h"
#include "absl/log/check.h"
#include "absl/types/span.h"
#include "ortools/base/hash.h"
#include "ortools/base/map_util.h"
#include "ortools/graph/connected_components.h"
#include "ortools/graph/graph.h"

View File

@@ -20,20 +20,19 @@
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/cleanup/cleanup.h"
#include "absl/flags/flag.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
#include "absl/types/optional.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/hash.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/time.h"
#include "lpi/lpi.h"
#include "ortools/base/logging.h"
#include "ortools/base/status_macros.h"
#include "ortools/base/timer.h"
#include "ortools/gscip/legacy_scip_params.h"
#include "ortools/linear_solver/linear_solver.h"
@@ -45,12 +44,29 @@
#include "ortools/linear_solver/scip_helper_macros.h"
#include "ortools/util/lazy_mutable_copy.h"
#include "scip/cons_indicator.h"
#include "scip/scip.h"
#include "scip/cons_linear.h"
#include "scip/def.h"
#include "scip/scip_cons.h"
#include "scip/scip_copy.h"
#include "scip/scip_general.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_sol.h"
#include "scip/scip_solve.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_var.h"
#include "scip/scipdefplugins.h"
#include "scip/type_clock.h"
#include "scip/type_cons.h"
#include "scip/type_paramset.h"
#include "scip/type_prob.h"
#include "scip/type_retcode.h"
#include "scip/type_scip.h"
#include "scip/type_sol.h"
#include "scip/type_stat.h"
#include "scip/type_var.h"
ABSL_FLAG(bool, scip_feasibility_emphasis, false,
"When true, emphasize search towards feasibility. This may or "
@@ -98,11 +114,11 @@ class SCIPInterface : public MPSolverInterface {
int64_t iterations() const override;
int64_t nodes() const override;
MPSolver::BasisStatus row_status(int constraint_index) const override {
MPSolver::BasisStatus row_status(int) const override {
LOG(DFATAL) << "Basis status only available for continuous problems";
return MPSolver::FREE;
}
MPSolver::BasisStatus column_status(int variable_index) const override {
MPSolver::BasisStatus column_status(int) const override {
LOG(DFATAL) << "Basis status only available for continuous problems";
return MPSolver::FREE;
}
@@ -445,15 +461,12 @@ void SCIPInterface::ClearConstraint(MPConstraint* constraint) {
}
// Cached
void SCIPInterface::SetObjectiveCoefficient(const MPVariable* variable,
double coefficient) {
void SCIPInterface::SetObjectiveCoefficient(const MPVariable*, double) {
sync_status_ = MUST_RELOAD;
}
// Cached
void SCIPInterface::SetObjectiveOffset(double value) {
sync_status_ = MUST_RELOAD;
}
void SCIPInterface::SetObjectiveOffset(double) { sync_status_ = MUST_RELOAD; }
// Clear objective of all its terms.
void SCIPInterface::ClearObjective() {
@@ -492,16 +505,16 @@ void SCIPInterface::BranchingPriorityChangedForVariable(int var_index) {
}
}
void SCIPInterface::AddRowConstraint(MPConstraint* ct) {
void SCIPInterface::AddRowConstraint(MPConstraint*) {
sync_status_ = MUST_RELOAD;
}
bool SCIPInterface::AddIndicatorConstraint(MPConstraint* ct) {
bool SCIPInterface::AddIndicatorConstraint(MPConstraint*) {
sync_status_ = MUST_RELOAD;
return true;
}
void SCIPInterface::AddVariable(MPVariable* var) { sync_status_ = MUST_RELOAD; }
void SCIPInterface::AddVariable(MPVariable*) { sync_status_ = MUST_RELOAD; }
void SCIPInterface::ExtractNewVariables() {
RETURN_IF_ALREADY_IN_ERROR_STATE;
@@ -882,7 +895,7 @@ bool SCIPInterface::SupportsDirectlySolveProto(
}
MPSolutionResponse SCIPInterface::DirectlySolveProto(
LazyMutableCopy<MPModelRequest> request, std::atomic<bool>* interrupt) {
LazyMutableCopy<MPModelRequest> request, std::atomic<bool>*) {
const bool log_error = request->enable_internal_solver_output();
return ConvertStatusOrMPSolutionResponse(log_error,
ScipSolveProto(std::move(request)));
@@ -976,7 +989,7 @@ void SCIPInterface::SetPresolveMode(int presolve) {
}
}
void SCIPInterface::SetScalingMode(int scaling) {
void SCIPInterface::SetScalingMode(int) {
SetUnsupportedIntegerParam(MPSolverParameters::SCALING);
}

View File

@@ -309,7 +309,7 @@ class BoundedLinearExpression {
// to be wrapped by SWIG correctly:
// 1) Their types must include the full operations_research::
// namespace.
// 2) Their names must correspond to the ones declared in the .i
// 2) Their names must correspond to the ones declared in the .swig
// file (see the java/ and csharp/ subdirectories).
// Helper for importing/exporting models and model protobufs.

View File

@@ -105,7 +105,7 @@ class PiecewiseLinearFunction {
// This API provides a factory for creating different families of Piecewise
// Linear Functions based on specific properties of each family. The
// PiecewiseLinearFunction is composed by a set of PiecwiseSegments and upon
// PiecewiseLinearFunction is composed by a set of PiecewiseSegments and upon
// creation is not modifiable but with the provided function operations.
// The object returned by any of these builders in the factory is owned by
// the client code.