pair -> std::pair on code
This commit is contained in:
@@ -2169,7 +2169,7 @@ string Solver::GetName(const PropagationBaseObject* object) const {
|
||||
if (name != NULL) {
|
||||
return *name;
|
||||
}
|
||||
const pair<string, const PropagationBaseObject*>* delegate_object =
|
||||
const std::pair<string, const PropagationBaseObject*>* delegate_object =
|
||||
FindOrNull(delegate_objects_, object);
|
||||
if (delegate_object != NULL) {
|
||||
const string& prefix = delegate_object->first;
|
||||
|
||||
@@ -2278,7 +2278,7 @@ class Solver {
|
||||
const SolverParameters parameters_;
|
||||
hash_map<const PropagationBaseObject*, string> propagation_object_names_;
|
||||
hash_map<const PropagationBaseObject*,
|
||||
pair<string, const PropagationBaseObject*> > delegate_objects_;
|
||||
std::pair<string, const PropagationBaseObject*> > delegate_objects_;
|
||||
const string empty_name_;
|
||||
scoped_ptr<Queue> queue_;
|
||||
scoped_ptr<Trail> trail_;
|
||||
@@ -3765,8 +3765,8 @@ class Pack : public Constraint {
|
||||
scoped_array<IntVarIterator*> holes_;
|
||||
uint64 stamp_;
|
||||
Demon* demon_;
|
||||
std::vector<pair<int64, int64> > to_set_;
|
||||
std::vector<pair<int64, int64> > to_unset_;
|
||||
std::vector<std::pair<int64, int64> > to_set_;
|
||||
std::vector<std::pair<int64, int64> > to_unset_;
|
||||
bool in_process_;
|
||||
};
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ RoutingModel::RoutingModel(int nodes, int vehicles)
|
||||
|
||||
RoutingModel::RoutingModel(int nodes,
|
||||
int vehicles,
|
||||
const std::vector<pair<int, int> >& start_end)
|
||||
const std::vector<std::pair<int, int> >& start_end)
|
||||
: solver_(NULL),
|
||||
no_cycle_constraint_(NULL),
|
||||
costs_(vehicles),
|
||||
@@ -434,7 +434,7 @@ RoutingModel::RoutingModel(int nodes,
|
||||
CHECK_EQ(vehicles, starts.size());
|
||||
CHECK_EQ(vehicles, ends.size());
|
||||
hash_set<int> depot_set;
|
||||
std::vector<pair<int, int> > start_end(starts.size());
|
||||
std::vector<std::pair<int, int> > start_end(starts.size());
|
||||
for (int i = 0; i < starts.size(); ++i) {
|
||||
depot_set.insert(starts[i]);
|
||||
depot_set.insert(ends[i]);
|
||||
@@ -641,11 +641,11 @@ void RoutingModel::AddLocalSearchOperator(LocalSearchOperator* ls_operator) {
|
||||
}
|
||||
|
||||
void RoutingModel::SetDepot(int depot) {
|
||||
std::vector<pair<int, int> > start_end(vehicles_, std::make_pair(depot, depot));
|
||||
std::vector<std::pair<int, int> > start_end(vehicles_, std::make_pair(depot, depot));
|
||||
SetStartEnd(start_end);
|
||||
}
|
||||
|
||||
void RoutingModel::SetStartEnd(const std::vector<pair<int, int> >& start_end) {
|
||||
void RoutingModel::SetStartEnd(const std::vector<std::pair<int, int> >& start_end) {
|
||||
if (is_depot_set_) {
|
||||
LOG(WARNING) << "A depot has already been specified, ignoring new ones";
|
||||
return;
|
||||
|
||||
@@ -68,11 +68,11 @@ class RoutingModel {
|
||||
// vehicle route. Used to model multiple depots.
|
||||
RoutingModel(int nodes,
|
||||
int vehicles,
|
||||
const std::vector<pair<int, int> >& start_end);
|
||||
const std::vector<std::pair<int, int> >& start_end);
|
||||
// Constructor taking vectors of start nodes and end nodes for each
|
||||
// vehicle route. Used to model multiple depots.
|
||||
// TODO(user): added to simplify SWIG wrapping. Remove when swigging
|
||||
// std::vector<pair<int, int> > is ok.
|
||||
// std::vector<std::pair<int, int> > is ok.
|
||||
RoutingModel(int nodes,
|
||||
int vehicles,
|
||||
const std::vector<int>& starts,
|
||||
@@ -232,7 +232,7 @@ class RoutingModel {
|
||||
};
|
||||
|
||||
void Initialize();
|
||||
void SetStartEnd(const std::vector<pair<int, int> >& start_end);
|
||||
void SetStartEnd(const std::vector<std::pair<int, int> >& start_end);
|
||||
void AddDisjunctionInternal(const std::vector<int64>& nodes, int64 penalty);
|
||||
void AddNoCycleConstraintInternal();
|
||||
void SetVehicleCostInternal(int vehicle, Solver::IndexEvaluator2* evaluator);
|
||||
|
||||
@@ -2724,7 +2724,7 @@ SearchMonitor* Solver::MakeSimulatedAnnealing(bool maximize,
|
||||
|
||||
// ---------- Guided Local Search ----------
|
||||
|
||||
typedef pair<int64, int64> Arc;
|
||||
typedef std::pair<int64, int64> Arc;
|
||||
|
||||
// Base GLS penalties abstract class. Maintains the penalty frequency for each
|
||||
// (variable, value) arc.
|
||||
@@ -2836,8 +2836,8 @@ class GuidedLocalSearch : public Metaheuristic {
|
||||
}
|
||||
protected:
|
||||
struct Comparator {
|
||||
bool operator() (const pair<Arc, double>& i,
|
||||
const pair<Arc, double>& j) {
|
||||
bool operator() (const std::pair<Arc, double>& i,
|
||||
const std::pair<Arc, double>& j) {
|
||||
return i.second > j.second;
|
||||
}
|
||||
};
|
||||
@@ -3044,14 +3044,14 @@ int64 GuidedLocalSearch::Evaluate(const Assignment* delta,
|
||||
// Penalize all the most expensive arcs (var, value) according to their utility:
|
||||
// utility(i, j) = cost(i, j) / (1 + penalty(i, j))
|
||||
bool GuidedLocalSearch::LocalOptimum() {
|
||||
std::vector<pair<Arc, double> > utility(size_);
|
||||
std::vector<std::pair<Arc, double> > utility(size_);
|
||||
for (int i = 0; i < size_; ++i) {
|
||||
const int64 var_value = assignment_.Value(vars_[i]);
|
||||
const int64 value =
|
||||
(var_value != i) ? AssignmentPenalty(assignment_, i, var_value) : 0;
|
||||
const Arc arc(i, var_value);
|
||||
const int64 penalty = penalties_->Value(arc);
|
||||
utility[i] = pair<Arc, double>(arc, value / (penalty + 1.0));
|
||||
utility[i] = std::pair<Arc, double>(arc, value / (penalty + 1.0));
|
||||
}
|
||||
Comparator comparator;
|
||||
std::sort(utility.begin(), utility.end(), comparator);
|
||||
|
||||
@@ -149,11 +149,11 @@ class NetworkRoutingData {
|
||||
int max_capacity_;
|
||||
int fixed_charge_cost_;
|
||||
#if defined(_MSC_VER)
|
||||
hash_map<pair<int, int>, int, PairIntHasher> all_arcs_;
|
||||
hash_map<pair<int, int>, int, PairIntHasher> all_demands_;
|
||||
hash_map<std::pair<int, int>, int, PairIntHasher> all_arcs_;
|
||||
hash_map<std::pair<int, int>, int, PairIntHasher> all_demands_;
|
||||
#else
|
||||
hash_map<pair<int, int>, int> all_arcs_;
|
||||
hash_map<pair<int, int>, int> all_demands_;
|
||||
hash_map<std::pair<int, int>, int> all_arcs_;
|
||||
hash_map<std::pair<int, int>, int> all_demands_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user