Skip to content

Commit

Permalink
routing: Add routing sub namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Aug 5, 2024
1 parent 3e1ca33 commit f2c2c77
Show file tree
Hide file tree
Showing 84 changed files with 382 additions and 273 deletions.
4 changes: 2 additions & 2 deletions ortools/routing/breaks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "ortools/util/saturated_arithmetic.h"
#include "ortools/util/sorted_interval_list.h"

namespace operations_research {
namespace operations_research::routing {

bool DisjunctivePropagator::Propagate(Tasks* tasks) {
DCHECK_LE(tasks->num_chain_tasks, tasks->start_min.size());
Expand Down Expand Up @@ -1086,4 +1086,4 @@ IntVarLocalSearchFilter* MakeVehicleBreaksFilter(
new VehicleBreaksFilter(routing_model, dimension));
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/constraints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "ortools/routing/search.h"
#include "ortools/util/saturated_arithmetic.h"

namespace operations_research {
namespace operations_research::routing {

namespace {
// Constraint which ensures that var != values.
Expand Down Expand Up @@ -793,4 +793,4 @@ Constraint* MakeRouteConstraint(
model, std::move(route_cost_vars), std::move(route_evaluator)));
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "ortools/constraint_solver/constraint_solver.h"
#include "ortools/routing/routing.h"

namespace operations_research {
namespace operations_research::routing {

Constraint* MakeDifferentFromValues(Solver* solver, IntVar* var,
std::vector<int64_t> values);
Expand All @@ -49,6 +49,6 @@ Constraint* MakeRouteConstraint(
std::function<std::optional<int64_t>(const std::vector<int64_t>&)>
route_evaluator);

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_CONSTRAINTS_H_
4 changes: 2 additions & 2 deletions ortools/routing/decision_builders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "ortools/routing/routing.h"
#include "ortools/util/saturated_arithmetic.h"

namespace operations_research {
namespace operations_research::routing {

namespace {

Expand Down Expand Up @@ -897,4 +897,4 @@ DecisionBuilder* FinalizerVariables::CreateFinalizer() {
std::move(targets));
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/decision_builders.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ortools/routing/lp_scheduling.h"
#include "ortools/routing/routing.h"

namespace operations_research {
namespace operations_research::routing {

/// A decision builder which tries to assign values to variables as close as
/// possible to target values first.
Expand Down Expand Up @@ -108,5 +108,5 @@ class FinalizerVariables {
#endif
};

} // namespace operations_research
} // namespace operations_research::routing
#endif // OR_TOOLS_ROUTING_DECISION_BUILDERS_H_
4 changes: 2 additions & 2 deletions ortools/routing/docs/ROUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ and .Net. Each language have different requirements for the code samples.
#include "ortools/routing/parameters.h"
#include "ortools/routing/routing.h"

namespace operations_research {
namespace operations_research::routing {

void SimpleRoutingProgram() {
// Instantiate the data problem.
Expand Down Expand Up @@ -79,7 +79,7 @@ void SimpleRoutingProgram() {
LOG(INFO) << "Distance of the route: " << route_distance << "m";
}

} // namespace operations_research
} // namespace operations_research::routing

int main(int /*argc*/, char* /*argv*/[]) {
operations_research::SimpleRoutingProgram();
Expand Down
6 changes: 3 additions & 3 deletions ortools/routing/filters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ABSL_FLAG(bool, routing_strong_debug_checks, false,
"Run stronger checks in debug; these stronger tests might change "
"the complexity of the code in particular.");

namespace operations_research {
namespace operations_research::routing {

namespace {
// Route constraint filter
Expand Down Expand Up @@ -4289,7 +4289,7 @@ class LightVehicleBreaksFilter : public LocalSearchFilter {

LocalSearchFilter* MakeLightVehicleBreaksFilter(
Solver* solver, std::unique_ptr<LightVehicleBreaksChecker> checker,
const std::string& dimension_name) {
absl::string_view dimension_name) {
LightVehicleBreaksFilter* filter =
new LightVehicleBreaksFilter(std::move(checker), dimension_name);
return solver->RevAlloc(filter);
Expand Down Expand Up @@ -4751,4 +4751,4 @@ LocalSearchFilter* MakePathEnergyCostFilter(
// TODO(user): Implement same-vehicle filter. Could be merged with node
// precedence filter.

} // namespace operations_research
} // namespace operations_research::routing
6 changes: 3 additions & 3 deletions ortools/routing/filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "ortools/util/bitset.h"
#include "ortools/util/range_minimum_query.h"

namespace operations_research {
namespace operations_research::routing {

/// Returns a filter tracking route constraints.
IntVarLocalSearchFilter* MakeRouteConstraintFilter(
Expand Down Expand Up @@ -589,7 +589,7 @@ class LightVehicleBreaksChecker {

LocalSearchFilter* MakeLightVehicleBreaksFilter(
Solver* solver, std::unique_ptr<LightVehicleBreaksChecker> checker,
const std::string& dimension_name);
absl::string_view dimension_name);

// This class allows making fast range queries on sequences of elements.
// * Main characteristics.
Expand Down Expand Up @@ -978,6 +978,6 @@ class BasePathFilter : public IntVarLocalSearchFilter {
bool lns_detected_;
};

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_FILTERS_H_
4 changes: 2 additions & 2 deletions ortools/routing/flow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "ortools/routing/routing.h"
#include "ortools/util/saturated_arithmetic.h"

namespace operations_research {
namespace operations_research::routing {

namespace {
// Compute set of disjunctions involved in a pickup and delivery pair.
Expand Down Expand Up @@ -452,4 +452,4 @@ bool RoutingModel::SolveMatchingModel(
return true;
}

} // namespace operations_research
} // namespace operations_research::routing
10 changes: 6 additions & 4 deletions ortools/routing/ils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "ortools/routing/search.h"
#include "ortools/routing/types.h"

namespace operations_research {
namespace operations_research::routing {
namespace {

// Returns global cheapest insertion parameters based on the given search
Expand Down Expand Up @@ -227,13 +227,15 @@ std::unique_ptr<RoutingFilteredHeuristic> MakeRecreateProcedure(
model, std::move(stop_search),
absl::bind_front(&RoutingModel::GetArcCostForVehicle, model),
parameters.local_cheapest_cost_insertion_pickup_delivery_strategy(),
filter_manager, model->GetBinCapacities());
parameters.local_cheapest_insertion_sorting_mode(), filter_manager,
model->GetBinCapacities());
case FirstSolutionStrategy::LOCAL_CHEAPEST_COST_INSERTION:
return std::make_unique<LocalCheapestInsertionFilteredHeuristic>(
model, std::move(stop_search),
/*evaluator=*/nullptr,
parameters.local_cheapest_cost_insertion_pickup_delivery_strategy(),
filter_manager, model->GetBinCapacities());
parameters.local_cheapest_insertion_sorting_mode(), filter_manager,
model->GetBinCapacities());
case FirstSolutionStrategy::SEQUENTIAL_CHEAPEST_INSERTION: {
GlobalCheapestInsertionFilteredHeuristic::
GlobalCheapestInsertionParameters gci_parameters =
Expand Down Expand Up @@ -931,4 +933,4 @@ std::pair<double, double> GetSimulatedAnnealingTemperatures(
return {reference_temperature * 0.1, reference_temperature * 0.001};
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/ils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "ortools/routing/routing.h"
#include "ortools/util/bitset.h"

namespace operations_research {
namespace operations_research::routing {

// Wraps a routing assignment providing extra features.
class RoutingSolution {
Expand Down Expand Up @@ -223,6 +223,6 @@ std::pair<double, double> GetSimulatedAnnealingTemperatures(
const RoutingModel& model, const SimulatedAnnealingParameters& sa_params,
std::mt19937* rnd);

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_ILS_H_
4 changes: 2 additions & 2 deletions ortools/routing/index_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "absl/types/span.h"
#include "ortools/base/logging.h"

namespace operations_research {
namespace operations_research::routing {

const int64_t RoutingIndexManager::kUnassigned = -1;

Expand Down Expand Up @@ -146,4 +146,4 @@ std::vector<RoutingIndexManager::NodeIndex> RoutingIndexManager::IndicesToNodes(
return nodes;
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/index_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "ortools/base/strong_vector.h"
#include "ortools/routing/types.h"

namespace operations_research {
namespace operations_research::routing {

/// Manager for any NodeIndex <-> variable index conversion. The routing solver
/// uses variable indices internally and through its API. These variable indices
Expand Down Expand Up @@ -117,6 +117,6 @@ class RoutingIndexManager {
int num_unique_depots_;
};

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_INDEX_MANAGER_H_
4 changes: 2 additions & 2 deletions ortools/routing/insertion_lns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "ortools/routing/utils.h"
#include "ortools/util/bitset.h"

namespace operations_research {
namespace operations_research::routing {

// FilteredHeuristicLocalSearchOperator

Expand Down Expand Up @@ -524,4 +524,4 @@ bool FilteredHeuristicExpensiveChainLNSOperator::
return false;
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/insertion_lns.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "ortools/routing/types.h"
#include "ortools/util/bitset.h"

namespace operations_research {
namespace operations_research::routing {

/// Class of operators using a RoutingFilteredHeuristic to insert unperformed
/// nodes after changes have been made to the current solution.
Expand Down Expand Up @@ -243,6 +243,6 @@ class FilteredHeuristicCloseNodesLNSOperator
SparseBitset<> changed_prevs_;
};

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_INSERTION_LNS_H_
4 changes: 2 additions & 2 deletions ortools/routing/lp_scheduling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#include "ortools/util/saturated_arithmetic.h"
#include "ortools/util/sorted_interval_list.h"

namespace operations_research {
namespace operations_research::routing {

namespace {

Expand Down Expand Up @@ -3421,4 +3421,4 @@ std::string RoutingCPSatWrapper::PrintModel() const {
return s;
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/lp_scheduling.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "ortools/sat/sat_parameters.pb.h"
#include "ortools/util/sorted_interval_list.h"

namespace operations_research {
namespace operations_research::routing {

// Classes to solve dimension cumul placement (aka scheduling) problems using
// linear programming.
Expand Down Expand Up @@ -1065,6 +1065,6 @@ std::vector<SlopeAndYIntercept> PiecewiseLinearFormulationToSlopeAndYIntercept(
PiecewiseLinearFormulation& pwl_function,
int index_start = 0, int index_end = -1);

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_LP_SCHEDULING_H_
4 changes: 2 additions & 2 deletions ortools/routing/neighborhoods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "ortools/routing/utils.h"
#include "ortools/util/saturated_arithmetic.h"

namespace operations_research {
namespace operations_research::routing {

MakeRelocateNeighborsOperator::MakeRelocateNeighborsOperator(
const std::vector<IntVar*>& vars,
Expand Down Expand Up @@ -1356,4 +1356,4 @@ bool ExchangeSubtrip::ExtractChainsFromDelivery(int64_t base_node,
return true;
}

} // namespace operations_research
} // namespace operations_research::routing
4 changes: 2 additions & 2 deletions ortools/routing/neighborhoods.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ortools/routing/types.h"
#include "ortools/util/bitset.h"

namespace operations_research {
namespace operations_research::routing {

/// Relocate neighborhood which moves chains of neighbors.
/// The operator starts by relocating a node n after a node m, then continues
Expand Down Expand Up @@ -748,6 +748,6 @@ class ExchangeSubtrip : public PathOperator {
std::vector<int64_t> path1_;
};

} // namespace operations_research
} // namespace operations_research::routing

#endif // OR_TOOLS_ROUTING_NEIGHBORHOODS_H_
Loading

0 comments on commit f2c2c77

Please sign in to comment.