cpp: sync from google3
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -282,7 +283,7 @@ void LPSolver::SetInitialBasis(
|
||||
}
|
||||
}
|
||||
if (revised_simplex_ == nullptr) {
|
||||
revised_simplex_ = absl::make_unique<RevisedSimplex>();
|
||||
revised_simplex_ = std::make_unique<RevisedSimplex>();
|
||||
revised_simplex_->SetLogger(&logger_);
|
||||
}
|
||||
revised_simplex_->LoadStateForNextSolve(state);
|
||||
@@ -589,7 +590,7 @@ void LPSolver::RunRevisedSimplexIfNeeded(ProblemSolution* solution,
|
||||
current_linear_program_.ClearTransposeMatrix();
|
||||
if (solution->status != ProblemStatus::INIT) return;
|
||||
if (revised_simplex_ == nullptr) {
|
||||
revised_simplex_ = absl::make_unique<RevisedSimplex>();
|
||||
revised_simplex_ = std::make_unique<RevisedSimplex>();
|
||||
revised_simplex_->SetLogger(&logger_);
|
||||
}
|
||||
revised_simplex_->SetParameters(parameters_);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "ortools/graph/max_flow.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
@@ -64,14 +65,14 @@ SimpleMaxFlow::Status SimpleMaxFlow::Solve(NodeIndex source, NodeIndex sink) {
|
||||
if (source >= num_nodes_ || sink >= num_nodes_) {
|
||||
return OPTIMAL;
|
||||
}
|
||||
underlying_graph_ = absl::make_unique<Graph>(num_nodes_, num_arcs);
|
||||
underlying_graph_ = std::make_unique<Graph>(num_nodes_, num_arcs);
|
||||
underlying_graph_->AddNode(source);
|
||||
underlying_graph_->AddNode(sink);
|
||||
for (int arc = 0; arc < num_arcs; ++arc) {
|
||||
underlying_graph_->AddArc(arc_tail_[arc], arc_head_[arc]);
|
||||
}
|
||||
underlying_graph_->Build(&arc_permutation_);
|
||||
underlying_max_flow_ = absl::make_unique<GenericMaxFlow<Graph>>(
|
||||
underlying_max_flow_ = std::make_unique<GenericMaxFlow<Graph>>(
|
||||
underlying_graph_.get(), source, sink);
|
||||
for (ArcIndex arc = 0; arc < num_arcs; ++arc) {
|
||||
ArcIndex permuted_arc =
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -25,7 +26,7 @@
|
||||
namespace operations_research {
|
||||
|
||||
void MinCostPerfectMatching::Reset(int num_nodes) {
|
||||
graph_ = absl::make_unique<BlossomGraph>(num_nodes);
|
||||
graph_ = std::make_unique<BlossomGraph>(num_nodes);
|
||||
optimal_cost_ = 0;
|
||||
matches_.assign(num_nodes, -1);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "ortools/gscip/gscip_ext.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/status_macros.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#ifndef OR_TOOLS_GSCIP_GSCIP_EXT_H_
|
||||
#define OR_TOOLS_GSCIP_GSCIP_EXT_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "ortools/gscip/gscip.h"
|
||||
#include "scip/scip.h"
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
#include "ortools/gscip/gscip_parameters.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "ortools/gscip/legacy_scip_params.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/strings/numbers.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
using ::google::protobuf::TextFormat;
|
||||
using google::protobuf::util::JsonParseOptions;
|
||||
using google::protobuf::util::JsonStringToMessage;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class LazyMutableCopy {
|
||||
const T& get() const { return copy_ != nullptr ? *copy_ : *original_; }
|
||||
T* get_mutable() {
|
||||
if (copy_ == nullptr) {
|
||||
copy_ = absl::make_unique<T>(*original_);
|
||||
copy_ = std::make_unique<T>(*original_);
|
||||
original_ = nullptr;
|
||||
}
|
||||
return copy_.get();
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
#include "ortools/util/logging.h"
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "ortools/base/logging.h"
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
#include "ortools/util/piecewise_linear_function.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/container/btree_set.h"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define OR_TOOLS_UTIL_SORTED_INTERVAL_LIST_H_
|
||||
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
#include "ortools/util/stats.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "ortools/base/stl_util.h"
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
|
||||
#include "ortools/util/time_limit.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
|
||||
ABSL_FLAG(bool, time_limit_use_usertime, false,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/port.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
@@ -133,10 +134,9 @@ class TimeLimit {
|
||||
* deterministic time and instruction count limit.
|
||||
*/
|
||||
static std::unique_ptr<TimeLimit> Infinite() {
|
||||
return absl::make_unique<TimeLimit>(
|
||||
std::numeric_limits<double>::infinity(),
|
||||
std::numeric_limits<double>::infinity(),
|
||||
std::numeric_limits<double>::infinity());
|
||||
return std::make_unique<TimeLimit>(std::numeric_limits<double>::infinity(),
|
||||
std::numeric_limits<double>::infinity(),
|
||||
std::numeric_limits<double>::infinity());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,9 +144,9 @@ class TimeLimit {
|
||||
*/
|
||||
static std::unique_ptr<TimeLimit> FromDeterministicTime(
|
||||
double deterministic_limit) {
|
||||
return absl::make_unique<TimeLimit>(
|
||||
std::numeric_limits<double>::infinity(), deterministic_limit,
|
||||
std::numeric_limits<double>::infinity());
|
||||
return std::make_unique<TimeLimit>(std::numeric_limits<double>::infinity(),
|
||||
deterministic_limit,
|
||||
std::numeric_limits<double>::infinity());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,9 +159,9 @@ class TimeLimit {
|
||||
template <typename Parameters>
|
||||
static std::unique_ptr<TimeLimit> FromParameters(
|
||||
const Parameters& parameters) {
|
||||
return absl::make_unique<TimeLimit>(
|
||||
parameters.max_time_in_seconds(), parameters.max_deterministic_time(),
|
||||
std::numeric_limits<double>::infinity());
|
||||
return std::make_unique<TimeLimit>(parameters.max_time_in_seconds(),
|
||||
parameters.max_deterministic_time(),
|
||||
std::numeric_limits<double>::infinity());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -467,7 +467,7 @@ class NestedTimeLimit {
|
||||
template <typename Parameters>
|
||||
static std::unique_ptr<NestedTimeLimit> FromBaseTimeLimitAndParameters(
|
||||
TimeLimit* time_limit, const Parameters& parameters) {
|
||||
return absl::make_unique<NestedTimeLimit>(
|
||||
return std::make_unique<NestedTimeLimit>(
|
||||
time_limit, parameters.max_time_in_seconds(),
|
||||
parameters.max_deterministic_time());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user