fix example

This commit is contained in:
lperron@google.com
2011-04-08 15:19:28 +00:00
parent 862acdede1
commit b54de42696
2 changed files with 26 additions and 2 deletions

View File

@@ -91,6 +91,27 @@ DEFINE_bool(focus_lns, true, "Focus LNS on highest cost arcs.");
namespace operations_research {
// ---------- Data and Data Generation ----------
namespace {
#if defined(_MSC_VER)
// The following class defines a hash function for arcs
class ArcHasher : public stdext::hash_compare <pair<int, int> > {
public:
size_t operator() (const pair<int, int>& a) const {
uint32 x = a.first;
uint32 y = 0x9e3779b9UL;
uint32 z = a.second;
mix(x, y, z);
return z;
}
bool operator() (const pair<int, int>& a1, const pair<int, int>& a2) const {
return a1.first < a2.first ||
(a1.first == a2.first && a1.second < a2.second);
}
};
#endif
} // namespace
static const int64 kDisconnectedDistance = -1LL;
// ----- Data -----
@@ -144,8 +165,13 @@ class NetworkRoutingData {
int num_nodes_;
int max_capacity_;
int fixed_charge_cost_;
#if defined(_MSC_VER)
hash_map<pair<int, int>, int, ArcHasher> all_arcs_;
hash_map<pair<int, int>, int, ArcHasher> all_demands_;
#else
hash_map<pair<int, int>, int> all_arcs_;
hash_map<pair<int, int>, int> all_demands_;
#endif
};
// ----- Data Generation -----

View File

@@ -17,8 +17,6 @@
#include "base/callback.h"
#include "base/commandlineflags.h"
#include "base/integral_types.h"
#include "base/logging.h"
#include "base/macros.h"
DEFINE_int32(shortestpaths_disconnected_distance, 200000,
"Distance returned when two node are disconnected");