Sync examples/cpp
This commit is contained in:
@@ -240,6 +240,8 @@ cc_binary(
|
||||
"//ortools/base:file",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base:timer",
|
||||
"//ortools/data:jobshop_scheduling_cc_proto",
|
||||
"//ortools/data:jobshop_scheduling_parser",
|
||||
"//ortools/sat:cp_model",
|
||||
"//ortools/sat:cp_model_solver",
|
||||
"//ortools/sat:disjunctive",
|
||||
@@ -249,8 +251,6 @@ cc_binary(
|
||||
"//ortools/sat:optimization",
|
||||
"//ortools/sat:precedences",
|
||||
"//ortools/sat:sat_solver",
|
||||
"//ortools/scheduling:jobshop_scheduling_cc_proto",
|
||||
"//ortools/scheduling:jobshop_scheduling_parser",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -467,8 +467,8 @@ cc_binary(
|
||||
deps = [
|
||||
"@com_google_absl//absl/time",
|
||||
"//ortools/base",
|
||||
"//ortools/linear_solver:linear_solver_cc_proto",
|
||||
"//ortools/linear_solver",
|
||||
"//ortools/linear_solver:linear_solver_cc_proto",
|
||||
"//ortools/lp_data:model_reader",
|
||||
"//ortools/lp_data:mps_reader",
|
||||
],
|
||||
@@ -478,8 +478,8 @@ cc_binary(
|
||||
name = "sports_scheduling_sat",
|
||||
srcs = ["sports_scheduling_sat.cc"],
|
||||
deps = [
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/base",
|
||||
"@com_google_absl//absl/strings",
|
||||
"//ortools/sat:cp_model",
|
||||
"//ortools/sat:model",
|
||||
],
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "examples/cpp/course_scheduling.h"
|
||||
#include "examples/cpp/course_scheduling.pb.h"
|
||||
#include "ortools/base/commandlineflags.h"
|
||||
#include "ortools/base/file.h"
|
||||
#include "ortools/base/timer.h"
|
||||
|
||||
ABSL_FLAG(std::string, input, "",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// http://en.wikipedia.org/wiki/Vehicle_routing_problem.
|
||||
// The variant which is tackled by this model includes a capacity dimension,
|
||||
// time windows and optional orders, with a penalty cost if orders are not
|
||||
// performed. For the sake of simplicty, orders are randomly located and
|
||||
// performed. For the sake of simplicity, orders are randomly located and
|
||||
// distances are computed using the Manhattan distance. Distances are assumed
|
||||
// to be in meters and times in seconds.
|
||||
|
||||
@@ -49,11 +49,10 @@ using operations_research::RoutingNodeIndex;
|
||||
using operations_research::RoutingSearchParameters;
|
||||
using operations_research::ServiceTimePlusTransition;
|
||||
|
||||
ABSL_FLAG(int, vrp_orders, 100, "Nodes in the problem.");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20,
|
||||
"Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(int, vrp_orders, 100, "Number of nodes in the problem");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20, "Number of vehicles in the problem");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
"Use deterministic random seeds");
|
||||
ABSL_FLAG(bool, vrp_use_same_vehicle_costs, false,
|
||||
"Use same vehicle costs in the routing model");
|
||||
ABSL_FLAG(std::string, routing_search_parameters, "",
|
||||
|
||||
@@ -392,8 +392,7 @@ void CreateMachines(
|
||||
// Source to nodes.
|
||||
circuit.AddArc(0, i + 1, cp_model.NewBoolVar());
|
||||
// Node to sink.
|
||||
const BoolVar sink_literal = cp_model.NewBoolVar();
|
||||
circuit.AddArc(i + 1, 0, sink_literal);
|
||||
circuit.AddArc(i + 1, 0, cp_model.NewBoolVar());
|
||||
|
||||
// Used to constrain the size of the tail interval.
|
||||
std::vector<BoolVar> literals;
|
||||
@@ -430,8 +429,8 @@ void CreateMachines(
|
||||
}
|
||||
|
||||
// Make sure the interval follow the circuit in time.
|
||||
// Note that we use the start + delay as this is more precise than
|
||||
// the non-propagated end.
|
||||
// Note that we use the start + duration + transition as this is more
|
||||
// precise than the non-propagated end.
|
||||
cp_model
|
||||
.AddLessOrEqual(tail.interval.StartExpr().AddConstant(
|
||||
tail.fixed_duration + transition),
|
||||
|
||||
Reference in New Issue
Block a user