ortools: export from google3

This commit is contained in:
Corentin Le Molgat
2025-08-08 15:03:52 +02:00
parent badef91fb5
commit bd641e14b9
9 changed files with 22 additions and 22 deletions

View File

@@ -398,6 +398,7 @@ cc_library(
cc_library(
name = "memfile",
hdrs = ["memfile.h"],
deps = [],
)
cc_library(
@@ -431,6 +432,7 @@ cc_library(
cc_library(
name = "mutable_memfile",
hdrs = ["mutable_memfile.h"],
deps = [],
)
cc_library(

View File

@@ -5074,6 +5074,7 @@ class SequenceVar : public PropagationBaseObject {
class AssignmentElement {
public:
AssignmentElement() : activated_(true) {}
AssignmentElement(const AssignmentElement&) = default;
void Activate() { activated_ = true; }
void Deactivate() { activated_ = false; }
@@ -5087,6 +5088,7 @@ class IntVarElement : public AssignmentElement {
public:
IntVarElement();
explicit IntVarElement(IntVar* var);
IntVarElement(const IntVarElement& element) = default;
void Reset(IntVar* var);
IntVarElement* Clone();
void Copy(const IntVarElement& element);
@@ -5351,9 +5353,8 @@ class AssignmentContainer {
/// previous content.
void Copy(const AssignmentContainer<V, E>& container) {
Clear();
for (int i = 0; i < container.elements_.size(); ++i) {
const E& element = container.elements_[i];
FastAdd(element.Var())->Copy(element);
for (const E& element : container.elements_) {
elements_.emplace_back(element);
}
}
bool Contains(const V* const var) const {

View File

@@ -2481,7 +2481,7 @@ void GlobalCheapestInsertionFilteredHeuristic::AddNodeEntry(
}
void InsertionSequenceGenerator::AppendPickupDeliveryMultitourInsertions(
int pickup, int delivery, int vehicle, const std::vector<int>& path,
int pickup, int delivery, int vehicle, absl::Span<const int> path,
const std::vector<bool>& path_node_is_pickup,
const std::vector<bool>& path_node_is_delivery,
InsertionSequenceContainer& insertions) {
@@ -2514,7 +2514,7 @@ void InsertionSequenceGenerator::AppendPickupDeliveryMultitourInsertions(
}
}
auto append = [pickup, delivery, vehicle, num_nodes, &path, &insertions](
auto append = [pickup, delivery, vehicle, num_nodes, path, &insertions](
int pickup_pos, int delivery_pos) {
if (pickup_pos < 0 || num_nodes - 1 <= pickup_pos) return;
if (delivery_pos < 0 || num_nodes - 1 <= delivery_pos) return;

View File

@@ -1099,7 +1099,7 @@ class InsertionSequenceGenerator {
/// are made on the subpath of paired nodes, all extensions to the original
/// path that conserve order are equivalent.
void AppendPickupDeliveryMultitourInsertions(
int pickup, int delivery, int vehicle, const std::vector<int>& path,
int pickup, int delivery, int vehicle, absl::Span<const int> path,
const std::vector<bool>& path_node_is_pickup,
const std::vector<bool>& path_node_is_delivery,
InsertionSequenceContainer& insertions);

View File

@@ -605,8 +605,8 @@ void BM_RandomDag(benchmark::State& state) {
const int num_nodes = state.range(0);
const int num_arcs = num_nodes * state.range(1);
const auto [graph, topological_order] = BuildRandomDag(num_nodes, num_arcs);
// Generate at most 20 scenarios of random arc lengths.
const int num_scenarios = std::min(20, (int)state.iterations());
// Generate 10 scenarios of random arc lengths.
const int num_scenarios = 10;
std::vector<std::vector<double>> arc_lengths_scenarios;
for (int _ = 0; _ < num_scenarios; ++_) {
arc_lengths_scenarios.push_back(GenerateRandomLengths(graph));
@@ -632,7 +632,8 @@ BENCHMARK(BM_RandomDag)
->ArgPair(1 << 16, 4)
->ArgPair(1 << 16, 16)
->ArgPair(1 << 22, 4)
->ArgPair(1 << 22, 16);
->ArgPair(1 << 22, 16)
->ArgPair(1 << 26, 4); // Don't go bigger, can't run on work station.
void BM_LineDag(benchmark::State& state) {
const int num_nodes = state.range(0);
@@ -1198,8 +1199,8 @@ void BM_RandomDag_K(benchmark::State& state) {
const int num_arcs = num_nodes * state.range(1);
const int path_count = state.range(2);
const auto [graph, topological_order] = BuildRandomDag(num_nodes, num_arcs);
// Generate at most 20 scenarios of random arc lengths.
const int num_scenarios = std::min(20, (int)state.iterations());
// Generate 10 scenarios of random arc lengths.
const int num_scenarios = 10;
std::vector<std::vector<double>> arc_lengths_scenarios;
for (int _ = 0; _ < num_scenarios; ++_) {
arc_lengths_scenarios.push_back(GenerateRandomLengths(graph));

View File

@@ -316,7 +316,7 @@ cc_library(
"@scip",
],
"//conditions:default": [],
})+ select({
}) + select({
":use_highs": [
"//ortools/linear_solver/proto_solver:highs_proto_solver",
"@highs",

View File

@@ -12,19 +12,11 @@
// limitations under the License.
// This .swig file exposes the linear programming and integer programming
// solver. See the C++/Python codelab: (there isn't
// a java codelab yet, as of July 2014)
// solver.
//
// The java API is pretty much identical to the C++ API, with methods
// systematically renamed to the Java-style "lowerCamelCase", and using
// the Java-style getProperty() instead of the C++ Property(), for getters.
//
// USAGE EXAMPLES (j/c/g and jt/c/g refer to java/com/google and javatests/...):
// - j/c/g/ortools/samples/LinearProgramming.java
// - j/c/g/ortools/samples/IntegerProgramming.java
// - jt/c/g/ortools/linearsolver/LinearSolverTest.java
//
// TODO(user): unit test all the APIs that are currently marked with 'no test'.
%include "enums.swg" // For native Java enum support.
%include "stdint.i"

View File

@@ -497,6 +497,8 @@ message MPModelRequest {
// These additional solutions may have a worse objective than the main
// solution returned in the response.
optional int32 populate_additional_solutions_up_to = 11 [default = 0];
reserved 12;
}
// Status returned by the solver. They follow a hierarchical nomenclature, to
@@ -658,4 +660,6 @@ message MPSolutionResponse {
// additional solutions are different than the main solution described by the
// above fields `objective_value` and `variable_value`.
repeated MPSolution additional_solutions = 8;
reserved 9;
}

View File

@@ -41,4 +41,4 @@
%rename (sortedLexicographically) operations_research::IntTupleSet::SortedLexicographically;
%rename (value) operations_research::IntTupleSet::Value;
%include ortools/util/tuple_set.h
%include "ortools/util/tuple_set.h"