remove map_util from most of the code; absl::make_unique and absl::optional -> stl version
This commit is contained in:
committed by
Mizux Seiha
parent
1b1cbc4fa5
commit
c82cfdc9ad
@@ -25,6 +25,7 @@
|
||||
|
||||
// A random problem generator is also included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <random>
|
||||
@@ -110,16 +111,16 @@ class NetworkRoutingData {
|
||||
|
||||
// Returns the capacity of an arc, and 0 if the arc is not defined.
|
||||
int Capacity(int node1, int node2) const {
|
||||
return gtl::FindWithDefault(
|
||||
all_arcs_,
|
||||
std::make_pair(std::min(node1, node2), std::max(node1, node2)), 0);
|
||||
const auto& iter = all_arcs_.find(
|
||||
std::make_pair(std::min(node1, node2), std::max(node1, node2)));
|
||||
return iter != all_arcs_.end() ? iter->second : 0;
|
||||
}
|
||||
|
||||
// Returns the demand between the source and the destination, and 0 if
|
||||
// there are no demands between the source and the destination.
|
||||
int Demand(int source, int destination) const {
|
||||
return gtl::FindWithDefault(all_demands_,
|
||||
std::make_pair(source, destination), 0);
|
||||
const auto& iter = all_demands_.find(std::make_pair(source, destination));
|
||||
return iter != all_demands_.end() ? iter->second : 0;
|
||||
}
|
||||
|
||||
// External building API.
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
#include <numeric>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/flags/usage.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/str_join.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "ortools/base/commandlineflags.h"
|
||||
#include "ortools/base/file.h"
|
||||
#include "ortools/base/init_google.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/timer.h"
|
||||
#include "ortools/packing/arc_flow_builder.h"
|
||||
@@ -40,7 +40,7 @@ ABSL_FLAG(int, max_bins, -1,
|
||||
"Maximum number of bins: default = -1 meaning no limits");
|
||||
|
||||
namespace operations_research {
|
||||
void ParseAndSolve(const std::string& filename, const std::string& solver,
|
||||
void ParseAndSolve(const std::string& filename, absl::string_view solver,
|
||||
const std::string& params) {
|
||||
std::string problem_name = filename;
|
||||
const size_t found = problem_name.find_last_of("/\\");
|
||||
@@ -97,8 +97,7 @@ void ParseAndSolve(const std::string& filename, const std::string& solver,
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
}
|
||||
|
||||
@@ -19,14 +19,13 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/flags/usage.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/numbers.h"
|
||||
#include "absl/strings/str_join.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "google/protobuf/text_format.h"
|
||||
#include "ortools/base/commandlineflags.h"
|
||||
#include "ortools/base/init_google.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/timer.h"
|
||||
#include "ortools/sat/cp_model.h"
|
||||
@@ -253,8 +252,7 @@ void ParseAndSolve() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
InitGoogle(argv[0], &argc, &argv, true);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user