Minor cleanups in routing lib.

This commit is contained in:
Vincent Furnon
2015-03-30 10:58:07 +02:00
parent 4d4267e13d
commit a79929006c

View File

@@ -441,7 +441,7 @@ class RoutingModel {
}
// Comparator for STL containers and algorithms.
static bool LessThan(const CostClass& a, const CostClass b) {
static bool LessThan(const CostClass& a, const CostClass& b) {
if (a.arc_cost_evaluator != b.arc_cost_evaluator) {
return a.arc_cost_evaluator < b.arc_cost_evaluator;
}
@@ -508,7 +508,7 @@ class RoutingModel {
const std::vector<NodeIndex>& ends);
~RoutingModel();
// global parameters.
// Global parameters.
static void SetGlobalParameters(const RoutingParameters& parameters);
// Model creation
@@ -640,13 +640,13 @@ class RoutingModel {
indices->clear();
}
}
#if !defined(SWIGPYTHON)
#if !defined(SWIGPYTHON) && !defined(SWIGJAVA)
// Returns the variable indices of the nodes in the disjunction of index
// 'index'.
const std::vector<int>& GetDisjunctionIndices(DisjunctionIndex index) const {
return disjunctions_[index].nodes;
}
#endif // !defined(SWIGPYTHON)
#endif // !defined(SWIGPYTHON) && !defined(SWIGJAVA)
// Returns the penalty of the node disjunction of index 'index'.
int64 GetDisjunctionPenalty(DisjunctionIndex index) const {
return disjunctions_[index].penalty;
@@ -902,14 +902,14 @@ class RoutingModel {
// Returns true if the route of 'vehicle' is non empty in 'assignment'.
bool IsVehicleUsed(const Assignment& assignment, int vehicle) const;
// Variables
#if !defined(SWIGPYTHON)
#if !defined(SWIGPYTHON) && !defined(SWIGJAVA)
// Returns all next variables of the model, such that Nexts(i) is the next
// variable of the node corresponding to i.
const std::vector<IntVar*>& Nexts() const { return nexts_; }
// Returns all vehicle variables of the model, such that VehicleVars(i) is
// the vehicle variable of the node corresponding to i.
const std::vector<IntVar*>& VehicleVars() const { return vehicle_vars_; }
#endif // !defined(SWIGPYTHON)
#endif // !defined(SWIGPYTHON) && !defined(SWIGJAVA)
// Returns the next variable of the node corresponding to index.
IntVar* NextVar(int64 index) const { return nexts_[index]; }
// Returns the active variable of the node corresponding to index.
@@ -1055,9 +1055,9 @@ class RoutingModel {
int64 GetDimensionSpanCost(const std::string& d) const;
int64 GetTransitValue(const std::string& d, int64 from, int64 to,
int64 vehicle) const;
#if !defined(SWIGPYTHON)
#ifndef SWIG
const std::vector<IntVar*>& CumulVars(const std::string& dimension_name) const;
#endif // !defined(SWIGPYTHON)
#endif
// All the methods below are replaced by public methods with the same name
// on the RoutingDimension class. See those.
IntVar* CumulVar(int64 index, const std::string& dimension_name) const;
@@ -1318,13 +1318,13 @@ class RoutingDimension {
IntVar* CumulVar(int64 index) const { return cumuls_[index]; }
IntVar* TransitVar(int64 index) const { return transits_[index]; }
IntVar* SlackVar(int64 index) const { return slacks_[index]; }
#if !defined(SWIGPYTHON)
#if !defined(SWIGPYTHON) && !defined(SWIGJAVA)
// Like CumulVar(), TransitVar(), SlackVar() but return the whole variable
// vectors instead (indexed by int64 var index).
const std::vector<IntVar*>& cumuls() const { return cumuls_; }
const std::vector<IntVar*>& transits() const { return transits_; }
const std::vector<IntVar*>& slacks() const { return slacks_; }
#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
#if !defined(SWIGCSHARP)
// Returns the callback evaluating the capacity for vehicle indices.
RoutingModel::VehicleEvaluator* capacity_evaluator() const {
return capacity_evaluator_.get();
@@ -1334,8 +1334,8 @@ class RoutingDimension {
Solver::IndexEvaluator2* transit_evaluator(int vehicle) const {
return transit_evaluators_[vehicle];
}
#endif // !defined(SWIGCSHARP) && !defined(SWIGJAVA)
#endif // !defined(SWIGPYTHON)
#endif // SWIGCSHARP
#endif // !defined(SWIGPYTHON) && !defined(SWIGJAVA)
// Sets an upper bound on the dimension span on a given vehicle. This is the
// preferred way to limit the "length" of the route of a vehicle according to
// a dimension.
@@ -1961,7 +1961,7 @@ class RoutingLocalSearchFilter : public IntVarLocalSearchFilter {
protected:
bool CanPropagateObjectiveValue() const {
return objective_callback_.get() != nullptr;
return objective_callback_ != nullptr;
}
void PropagateObjectiveValue(int64 objective_value);