14 #ifndef OR_TOOLS_CONSTRAINT_SOLVER_ROUTING_LP_SCHEDULING_H_ 15 #define OR_TOOLS_CONSTRAINT_SOLVER_ROUTING_LP_SCHEDULING_H_ 18 #include "ortools/glop/lp_solver.h" 31 visited_pickup_index_for_pair_(
32 dimension->model()->GetPickupAndDeliveryPairs().size(), -1) {}
39 const std::function<int64(int64)>& next_accessor,
40 glop::LinearProgram* linear_program,
41 glop::LPSolver* lp_solver,
42 std::vector<int64>* cumul_values, int64* cost,
43 int64* transit_cost,
bool clear_lp =
true);
45 bool Optimize(
const std::function<int64(int64)>& next_accessor,
46 glop::LinearProgram* linear_program, glop::LPSolver* lp_solver,
47 std::vector<int64>* cumul_values, int64* cost,
48 int64* transit_cost,
bool clear_lp =
true);
51 glop::LinearProgram* linear_program,
52 glop::LPSolver* lp_solver,
53 std::vector<int64>* cumul_values);
56 int vehicle,
const std::function<int64(int64)>& next_accessor,
57 glop::LinearProgram* linear_program, glop::LPSolver* lp_solver,
58 std::vector<int64>* cumul_values);
65 void InitOptimizer(glop::LinearProgram* linear_program);
71 bool SetRouteCumulConstraints(
72 int vehicle,
const std::function<int64(int64)>& next_accessor,
73 int64 cumul_offset,
bool optimize_costs,
74 glop::LinearProgram* linear_program, int64* route_transit_cost,
75 int64* route_cost_offset);
83 void SetGlobalConstraints(
bool optimize_costs,
84 glop::LinearProgram* linear_program);
86 bool FinalizeAndSolve(glop::LinearProgram* linear_program,
87 glop::LPSolver* lp_solver);
89 void SetCumulValuesFromLP(
const std::vector<glop::ColIndex>& cumul_variables,
90 int64 offset,
const glop::LPSolver& lp_solver,
91 std::vector<int64>* cumul_values);
99 bool PackRoutes(std::vector<int> vehicles,
100 glop::LinearProgram* linear_program,
101 glop::LPSolver* lp_solver);
104 std::vector<glop::ColIndex> current_route_cumul_variables_;
105 std::vector<glop::ColIndex> index_to_cumul_variable_;
106 glop::ColIndex max_end_cumul_;
107 glop::ColIndex min_start_cumul_;
108 std::vector<int64> visited_pickup_index_for_pair_;
125 const std::function<int64(int64)>& next_accessor,
126 int64* optimal_cost);
131 int vehicle,
const std::function<int64(int64)>& next_accessor,
132 int64* optimal_cost_without_transits);
139 const std::function<int64(int64)>& next_accessor,
140 std::vector<int64>* optimal_cumuls);
146 int vehicle,
const std::function<int64(int64)>& next_accessor,
147 std::vector<int64>* packed_cumuls);
154 std::vector<std::unique_ptr<glop::LPSolver>> lp_solver_;
155 std::vector<std::unique_ptr<glop::LinearProgram>> linear_program_;
168 const std::function<int64(int64)>& next_accessor,
169 int64* optimal_cost_without_transits);
174 bool ComputeCumuls(
const std::function<int64(int64)>& next_accessor,
175 std::vector<int64>* optimal_cumuls);
179 bool IsFeasible(
const std::function<int64(int64)>& next_accessor);
185 std::vector<int64>* packed_cumuls);
192 glop::LPSolver lp_solver_;
193 glop::LinearProgram linear_program_;
199 #endif // OR_TOOLS_CONSTRAINT_SOLVER_ROUTING_LP_SCHEDULING_H_ bool ComputePackedCumuls(const std::function< int64(int64)> &next_accessor, std::vector< int64 > *packed_cumuls)
LocalDimensionCumulOptimizer(const RoutingDimension *dimension)
const RoutingDimension * dimension() const
Dimensions represent quantities accumulated at nodes along the routes.
bool ComputeRouteCumuls(int vehicle, const std::function< int64(int64)> &next_accessor, std::vector< int64 > *optimal_cumuls)
bool ComputePackedRouteCumuls(int vehicle, const std::function< int64(int64)> &next_accessor, std::vector< int64 > *packed_cumuls)
bool Optimize(const std::function< int64(int64)> &next_accessor, glop::LinearProgram *linear_program, glop::LPSolver *lp_solver, std::vector< int64 > *cumul_values, int64 *cost, int64 *transit_cost, bool clear_lp=true)
bool OptimizeAndPack(const std::function< int64(int64)> &next_accessor, glop::LinearProgram *linear_program, glop::LPSolver *lp_solver, std::vector< int64 > *cumul_values)
const RoutingDimension * dimension() const
bool IsFeasible(const std::function< int64(int64)> &next_accessor)
GlobalDimensionCumulOptimizer(const RoutingDimension *dimension)
bool OptimizeAndPackSingleRoute(int vehicle, const std::function< int64(int64)> &next_accessor, glop::LinearProgram *linear_program, glop::LPSolver *lp_solver, std::vector< int64 > *cumul_values)
bool ComputeRouteCumulCostWithoutFixedTransits(int vehicle, const std::function< int64(int64)> &next_accessor, int64 *optimal_cost_without_transits)
bool ComputeRouteCumulCost(int vehicle, const std::function< int64(int64)> &next_accessor, int64 *optimal_cost)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
bool ComputeCumulCostWithoutFixedTransits(const std::function< int64(int64)> &next_accessor, int64 *optimal_cost_without_transits)
const RoutingDimension * dimension() const
DimensionCumulOptimizerCore(const RoutingDimension *dimension)
bool OptimizeSingleRoute(int vehicle, const std::function< int64(int64)> &next_accessor, glop::LinearProgram *linear_program, glop::LPSolver *lp_solver, std::vector< int64 > *cumul_values, int64 *cost, int64 *transit_cost, bool clear_lp=true)
bool ComputeCumuls(const std::function< int64(int64)> &next_accessor, std::vector< int64 > *optimal_cumuls)