Fix examples
This commit is contained in:
@@ -55,7 +55,7 @@ void RunConstraintProgrammingExample() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::GetFlag(FLAGS_logtostderr) = 1;
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
operations_research::RunConstraintProgrammingExample();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@
|
||||
#include "ortools/sat/cp_model.h"
|
||||
#include "ortools/sat/model.h"
|
||||
|
||||
DEFINE_int32(minsize, 0, "Minimum problem size.");
|
||||
DEFINE_int32(maxsize, 0, "Maximum problem size.");
|
||||
DEFINE_int32(model, 1,
|
||||
"Model type: 1 integer variables hard, 2 boolean variables, 3 "
|
||||
"boolean_variable soft");
|
||||
DEFINE_string(params, "", "Sat parameters.");
|
||||
ABSL_FLAG(int, minsize, 0, "Minimum problem size.");
|
||||
ABSL_FLAG(int, maxsize, 0, "Maximum problem size.");
|
||||
ABSL_FLAG(int, model, 1,
|
||||
"Model type: 1 integer variables hard, 2 boolean variables, 3 "
|
||||
"boolean_variable soft");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -294,7 +294,7 @@ void CostasBoolSoft(const int dim) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
int min = 1;
|
||||
int max = 10;
|
||||
|
||||
|
||||
@@ -48,16 +48,17 @@ using operations_research::RoutingSearchParameters;
|
||||
using operations_research::ServiceTimePlusTransition;
|
||||
using operations_research::Solver;
|
||||
|
||||
DEFINE_int32(vrp_orders, 100, "Nodes in the problem.");
|
||||
DEFINE_int32(vrp_vehicles, 20, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_int32(vrp_windows, 5, "Number of disjoint windows per node.");
|
||||
DEFINE_bool(vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_bool(vrp_use_same_vehicle_costs, false,
|
||||
"Use same vehicle costs in the routing model");
|
||||
DEFINE_string(routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
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_windows, 5, "Number of disjoint windows per node.");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"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, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
const char *kTime = "Time";
|
||||
const char *kCapacity = "Capacity";
|
||||
@@ -65,7 +66,7 @@ const int64 kMaxNodesPerGroup = 10;
|
||||
const int64 kSameVehicleCost = 1000;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_orders))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_vehicles))
|
||||
|
||||
@@ -47,15 +47,16 @@ using operations_research::RoutingNodeIndex;
|
||||
using operations_research::RoutingSearchParameters;
|
||||
using operations_research::ServiceTimePlusTransition;
|
||||
|
||||
DEFINE_int32(vrp_orders, 100, "Nodes in the problem.");
|
||||
DEFINE_int32(vrp_vehicles, 20, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_bool(vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_bool(vrp_use_same_vehicle_costs, false,
|
||||
"Use same vehicle costs in the routing model");
|
||||
DEFINE_string(routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(int, vrp_orders, 100, "Nodes in the problem.");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20,
|
||||
"Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"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, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
const char *kTime = "Time";
|
||||
const char *kCapacity = "Capacity";
|
||||
@@ -63,7 +64,7 @@ const int64 kMaxNodesPerGroup = 10;
|
||||
const int64 kSameVehicleCost = 1000;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_orders))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_vehicles))
|
||||
|
||||
@@ -56,19 +56,20 @@ using operations_research::RoutingSearchParameters;
|
||||
using operations_research::ServiceTimePlusTransition;
|
||||
using operations_research::Solver;
|
||||
|
||||
DEFINE_int32(vrp_orders, 100, "Nodes in the problem.");
|
||||
DEFINE_int32(vrp_vehicles, 20, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_bool(vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_string(routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(int, vrp_orders, 100, "Nodes in the problem.");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20,
|
||||
"Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
ABSL_FLAG(std::string, routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
const char *kTime = "Time";
|
||||
const char *kCapacity = "Capacity";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_orders))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_vehicles))
|
||||
|
||||
@@ -45,13 +45,14 @@ using operations_research::RoutingNodeIndex;
|
||||
using operations_research::RoutingSearchParameters;
|
||||
using operations_research::ServiceTimePlusTransition;
|
||||
|
||||
DEFINE_int32(vrp_orders, 100, "Nodes in the problem.");
|
||||
DEFINE_int32(vrp_vehicles, 20, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_bool(vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_string(routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(int, vrp_orders, 100, "Nodes in the problem.");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20,
|
||||
"Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
ABSL_FLAG(std::string, routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
const char *kTime = "Time";
|
||||
const char *kCapacity = "Capacity";
|
||||
@@ -64,7 +65,7 @@ bool IsRefuelNode(int64 node) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_orders))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_vehicles))
|
||||
|
||||
@@ -50,19 +50,20 @@ using operations_research::RoutingSearchParameters;
|
||||
using operations_research::ServiceTimePlusTransition;
|
||||
using operations_research::Solver;
|
||||
|
||||
DEFINE_int32(vrp_orders, 100, "Nodes in the problem.");
|
||||
DEFINE_int32(vrp_vehicles, 20, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_bool(vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_string(routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(int, vrp_orders, 100, "Nodes in the problem.");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20,
|
||||
"Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
ABSL_FLAG(std::string, routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
const char *kTime = "Time";
|
||||
const char *kCapacity = "Capacity";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_orders))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_vehicles))
|
||||
|
||||
@@ -49,20 +49,21 @@ using operations_research::RoutingSearchParameters;
|
||||
using operations_research::Solver;
|
||||
using operations_research::StopServiceTimePlusTransition;
|
||||
|
||||
DEFINE_int32(vrp_stops, 25, "Stop locations in the problem.");
|
||||
DEFINE_int32(vrp_orders_per_stop, 5, "Nodes for each stop.");
|
||||
DEFINE_int32(vrp_vehicles, 20, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_bool(vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_string(routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(int, vrp_stops, 25, "Stop locations in the problem.");
|
||||
ABSL_FLAG(int, vrp_orders_per_stop, 5, "Nodes for each stop.");
|
||||
ABSL_FLAG(int, vrp_vehicles, 20,
|
||||
"Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(bool, vrp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
ABSL_FLAG(std::string, routing_search_parameters, "",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
const char *kTime = "Time";
|
||||
const char *kCapacity = "Capacity";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_stops))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_vrp_orders_per_stop))
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/graph/linear_assignment.h"
|
||||
|
||||
DEFINE_bool(assignment_compare_hungarian, false,
|
||||
"Compare result and speed against Hungarian method.");
|
||||
DEFINE_string(assignment_problem_output_file, "",
|
||||
"Print the problem to this file in DIMACS format (after layout "
|
||||
"is optimized, if applicable).");
|
||||
DEFINE_bool(assignment_reverse_arcs, false,
|
||||
"Ignored if --assignment_static_graph=true. Use StarGraph "
|
||||
"if true, ForwardStarGraph if false.");
|
||||
DEFINE_bool(assignment_static_graph, true,
|
||||
"Use the ForwardStarStaticGraph representation, "
|
||||
"otherwise ForwardStarGraph or StarGraph according "
|
||||
"to --assignment_reverse_arcs.");
|
||||
ABSL_FLAG(bool, assignment_compare_hungarian, false,
|
||||
"Compare result and speed against Hungarian method.");
|
||||
ABSL_FLAG(std::string, assignment_problem_output_file, "",
|
||||
"Print the problem to this file in DIMACS format (after layout "
|
||||
"is optimized, if applicable).");
|
||||
ABSL_FLAG(bool, assignment_reverse_arcs, false,
|
||||
"Ignored if --assignment_static_graph=true. Use StarGraph "
|
||||
"if true, ForwardStarGraph if false.");
|
||||
ABSL_FLAG(bool, assignment_static_graph, true,
|
||||
"Use the ForwardStarStaticGraph representation, "
|
||||
"otherwise ForwardStarGraph or StarGraph according "
|
||||
"to --assignment_reverse_arcs.");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -186,8 +186,8 @@ int main(int argc, char *argv[]) {
|
||||
} else {
|
||||
usage = absl::StrFormat(kUsageTemplate, argv[0]);
|
||||
}
|
||||
gflags::SetUsageMessage(usage);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::SetProgramUsageMessage(usage);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
if (argc < 2) {
|
||||
LOG(FATAL) << usage;
|
||||
|
||||
@@ -40,18 +40,19 @@
|
||||
#include "ortools/constraint_solver/constraint_solveri.h"
|
||||
#include "ortools/util/bitset.h"
|
||||
|
||||
DEFINE_int32(symbols_per_card, 8, "Number of symbols per card.");
|
||||
DEFINE_int32(ls_seed, 1,
|
||||
"Seed for the random number generator (used by "
|
||||
"the Local Neighborhood Search).");
|
||||
DEFINE_bool(use_filter, true, "Use filter in the local search to prune moves.");
|
||||
DEFINE_int32(num_swaps, 4,
|
||||
"If num_swap > 0, the search for an optimal "
|
||||
"solution will be allowed to use an operator that swaps the "
|
||||
"symbols of up to num_swap pairs ((card1, symbol on card1), "
|
||||
"(card2, symbol on card2)).");
|
||||
DEFINE_int32(time_limit_in_ms, 60000,
|
||||
"Time limit for the global search in ms.");
|
||||
ABSL_FLAG(int, symbols_per_card, 8, "Number of symbols per card.");
|
||||
ABSL_FLAG(int, ls_seed, 1,
|
||||
"Seed for the random number generator (used by "
|
||||
"the Local Neighborhood Search).");
|
||||
ABSL_FLAG(bool, use_filter, true,
|
||||
"Use filter in the local search to prune moves.");
|
||||
ABSL_FLAG(int, num_swaps, 4,
|
||||
"If num_swap > 0, the search for an optimal "
|
||||
"solution will be allowed to use an operator that swaps the "
|
||||
"symbols of up to num_swap pairs ((card1, symbol on card1), "
|
||||
"(card2, symbol on card2)).");
|
||||
ABSL_FLAG(int, time_limit_in_ms, 60000,
|
||||
"Time limit for the global search in ms.");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -757,7 +758,7 @@ void SolveDobble(int num_cards, int num_symbols, int num_symbols_per_card) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
// These constants comes directly from the dobble game.
|
||||
// There are actually 55 cards, but we can create up to 57 cards.
|
||||
const int kSymbolsPerCard = absl::GetFlag(FLAGS_symbols_per_card);
|
||||
|
||||
@@ -81,7 +81,7 @@ void MaxFeasibleFlow() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::MinCostFlowOn4x4Matrix();
|
||||
operations_research::MaxFeasibleFlow();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -59,30 +59,31 @@
|
||||
#include "ortools/base/map_util.h"
|
||||
#include "ortools/constraint_solver/constraint_solver.h"
|
||||
|
||||
DEFINE_string(directory, "", "Specifies the directory of the data.");
|
||||
DEFINE_string(value_evaluator, "",
|
||||
"Specifies if a value evaluator will be used by the "
|
||||
"decision builder.");
|
||||
DEFINE_string(variable_evaluator, "",
|
||||
"Specifies if a variable evaluator will be used by the "
|
||||
"decision builder.");
|
||||
DEFINE_int32(time_limit_in_ms, 0, "Time limit in ms, <= 0 means no limit.");
|
||||
DEFINE_int32(choose_next_variable_strategy, 1,
|
||||
"Selection strategy for variable: "
|
||||
"1 = CHOOSE_FIRST_UNBOUND, "
|
||||
"2 = CHOOSE_MIN_SIZE_LOWEST_MIN, "
|
||||
"3 = CHOOSE_MIN_SIZE_HIGHEST_MAX, "
|
||||
"4 = CHOOSE_RANDOM, ");
|
||||
DEFINE_int32(restart, -1, "Parameter for constant restart monitor.");
|
||||
DEFINE_bool(find_components, false,
|
||||
"If possible, split the problem into independent sub-problems.");
|
||||
DEFINE_bool(luby, false,
|
||||
"Use luby restart monitor instead of constant restart monitor.");
|
||||
DEFINE_bool(log_search, true, "Create a search log.");
|
||||
DEFINE_bool(soft, false, "Use soft solver instead of hard solver.");
|
||||
DEFINE_bool(display_time, true,
|
||||
"Print how much time the solving process took.");
|
||||
DEFINE_bool(display_results, true, "Print the results of the solving process.");
|
||||
ABSL_FLAG(std::string, directory, "", "Specifies the directory of the data.");
|
||||
ABSL_FLAG(std::string, value_evaluator, "",
|
||||
"Specifies if a value evaluator will be used by the "
|
||||
"decision builder.");
|
||||
ABSL_FLAG(std::string, variable_evaluator, "",
|
||||
"Specifies if a variable evaluator will be used by the "
|
||||
"decision builder.");
|
||||
ABSL_FLAG(int, time_limit_in_ms, 0, "Time limit in ms, <= 0 means no limit.");
|
||||
ABSL_FLAG(int, choose_next_variable_strategy, 1,
|
||||
"Selection strategy for variable: "
|
||||
"1 = CHOOSE_FIRST_UNBOUND, "
|
||||
"2 = CHOOSE_MIN_SIZE_LOWEST_MIN, "
|
||||
"3 = CHOOSE_MIN_SIZE_HIGHEST_MAX, "
|
||||
"4 = CHOOSE_RANDOM, ");
|
||||
ABSL_FLAG(int, restart, -1, "Parameter for constant restart monitor.");
|
||||
ABSL_FLAG(bool, find_components, false,
|
||||
"If possible, split the problem into independent sub-problems.");
|
||||
ABSL_FLAG(bool, luby, false,
|
||||
"Use luby restart monitor instead of constant restart monitor.");
|
||||
ABSL_FLAG(bool, log_search, true, "Create a search log.");
|
||||
ABSL_FLAG(bool, soft, false, "Use soft solver instead of hard solver.");
|
||||
ABSL_FLAG(bool, display_time, true,
|
||||
"Print how much time the solving process took.");
|
||||
ABSL_FLAG(bool, display_results, true,
|
||||
"Print the results of the solving process.");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -856,7 +857,7 @@ void SolveProblem(const std::map<int, FapVariable> &variables,
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
CHECK(!absl::GetFlag(FLAGS_directory).empty())
|
||||
<< "Requires --directory=<directory name>";
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
#include "ortools/sat/cp_model.h"
|
||||
#include "ortools/sat/model.h"
|
||||
|
||||
DEFINE_bool(print, false, "If true, print the minimal solution.");
|
||||
DEFINE_int32(
|
||||
size, 0,
|
||||
ABSL_FLAG(bool, print, false, "If true, print the minimal solution.");
|
||||
ABSL_FLAG(
|
||||
int, size, 0,
|
||||
"Size of the problem. If equal to 0, will test several increasing sizes.");
|
||||
DEFINE_string(params, "", "Sat parameters.");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters.");
|
||||
|
||||
static const int kBestSolutions[] = {0, 1, 3, 6, 11, 17, 25, 34, 44, 55, 72, 85,
|
||||
// just for the optimistics ones, the rest:
|
||||
@@ -116,7 +116,7 @@ void GolombRuler(int size) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
if (absl::GetFlag(FLAGS_size) != 0) {
|
||||
operations_research::sat::GolombRuler(absl::GetFlag(FLAGS_size));
|
||||
} else {
|
||||
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_log_prefix, false);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::RunAllExamples();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
#include "ortools/sat/cp_model.pb.h"
|
||||
#include "ortools/sat/model.h"
|
||||
|
||||
DEFINE_string(input, "", "Jobshop data file name.");
|
||||
DEFINE_string(params, "", "Sat parameters in text proto format.");
|
||||
DEFINE_bool(use_optional_variables, true,
|
||||
"Whether we use optional variables for bounds of an optional "
|
||||
"interval or not.");
|
||||
DEFINE_bool(display_model, false, "Display jobshop proto before solving.");
|
||||
DEFINE_bool(display_sat_model, false, "Display sat proto before solving.");
|
||||
ABSL_FLAG(std::string, input, "", "Jobshop data file name.");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters in text proto format.");
|
||||
ABSL_FLAG(bool, use_optional_variables, true,
|
||||
"Whether we use optional variables for bounds of an optional "
|
||||
"interval or not.");
|
||||
ABSL_FLAG(bool, display_model, false, "Display jobshop proto before solving.");
|
||||
ABSL_FLAG(bool, display_sat_model, false, "Display sat proto before solving.");
|
||||
|
||||
using operations_research::data::jssp::Job;
|
||||
using operations_research::data::jssp::JobPrecedence;
|
||||
@@ -381,7 +381,7 @@ void Solve(const JsspInputProblem &problem) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void AnotherAssignment() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::AssignmentOn4x4Matrix();
|
||||
operations_research::AnotherAssignment();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -115,7 +115,7 @@ int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
absl::SetFlag(&FLAGS_log_prefix, false);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::RunAllExamples();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void RunAllExamples() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::RunAllExamples();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "ortools/sat/cp_model.h"
|
||||
#include "ortools/sat/model.h"
|
||||
|
||||
DEFINE_int32(size, 7, "Size of the magic square");
|
||||
DEFINE_string(params, "", "Sat paramters");
|
||||
ABSL_FLAG(int, size, 7, "Size of the magic square");
|
||||
ABSL_FLAG(std::string, params, "", "Sat paramters");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -94,7 +94,7 @@ void MagicSquare(int size) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::sat::MagicSquare(absl::GetFlag(FLAGS_size));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void SolveMaxFlow() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::GetFlag(FLAGS_logtostderr) = 1;
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
operations_research::SolveMaxFlow();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void SolveMinCostFlow() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::GetFlag(FLAGS_logtostderr) = 1;
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
operations_research::SolveMinCostFlow();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -35,19 +35,21 @@
|
||||
#include "ortools/util/file_util.h"
|
||||
#include "ortools/util/proto_tools.h"
|
||||
|
||||
DEFINE_bool(mps_dump_problem, false, "Dumps problem in readable form.");
|
||||
DEFINE_bool(mps_solve, true, "Solves problem.");
|
||||
DEFINE_bool(mps_terse_result, false,
|
||||
"Displays the result in form of a single CSV line.");
|
||||
DEFINE_bool(mps_verbose_result, true, "Displays the result in verbose form.");
|
||||
DEFINE_bool(mps_display_full_path, true,
|
||||
"Displays the full path of the input file in the result line.");
|
||||
DEFINE_string(input, "", "File pattern for problems to be optimized.");
|
||||
DEFINE_string(params_file, "", "Path to a GlopParameters file in text format.");
|
||||
DEFINE_string(params, "",
|
||||
"GlopParameters in text format. If --params_file was "
|
||||
"also specified, the --params will be merged onto "
|
||||
"them (i.e. in case of conflicts, --params wins)");
|
||||
ABSL_FLAG(bool, mps_dump_problem, false, "Dumps problem in readable form.");
|
||||
ABSL_FLAG(bool, mps_solve, true, "Solves problem.");
|
||||
ABSL_FLAG(bool, mps_terse_result, false,
|
||||
"Displays the result in form of a single CSV line.");
|
||||
ABSL_FLAG(bool, mps_verbose_result, true,
|
||||
"Displays the result in verbose form.");
|
||||
ABSL_FLAG(bool, mps_display_full_path, true,
|
||||
"Displays the full path of the input file in the result line.");
|
||||
ABSL_FLAG(std::string, input, "", "File pattern for problems to be optimized.");
|
||||
ABSL_FLAG(std::string, params_file, "",
|
||||
"Path to a GlopParameters file in text format.");
|
||||
ABSL_FLAG(std::string, params, "",
|
||||
"GlopParameters in text format. If --params_file was "
|
||||
"also specified, the --params will be merged onto "
|
||||
"them (i.e. in case of conflicts, --params wins)");
|
||||
|
||||
using google::protobuf::TextFormat;
|
||||
using operations_research::FullProtocolMessageAsString;
|
||||
@@ -78,7 +80,7 @@ void ReadGlopParameters(GlopParameters *parameters) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
GlopParameters parameters;
|
||||
ReadGlopParameters(¶meters);
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/sat/cp_model.h"
|
||||
|
||||
DEFINE_int32(size, 16, "scaling factor of the model");
|
||||
DEFINE_string(params, "", "Sat parameters");
|
||||
ABSL_FLAG(int, size, 16, "scaling factor of the model");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -107,7 +107,7 @@ void MultiKnapsackSat(int scaling, const std::string ¶ms) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::sat::MultiKnapsackSat(absl::GetFlag(FLAGS_size),
|
||||
absl::GetFlag(FLAGS_params));
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -45,41 +45,41 @@
|
||||
#include "ortools/util/time_limit.h"
|
||||
|
||||
// ----- Data Generator -----
|
||||
DEFINE_int32(clients, 0,
|
||||
"Number of network clients nodes. If equal to zero, "
|
||||
"then all backbones nodes are also client nodes.");
|
||||
DEFINE_int32(backbones, 0, "Number of backbone nodes");
|
||||
DEFINE_int32(demands, 0, "Number of network demands.");
|
||||
DEFINE_int32(traffic_min, 0, "Min traffic of a demand.");
|
||||
DEFINE_int32(traffic_max, 0, "Max traffic of a demand.");
|
||||
DEFINE_int32(min_client_degree, 0,
|
||||
"Min number of connections from a client to the backbone.");
|
||||
DEFINE_int32(max_client_degree, 0,
|
||||
"Max number of connections from a client to the backbone.");
|
||||
DEFINE_int32(min_backbone_degree, 0,
|
||||
"Min number of connections from a backbone node to the rest of "
|
||||
"the backbone nodes.");
|
||||
DEFINE_int32(max_backbone_degree, 0,
|
||||
"Max number of connections from a backbone node to the rest of "
|
||||
"the backbone nodes.");
|
||||
DEFINE_int32(max_capacity, 0, "Max traffic on any arc.");
|
||||
DEFINE_int32(fixed_charge_cost, 0, "Fixed charged cost when using an arc.");
|
||||
DEFINE_int32(seed, 0, "Random seed");
|
||||
ABSL_FLAG(int, clients, 0,
|
||||
"Number of network clients nodes. If equal to zero, "
|
||||
"then all backbones nodes are also client nodes.");
|
||||
ABSL_FLAG(int, backbones, 0, "Number of backbone nodes");
|
||||
ABSL_FLAG(int, demands, 0, "Number of network demands.");
|
||||
ABSL_FLAG(int, traffic_min, 0, "Min traffic of a demand.");
|
||||
ABSL_FLAG(int, traffic_max, 0, "Max traffic of a demand.");
|
||||
ABSL_FLAG(int, min_client_degree, 0,
|
||||
"Min number of connections from a client to the backbone.");
|
||||
ABSL_FLAG(int, max_client_degree, 0,
|
||||
"Max number of connections from a client to the backbone.");
|
||||
ABSL_FLAG(int, min_backbone_degree, 0,
|
||||
"Min number of connections from a backbone node to the rest of "
|
||||
"the backbone nodes.");
|
||||
ABSL_FLAG(int, max_backbone_degree, 0,
|
||||
"Max number of connections from a backbone node to the rest of "
|
||||
"the backbone nodes.");
|
||||
ABSL_FLAG(int, max_capacity, 0, "Max traffic on any arc.");
|
||||
ABSL_FLAG(int, fixed_charge_cost, 0, "Fixed charged cost when using an arc.");
|
||||
ABSL_FLAG(int, seed, 0, "Random seed");
|
||||
|
||||
// ----- CP Model -----
|
||||
DEFINE_double(comfort_zone, 0.85,
|
||||
"Above this limit in 1/1000th, the link is said to be "
|
||||
"congestioned.");
|
||||
DEFINE_int32(extra_hops, 6,
|
||||
"When creating all paths for a demand, we look at paths with "
|
||||
"maximum length 'shortest path + extra_hops'");
|
||||
DEFINE_int32(max_paths, 1200, "Max number of possible paths for a demand.");
|
||||
ABSL_FLAG(double, comfort_zone, 0.85,
|
||||
"Above this limit in 1/1000th, the link is said to be "
|
||||
"congestioned.");
|
||||
ABSL_FLAG(int, extra_hops, 6,
|
||||
"When creating all paths for a demand, we look at paths with "
|
||||
"maximum length 'shortest path + extra_hops'");
|
||||
ABSL_FLAG(int, max_paths, 1200, "Max number of possible paths for a demand.");
|
||||
|
||||
// ----- Reporting -----
|
||||
DEFINE_bool(print_model, false, "Print details of the model.");
|
||||
ABSL_FLAG(bool, print_model, false, "Print details of the model.");
|
||||
|
||||
// ----- Sat parameters -----
|
||||
DEFINE_string(params, "", "Sat parameters.");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -664,7 +664,7 @@ class NetworkRoutingSolver {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::sat::NetworkRoutingData data;
|
||||
operations_research::sat::NetworkRoutingDataBuilder builder;
|
||||
builder.BuildModelFromParameters(
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
#include "ortools/base/map_util.h"
|
||||
#include "ortools/constraint_solver/constraint_solveri.h"
|
||||
|
||||
DEFINE_bool(print, false, "If true, print one of the solution.");
|
||||
DEFINE_bool(print_all, false, "If true, print all the solutions.");
|
||||
DEFINE_int32(nb_loops, 1,
|
||||
"Number of solving loops to perform, for performance timing.");
|
||||
DEFINE_int32(
|
||||
size, 0,
|
||||
ABSL_FLAG(bool, print, false, "If true, print one of the solution.");
|
||||
ABSL_FLAG(bool, print_all, false, "If true, print all the solutions.");
|
||||
ABSL_FLAG(int, nb_loops, 1,
|
||||
"Number of solving loops to perform, for performance timing.");
|
||||
ABSL_FLAG(
|
||||
int, size, 0,
|
||||
"Size of the problem. If equal to 0, will test several increasing sizes.");
|
||||
DEFINE_bool(use_symmetry, false, "Use Symmetry Breaking methods");
|
||||
DECLARE_bool(cp_disable_solve);
|
||||
ABSL_FLAG(bool, use_symmetry, false, "Use Symmetry Breaking methods");
|
||||
ABSL_DECLARE_FLAG(bool, cp_disable_solve);
|
||||
|
||||
static const int kNumSolutions[] = {
|
||||
1, 0, 0, 2, 10, 4, 40, 92, 352, 724, 2680, 14200, 73712, 365596, 2279184};
|
||||
@@ -268,7 +268,7 @@ void NQueens(int size) {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
if (absl::GetFlag(FLAGS_size) != 0) {
|
||||
operations_research::NQueens(absl::GetFlag(FLAGS_size));
|
||||
} else {
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/graph/linear_assignment.h"
|
||||
|
||||
DEFINE_bool(assignment_maximize_cost, false,
|
||||
"Negate costs so a max-cost assignment is found.");
|
||||
DEFINE_bool(assignment_optimize_layout, true,
|
||||
"Optimize graph layout for speed.");
|
||||
ABSL_FLAG(bool, assignment_maximize_cost, false,
|
||||
"Negate costs so a max-cost assignment is found.");
|
||||
ABSL_FLAG(bool, assignment_optimize_layout, true,
|
||||
"Optimize graph layout for speed.");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
|
||||
@@ -52,17 +52,17 @@
|
||||
#include "ortools/constraint_solver/routing_parameters.h"
|
||||
#include "ortools/constraint_solver/routing_parameters.pb.h"
|
||||
|
||||
DEFINE_string(pdp_file, "",
|
||||
"File containing the Pickup and Delivery Problem to solve.");
|
||||
DEFINE_int32(pdp_force_vehicles, 0,
|
||||
"Force the number of vehicles used (maximum number of routes.");
|
||||
DEFINE_bool(reduce_vehicle_cost_model, true,
|
||||
"Overrides the homonymous field of "
|
||||
"DefaultRoutingModelParameters().");
|
||||
DEFINE_string(routing_search_parameters,
|
||||
"first_solution_strategy:ALL_UNPERFORMED",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(std::string, pdp_file, "",
|
||||
"File containing the Pickup and Delivery Problem to solve.");
|
||||
ABSL_FLAG(int, pdp_force_vehicles, 0,
|
||||
"Force the number of vehicles used (maximum number of routes.");
|
||||
ABSL_FLAG(bool, reduce_vehicle_cost_model, true,
|
||||
"Overrides the homonymous field of "
|
||||
"DefaultRoutingModelParameters().");
|
||||
ABSL_FLAG(std::string, routing_search_parameters,
|
||||
"first_solution_strategy:ALL_UNPERFORMED",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -390,7 +390,7 @@ bool LoadAndSolve(const std::string &pdp_file,
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::RoutingModelParameters model_parameters =
|
||||
operations_research::DefaultRoutingModelParameters();
|
||||
model_parameters.set_reduce_vehicle_cost_model(
|
||||
|
||||
@@ -38,19 +38,19 @@
|
||||
#include "ortools/constraint_solver/routing_parameters.h"
|
||||
#include "ortools/constraint_solver/routing_parameters.pb.h"
|
||||
|
||||
DEFINE_int32(tsp_size, 10, "Size of Traveling Salesman Problem instance.");
|
||||
DEFINE_bool(tsp_use_random_matrix, true, "Use random cost matrix.");
|
||||
DEFINE_int32(tsp_random_forbidden_connections, 0,
|
||||
"Number of random forbidden connections.");
|
||||
DEFINE_bool(tsp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
DEFINE_string(routing_search_parameters,
|
||||
"local_search_operators {"
|
||||
" use_path_lns:BOOL_TRUE"
|
||||
" use_inactive_lns:BOOL_TRUE"
|
||||
"}",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
ABSL_FLAG(int, tsp_size, 10, "Size of Traveling Salesman Problem instance.");
|
||||
ABSL_FLAG(bool, tsp_use_random_matrix, true, "Use random cost matrix.");
|
||||
ABSL_FLAG(int, tsp_random_forbidden_connections, 0,
|
||||
"Number of random forbidden connections.");
|
||||
ABSL_FLAG(bool, tsp_use_deterministic_random_seed, false,
|
||||
"Use deterministic random seeds.");
|
||||
ABSL_FLAG(std::string, routing_search_parameters,
|
||||
"local_search_operators {"
|
||||
" use_path_lns:BOOL_TRUE"
|
||||
" use_inactive_lns:BOOL_TRUE"
|
||||
"}",
|
||||
"Text proto RoutingSearchParameters (possibly partial) that will "
|
||||
"override the DefaultRoutingSearchParameters()");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -179,7 +179,7 @@ void Tsp() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::Tsp();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#include "ortools/sat/boolean_problem.pb.h"
|
||||
#include "ortools/sat/cp_model.pb.h"
|
||||
|
||||
DEFINE_bool(wcnf_use_strong_slack, true,
|
||||
"If true, when we add a slack variable to reify a soft clause, we "
|
||||
"enforce the fact that when it is true, the clause must be false.");
|
||||
ABSL_FLAG(bool, wcnf_use_strong_slack, true,
|
||||
"If true, when we add a slack variable to reify a soft clause, we "
|
||||
"enforce the fact that when it is true, the clause must be false.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
|
||||
@@ -51,77 +51,77 @@
|
||||
#include "ortools/util/file_util.h"
|
||||
#include "ortools/util/time_limit.h"
|
||||
|
||||
DEFINE_string(
|
||||
input, "",
|
||||
ABSL_FLAG(
|
||||
std::string, input, "",
|
||||
"Required: input file of the problem to solve. Many format are supported:"
|
||||
".cnf (sat, max-sat, weighted max-sat), .opb (pseudo-boolean sat/optim) "
|
||||
"and by default the LinearBooleanProblem proto (binary or text).");
|
||||
|
||||
DEFINE_string(
|
||||
output, "",
|
||||
ABSL_FLAG(
|
||||
std::string, output, "",
|
||||
"If non-empty, write the input problem as a LinearBooleanProblem proto to "
|
||||
"this file. By default it uses the binary format except if the file "
|
||||
"extension is '.txt'. If the problem is SAT, a satisfiable assignment is "
|
||||
"also written to the file.");
|
||||
|
||||
DEFINE_bool(output_cnf_solution, false,
|
||||
"If true and the problem was solved to optimality, this output "
|
||||
"the solution to stdout in cnf form.\n");
|
||||
ABSL_FLAG(bool, output_cnf_solution, false,
|
||||
"If true and the problem was solved to optimality, this output "
|
||||
"the solution to stdout in cnf form.\n");
|
||||
|
||||
DEFINE_string(params, "",
|
||||
"Parameters for the sat solver in a text format of the "
|
||||
"SatParameters proto, example: --params=use_conflicts:true.");
|
||||
ABSL_FLAG(std::string, params, "",
|
||||
"Parameters for the sat solver in a text format of the "
|
||||
"SatParameters proto, example: --params=use_conflicts:true.");
|
||||
|
||||
DEFINE_bool(strict_validity, false,
|
||||
"If true, stop if the given input is invalid (duplicate literals, "
|
||||
"out of range, zero cofficients, etc.)");
|
||||
ABSL_FLAG(bool, strict_validity, false,
|
||||
"If true, stop if the given input is invalid (duplicate literals, "
|
||||
"out of range, zero cofficients, etc.)");
|
||||
|
||||
DEFINE_string(
|
||||
lower_bound, "",
|
||||
ABSL_FLAG(
|
||||
std::string, lower_bound, "",
|
||||
"If not empty, look for a solution with an objective value >= this bound.");
|
||||
|
||||
DEFINE_string(
|
||||
upper_bound, "",
|
||||
ABSL_FLAG(
|
||||
std::string, upper_bound, "",
|
||||
"If not empty, look for a solution with an objective value <= this bound.");
|
||||
|
||||
DEFINE_bool(fu_malik, false,
|
||||
"If true, search the optimal solution with the Fu & Malik algo.");
|
||||
ABSL_FLAG(bool, fu_malik, false,
|
||||
"If true, search the optimal solution with the Fu & Malik algo.");
|
||||
|
||||
DEFINE_bool(wpm1, false,
|
||||
"If true, search the optimal solution with the WPM1 algo.");
|
||||
ABSL_FLAG(bool, wpm1, false,
|
||||
"If true, search the optimal solution with the WPM1 algo.");
|
||||
|
||||
DEFINE_bool(qmaxsat, false,
|
||||
"If true, search the optimal solution with a linear scan and "
|
||||
" the cardinality encoding used in qmaxsat.");
|
||||
ABSL_FLAG(bool, qmaxsat, false,
|
||||
"If true, search the optimal solution with a linear scan and "
|
||||
" the cardinality encoding used in qmaxsat.");
|
||||
|
||||
DEFINE_bool(core_enc, false,
|
||||
"If true, search the optimal solution with the core-based "
|
||||
"cardinality encoding algo.");
|
||||
ABSL_FLAG(bool, core_enc, false,
|
||||
"If true, search the optimal solution with the core-based "
|
||||
"cardinality encoding algo.");
|
||||
|
||||
DEFINE_bool(linear_scan, false,
|
||||
"If true, search the optimal solution with the linear scan algo.");
|
||||
ABSL_FLAG(bool, linear_scan, false,
|
||||
"If true, search the optimal solution with the linear scan algo.");
|
||||
|
||||
DEFINE_int32(randomize, 500,
|
||||
"If positive, solve that many times the problem with a random "
|
||||
"decision heuristic before trying to optimize it.");
|
||||
ABSL_FLAG(int, randomize, 500,
|
||||
"If positive, solve that many times the problem with a random "
|
||||
"decision heuristic before trying to optimize it.");
|
||||
|
||||
DEFINE_bool(use_symmetry, false,
|
||||
"If true, find and exploit the eventual symmetries "
|
||||
"of the problem.");
|
||||
ABSL_FLAG(bool, use_symmetry, false,
|
||||
"If true, find and exploit the eventual symmetries "
|
||||
"of the problem.");
|
||||
|
||||
DEFINE_bool(presolve, true,
|
||||
"Only work on pure SAT problem. If true, presolve the problem.");
|
||||
ABSL_FLAG(bool, presolve, true,
|
||||
"Only work on pure SAT problem. If true, presolve the problem.");
|
||||
|
||||
DEFINE_bool(probing, false, "If true, presolve the problem using probing.");
|
||||
ABSL_FLAG(bool, probing, false, "If true, presolve the problem using probing.");
|
||||
|
||||
DEFINE_bool(use_cp_model, true,
|
||||
"Whether to interpret everything as a CpModelProto or "
|
||||
"to read by default a CpModelProto.");
|
||||
ABSL_FLAG(bool, use_cp_model, true,
|
||||
"Whether to interpret everything as a CpModelProto or "
|
||||
"to read by default a CpModelProto.");
|
||||
|
||||
DEFINE_bool(reduce_memory_usage, false,
|
||||
"If true, do not keep a copy of the original problem in memory."
|
||||
"This reduce the memory usage, but disable the solution cheking at "
|
||||
"the end.");
|
||||
ABSL_FLAG(bool, reduce_memory_usage, false,
|
||||
"If true, do not keep a copy of the original problem in memory."
|
||||
"This reduce the memory usage, but disable the solution cheking at "
|
||||
"the end.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -445,9 +445,8 @@ int main(int argc, char **argv) {
|
||||
// By default, we want to show how the solver progress. Note that this needs
|
||||
// to be set before InitGoogle() which has the nice side-effect of allowing
|
||||
// the user to override it.
|
||||
// absl::SetFlag(&FLAGS_vmodule, "*cp_model*=1");
|
||||
gflags::SetUsageMessage(kUsage);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::SetProgramUsageMessage(kUsage);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::SetFlag(&FLAGS_alsologtostderr, true);
|
||||
return operations_research::sat::Run();
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include "ortools/sat/cp_model.h"
|
||||
#include "ortools/sat/model.h"
|
||||
|
||||
DEFINE_string(input, "", "Input file.");
|
||||
DEFINE_string(params, "", "Sat parameters in text proto format.");
|
||||
ABSL_FLAG(std::string, input, "", "Input file.");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters in text proto format.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -302,7 +302,7 @@ void LoadAndSolve(const std::string &file_name) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
}
|
||||
|
||||
@@ -31,39 +31,42 @@
|
||||
#include "ortools/lp_data/proto_utils.h"
|
||||
#include "ortools/util/file_util.h"
|
||||
|
||||
DEFINE_string(input, "", "REQUIRED: Input file name.");
|
||||
DEFINE_string(solver, "glop",
|
||||
"The solver to use: bop, cbc, clp, glop, glpk_lp, glpk_mip, "
|
||||
"gurobi_lp, gurobi_mip, scip, knapsack.");
|
||||
ABSL_FLAG(std::string, input, "", "REQUIRED: Input file name.");
|
||||
ABSL_FLAG(std::string, solver, "glop",
|
||||
"The solver to use: bop, cbc, clp, glop, glpk_lp, glpk_mip, "
|
||||
"gurobi_lp, gurobi_mip, scip, knapsack.");
|
||||
|
||||
DEFINE_int32(num_threads, 1,
|
||||
"Number of threads to use by the underlying solver.");
|
||||
DEFINE_string(params_file, "",
|
||||
"Solver specific parameters file. "
|
||||
"If this flag is set, the --params flag is ignored.");
|
||||
DEFINE_string(params, "", "Solver specific parameters");
|
||||
DEFINE_int64(time_limit_ms, 0,
|
||||
"If strictly positive, specifies a limit in ms on the solving "
|
||||
"time. Otherwise, no time limit will be imposed.");
|
||||
ABSL_FLAG(int, num_threads, 1,
|
||||
"Number of threads to use by the underlying solver.");
|
||||
ABSL_FLAG(std::string, params_file, "",
|
||||
"Solver specific parameters file. "
|
||||
"If this flag is set, the --params flag is ignored.");
|
||||
ABSL_FLAG(std::string, params, "", "Solver specific parameters");
|
||||
ABSL_FLAG(int64, time_limit_ms, 0,
|
||||
"If strictly positive, specifies a limit in ms on the solving "
|
||||
"time. Otherwise, no time limit will be imposed.");
|
||||
|
||||
DEFINE_string(output_csv, "",
|
||||
"If non-empty, write the returned solution in csv format with "
|
||||
"each line formed by a variable name and its value.");
|
||||
ABSL_FLAG(std::string, output_csv, "",
|
||||
"If non-empty, write the returned solution in csv format with "
|
||||
"each line formed by a variable name and its value.");
|
||||
|
||||
DEFINE_string(dump_format, "text",
|
||||
"Format in which to dump protos (if flags --dump_model, "
|
||||
"--dump_request, or --dump_response are used). Possible values: "
|
||||
"'text', 'binary', 'json' which correspond to text proto format "
|
||||
"binary proto format, and json. If 'binary' or 'json' are used, "
|
||||
"we append '.bin' and '.json' to file names.");
|
||||
ABSL_FLAG(std::string, dump_format, "text",
|
||||
"Format in which to dump protos (if flags --dump_model, "
|
||||
"--dump_request, or --dump_response are used). Possible values: "
|
||||
"'text', 'binary', 'json' which correspond to text proto format "
|
||||
"binary proto format, and json. If 'binary' or 'json' are used, "
|
||||
"we append '.bin' and '.json' to file names.");
|
||||
|
||||
DEFINE_bool(dump_gzip, false,
|
||||
"Whether to gzip dumped protos. Appends .gz to their name.");
|
||||
DEFINE_string(dump_model, "", "If non-empty, dumps MPModelProto there.");
|
||||
DEFINE_string(dump_request, "", "If non-empty, dumps MPModelRequest there.");
|
||||
DEFINE_string(dump_response, "", "If non-empty, dumps MPModelResponse there.");
|
||||
ABSL_FLAG(bool, dump_gzip, false,
|
||||
"Whether to gzip dumped protos. Appends .gz to their name.");
|
||||
ABSL_FLAG(std::string, dump_model, "",
|
||||
"If non-empty, dumps MPModelProto there.");
|
||||
ABSL_FLAG(std::string, dump_request, "",
|
||||
"If non-empty, dumps MPModelRequest there.");
|
||||
ABSL_FLAG(std::string, dump_response, "",
|
||||
"If non-empty, dumps MPModelResponse there.");
|
||||
|
||||
DECLARE_bool(verify_solution); // Defined in ./linear_solver.cc
|
||||
ABSL_DECLARE_FLAG(bool, verify_solution); // Defined in ./linear_solver.cc
|
||||
|
||||
static const char kUsageStr[] =
|
||||
"Run MPSolver on the given input file. Many formats are supported: \n"
|
||||
@@ -258,7 +261,7 @@ bool Run() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, /*remove_flags=*/true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK(!absl::GetFlag(FLAGS_input).empty()) << "--input is required";
|
||||
operations_research::Run();
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
#include "ortools/sat/cp_model.h"
|
||||
|
||||
// Problem main flags.
|
||||
DEFINE_int32(num_teams, 10, "Number of teams in the problem.");
|
||||
DEFINE_string(params, "", "Sat parameters.");
|
||||
ABSL_FLAG(int, num_teams, 10, "Number of teams in the problem.");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -317,8 +317,8 @@ static const char kUsage[] =
|
||||
"There is no output besides the debug LOGs of the solver.";
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
gflags::SetUsageMessage(kUsage);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::SetProgramUsageMessage(kUsage);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_EQ(0, absl::GetFlag(FLAGS_num_teams) % 2)
|
||||
<< "The number of teams must be even";
|
||||
CHECK_GE(absl::GetFlag(FLAGS_num_teams), 2) << "At least 2 teams";
|
||||
|
||||
@@ -294,7 +294,7 @@ void RunStiglerDietExample() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::GetFlag(FLAGS_logtostderr) = 1;
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
operations_research::RunStiglerDietExample();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/linear_solver/linear_solver.h"
|
||||
|
||||
DEFINE_bool(colgen_verbose, false, "print verbosely");
|
||||
DEFINE_bool(colgen_complete, false, "generate all columns initially");
|
||||
DEFINE_int32(colgen_max_iterations, 500, "max iterations");
|
||||
DEFINE_string(colgen_solver, "glop", "solver - glop (default) or clp");
|
||||
DEFINE_int32(colgen_instance, -1, "Which instance to solve (0 - 9)");
|
||||
ABSL_FLAG(bool, colgen_verbose, false, "print verbosely");
|
||||
ABSL_FLAG(bool, colgen_complete, false, "generate all columns initially");
|
||||
ABSL_FLAG(int, colgen_max_iterations, 500, "max iterations");
|
||||
ABSL_FLAG(std::string, colgen_solver, "glop", "solver - glop (default) or clp");
|
||||
ABSL_FLAG(int, colgen_instance, -1, "Which instance to solve (0 - 9)");
|
||||
|
||||
namespace operations_research {
|
||||
// ---------- Data Instances ----------
|
||||
@@ -602,7 +602,7 @@ int main(int argc, char **argv) {
|
||||
usage += " --colgen_max_iterations <n> max columns to generate\n";
|
||||
usage += " --colgen_complete generate all columns at start\n";
|
||||
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
operations_research::MPSolver::OptimizationProblemType solver_type;
|
||||
bool found = false;
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include "ortools/base/random.h"
|
||||
#include "ortools/linear_solver/linear_solver.h"
|
||||
|
||||
DEFINE_int32(verbose, 0, "Verbosity level.");
|
||||
DEFINE_int32(facilities, 20, "Candidate facilities to consider.");
|
||||
DEFINE_int32(clients, 100, "Clients to serve.");
|
||||
DEFINE_double(fix_cost, 5000, "Cost of opening a facility.");
|
||||
ABSL_FLAG(int, verbose, 0, "Verbosity level.");
|
||||
ABSL_FLAG(int, facilities, 20, "Candidate facilities to consider.");
|
||||
ABSL_FLAG(int, clients, 100, "Clients to serve.");
|
||||
ABSL_FLAG(double, fix_cost, 5000, "Cost of opening a facility.");
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -221,17 +221,17 @@ void RunAllExamples(int32 facilities, int32 clients, double fix_cost) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
gflags::SetUsageMessage(
|
||||
absl::SetProgramUsageMessage(
|
||||
std::string("This program solve a (randomly generated)\n") +
|
||||
std::string("Uncapacitated Facility Location Problem. Sample Usage:\n"));
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_facilities))
|
||||
<< "Specify an instance size greater than 0.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_clients))
|
||||
<< "Specify a non-null client size.";
|
||||
CHECK_LT(0, absl::GetFlag(FLAGS_fix_cost))
|
||||
<< "Specify a non-null client size.";
|
||||
absl::GetFlag(FLAGS_logtostderr) = 1;
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
operations_research::RunAllExamples(absl::GetFlag(FLAGS_facilities),
|
||||
absl::GetFlag(FLAGS_clients),
|
||||
absl::GetFlag(FLAGS_fix_cost));
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
#include "ortools/sat/cp_model.h"
|
||||
#include "ortools/sat/model.h"
|
||||
|
||||
DEFINE_string(input, "examples/data/weighted_tardiness/wt40.txt",
|
||||
"wt data file name.");
|
||||
DEFINE_int32(size, 40, "Size of the problem in the wt file.");
|
||||
DEFINE_int32(n, 28, "1-based instance number in the wt file.");
|
||||
DEFINE_string(params, "", "Sat parameters in text proto format.");
|
||||
DEFINE_int32(upper_bound, -1, "If positive, look for a solution <= this.");
|
||||
ABSL_FLAG(std::string, input, "examples/data/weighted_tardiness/wt40.txt",
|
||||
"wt data file name.");
|
||||
ABSL_FLAG(int, size, 40, "Size of the problem in the wt file.");
|
||||
ABSL_FLAG(int, n, 28, "1-based instance number in the wt file.");
|
||||
ABSL_FLAG(std::string, params, "", "Sat parameters in text proto format.");
|
||||
ABSL_FLAG(int, upper_bound, -1, "If positive, look for a solution <= this.");
|
||||
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
@@ -253,7 +253,7 @@ void ParseAndSolve() {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::SetFlag(&FLAGS_logtostderr, true);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(FATAL) << "Please supply a data file with --input=";
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void ShoppingBasketBug() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::ShoppingBasketBug();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class ForbiddenIntervalTest {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::ForbiddenIntervalTest forbidden_intervals_test;
|
||||
forbidden_intervals_test.TestSimpleReductionOnBothSide();
|
||||
forbidden_intervals_test.TestMultipleReductionsOnMin();
|
||||
|
||||
@@ -22,7 +22,7 @@ void PrintVersion() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::PrintVersion();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void BreakLoop() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::BreakLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void OverflowTest() {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::OverflowTest();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void RunAllExamples() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::GetFlag(FLAGS_logtostderr) = 1;
|
||||
absl::SetFlag(&FLAGS_logtostderr, 1);
|
||||
operations_research::RunAllExamples();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ class MaxArrayCtTest {
|
||||
} // namespace operations_research
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
operations_research::MinArrayCtTest min_test;
|
||||
min_test.TestAlternateCtor();
|
||||
min_test.TestBounds();
|
||||
|
||||
@@ -7,6 +7,13 @@ config_setting(
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "on_windows",
|
||||
constraint_values = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "base",
|
||||
hdrs = [
|
||||
@@ -14,6 +21,7 @@ cc_library(
|
||||
"commandlineflags.h",
|
||||
"integral_types.h",
|
||||
"log_severity.h",
|
||||
"logging_export.h",
|
||||
"logging_utilities.h",
|
||||
"logging.h",
|
||||
"macros.h",
|
||||
@@ -34,6 +42,10 @@ cc_library(
|
||||
"-DOR_TOOLS_MAJOR=8",
|
||||
"-DOR_TOOLS_MINOR=0",
|
||||
],
|
||||
defines = select({
|
||||
"on_windows": ["OR_TOOLS_EXPORTS"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
"@com_google_absl//absl/base",
|
||||
"@com_google_absl//absl/debugging:stacktrace",
|
||||
|
||||
@@ -14,8 +14,8 @@ target_compile_definitions(${NAME} PRIVATE
|
||||
-DOR_TOOLS_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||
-DOR_TOOLS_MINOR=${PROJECT_VERSION_MINOR})
|
||||
if(MSVC)
|
||||
target_compile_definitions(${NAME} PRIVATE -DOR_TOOLS_EXPORT)
|
||||
endif()
|
||||
target_compile_definitions(${NAME} PRIVATE -DOR_TOOLS_EXPORTS)
|
||||
endif()
|
||||
target_include_directories(${NAME} PRIVATE
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_BINARY_DIR})
|
||||
|
||||
@@ -43,10 +43,7 @@ const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
|
||||
|
||||
extern GOOGLE_GLOG_DLL_DECL const char* const LogSeverityNames[NUM_SEVERITIES];
|
||||
} // namespace google
|
||||
#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
|
||||
#ifdef ERROR
|
||||
# error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
|
||||
#endif
|
||||
#ifndef _MSC_VER
|
||||
const int INFO = google::GLOG_INFO, WARNING = google::GLOG_WARNING,
|
||||
ERROR = google::GLOG_ERROR, FATAL = google::GLOG_FATAL;
|
||||
#endif
|
||||
|
||||
@@ -861,7 +861,7 @@ struct CrashReason;
|
||||
// We want the special COUNTER value available for LOG_EVERY_X()'ed messages
|
||||
enum PRIVATE_Counter { COUNTER };
|
||||
|
||||
#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
|
||||
#ifdef _MSC_VER
|
||||
// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
|
||||
// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
|
||||
// to keep using this syntax, we define this macro to do the same thing
|
||||
@@ -871,17 +871,6 @@ enum PRIVATE_Counter { COUNTER };
|
||||
#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
|
||||
// Needed for LOG_IS_ON(ERROR).
|
||||
const LogSeverity GLOG_0 = GLOG_ERROR;
|
||||
#else
|
||||
// Users may include windows.h after logging.h without
|
||||
// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
|
||||
// For this case, we cannot detect if ERROR is defined before users
|
||||
// actually use ERROR. Let's make an undefined symbol to warn users.
|
||||
#define GLOG_ERROR_MSG \
|
||||
ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
|
||||
#define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
|
||||
#define SYSLOG_0 GLOG_ERROR_MSG
|
||||
#define LOG_TO_STRING_0 GLOG_ERROR_MSG
|
||||
#define GLOG_0 GLOG_ERROR_MSG
|
||||
#endif
|
||||
|
||||
// Plus some debug-logging macros that get compiled to nothing for production
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// Annoying stuff for windows -- makes sure clients can import these functions
|
||||
#if defined(OR_TOOLS_EXPORT)
|
||||
#if defined(OR_TOOLS_EXPORTS)
|
||||
#define GOOGLE_GLOG_DLL_DECL __declspec(dllexport)
|
||||
#else
|
||||
#define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
|
||||
@@ -25,4 +25,4 @@
|
||||
#define GOOGLE_GLOG_DLL_DECL
|
||||
#endif
|
||||
|
||||
#endif // OR_TOOLS_BASE_LOGGING_EXPORT_H_
|
||||
#endif // OR_TOOLS_BASE_LOGGING_EXPORT_H_
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
--- /tmp/scip-7.0.1/CMakeLists.txt 2020-06-23 10:40:49.000000000 +0200
|
||||
+++ ./CMakeLists.txt 2020-08-26 00:18:51.325438349 +0200
|
||||
+++ ./CMakeLists.txt 2020-10-23 01:04:58.377410527 +0200
|
||||
@@ -1,5 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
|
||||
|
||||
+# option() honors normal variables.
|
||||
+if(POLICY CMP0077)
|
||||
+ cmake_policy(SET CMP0077 NEW)
|
||||
@@ -16,18 +16,18 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
||||
|
||||
@@ -88,6 +98,7 @@
|
||||
SET(COVERAGE_CTEST_ARGS "" CACHE STRING "additional ctest arguments for coverage")
|
||||
option(MT "use static runtime libraries for Visual Studio compiler" OFF)
|
||||
option(CXXONLY "use a c++ compiler for all source files" OFF)
|
||||
+option(AMPL "Enable AMPL support" OFF)
|
||||
|
||||
|
||||
set(TPI none CACHE STRING "options for thread support library") #create the variable
|
||||
set_property(CACHE TPI PROPERTY STRINGS none tny omp) #define list of values GUI will offer for the variable
|
||||
@@ -185,7 +196,7 @@
|
||||
set(NEWLINE "\\\\n")
|
||||
|
||||
|
||||
# create a target for updating the current git hash
|
||||
-file(WRITE ${CMAKE_BINARY_DIR}/scip_update_githash.cmake "
|
||||
+file(WRITE ${PROJECT_BINARY_DIR}/scip_update_githash.cmake "
|
||||
@@ -43,11 +43,11 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ COMMAND ${CMAKE_COMMAND}
|
||||
+ -DDST=${PROJECT_SOURCE_DIR}/src/scip/githash.c
|
||||
+ -P ${PROJECT_BINARY_DIR}/scip_update_githash.cmake)
|
||||
|
||||
|
||||
set(WITH_SCIPDEF on)
|
||||
|
||||
|
||||
@@ -221,161 +233,200 @@
|
||||
|
||||
|
||||
# ZLIB
|
||||
if(ZLIB)
|
||||
- find_package(ZLIB)
|
||||
@@ -66,7 +66,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ message(STATUS "Support ZLIB: OFF")
|
||||
+ set(SCIP_WITH_ZLIB OFF)
|
||||
endif()
|
||||
|
||||
|
||||
# Readline
|
||||
if(READLINE)
|
||||
- find_package(Readline)
|
||||
@@ -86,7 +86,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ set(Readline_LIBRARY "")
|
||||
+ set(SCIP_WITH_READLINE OFF)
|
||||
endif()
|
||||
|
||||
|
||||
# GMP
|
||||
if(GMP)
|
||||
- find_package(GMP)
|
||||
@@ -106,7 +106,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ set(GMP_LIBRARIES "")
|
||||
+ set(SCIP_WITH_GMP OFF)
|
||||
endif()
|
||||
|
||||
|
||||
# look for presolvelib
|
||||
if(PAPILO)
|
||||
- find_package(PAPILO CONFIG)
|
||||
@@ -124,7 +124,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ set(PAPILO_IMPORTED_TARGETS "")
|
||||
+ set(SCIP_WITH_PAPILO OFF)
|
||||
endif()
|
||||
|
||||
|
||||
#search the selected LP solver library
|
||||
+message(STATUS "Finding Solver \"${LPS}\"")
|
||||
if(LPS STREQUAL "spx")
|
||||
@@ -171,7 +171,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
- message(FATAL_ERROR "option LPS has wrong value")
|
||||
+ message(FATAL_ERROR "option LPS has wrong value")
|
||||
endif()
|
||||
|
||||
|
||||
#setup the proper lpi file for the selected LP solver
|
||||
if(SOPLEX_FOUND)
|
||||
- # SoPlex headers can be directly included
|
||||
@@ -204,7 +204,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support SOPLEX: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(CLP_FOUND)
|
||||
- include_directories(${CLP_INCLUDE_DIRS})
|
||||
- set(lpi lpi/lpi_clp.cpp)
|
||||
@@ -218,7 +218,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support CLP: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(CPLEX_FOUND)
|
||||
- include_directories(${CPLEX_INCLUDE_DIRS})
|
||||
- # only use lpi_cpx.c if LPSCHECK is not enabled
|
||||
@@ -238,7 +238,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support CPLEX: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(GLOP_FOUND)
|
||||
- include_directories(${GLOP_INCLUDE_DIRS})
|
||||
- set(lpi lpi/lpi_glop.cpp)
|
||||
@@ -252,7 +252,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support GLOP: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(GUROBI_FOUND)
|
||||
- include_directories(${GUROBI_INCLUDE_DIRS})
|
||||
- set(lpi lpi/lpi_grb.c)
|
||||
@@ -266,7 +266,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support GUROBI: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(XPRESS_FOUND)
|
||||
- include_directories(${XPRESS_INCLUDE_DIRS})
|
||||
- set(lpi lpi/lpi_xprs.c)
|
||||
@@ -280,7 +280,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support XPRESS: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(MOSEK_FOUND)
|
||||
- include_directories(${MOSEK_INCLUDE_DIRS})
|
||||
- set(lpi lpi/lpi_msk.c)
|
||||
@@ -294,7 +294,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support MOSEK: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
if(QSO_FOUND)
|
||||
- include_directories(${QSO_INCLUDE_DIRS})
|
||||
- set(lpi lpi/lpi_qso.c)
|
||||
@@ -308,7 +308,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support QSO: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
#search the selected symmetry computation program
|
||||
+message(STATUS "Finding symmetry computation program \"${SYM}\"")
|
||||
if(SYM STREQUAL "bliss")
|
||||
@@ -343,15 +343,15 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
- message(FATAL_ERROR "option SYM has wrong value")
|
||||
+ message(FATAL_ERROR "option SYM has wrong value")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -396,56 +447,62 @@
|
||||
# With a script file, the return code of the tests is simply ignored,
|
||||
# and a coverage report is generated even if some tests fail currently.
|
||||
#
|
||||
- file(WRITE ${CMAKE_BINARY_DIR}/RunCoverage.cmake "execute_process(COMMAND ctest ${CMAKE_CTEST_COMMAND} ${COVERAGE_CTEST_ARGS})")
|
||||
+ file(WRITE ${PROJECT_BINARY_DIR}/RunCoverage.cmake "execute_process(COMMAND ctest ${CMAKE_CTEST_COMMAND} ${COVERAGE_CTEST_ARGS})")
|
||||
|
||||
|
||||
#
|
||||
# setup the coverage target to execute the RunCoverage script
|
||||
#
|
||||
@@ -363,7 +363,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "CodeCoverage: OFF")
|
||||
endif()
|
||||
|
||||
|
||||
# ZIMPL headers need to be copied to have the "zimpl/*.h" prefix
|
||||
if(ZIMPL)
|
||||
- find_package(ZIMPL CONFIG)
|
||||
@@ -391,7 +391,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ set(ZIMPL_PIC_LIBRARIES "")
|
||||
+ set(SCIP_WITH_ZIMPL OFF)
|
||||
endif()
|
||||
|
||||
|
||||
# IPOPT
|
||||
if(IPOPT)
|
||||
- find_package(IPOPT 3.12.0)
|
||||
@@ -415,7 +415,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ message(STATUS "Support IPOPT: OFF")
|
||||
+ set(nlpi nlpi/nlpi_ipopt_dummy.c)
|
||||
endif()
|
||||
|
||||
|
||||
# WORHP
|
||||
if(WORHP)
|
||||
- find_package(WORHP)
|
||||
@@ -435,12 +435,12 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+ message(STATUS "Support WORHP: OFF")
|
||||
+ set(nlpi ${nlpi} nlpi/nlpi_worhp_dummy.c)
|
||||
endif()
|
||||
|
||||
|
||||
# FilterSQP (with CMake, nlpi_filtersqp doesn't build anyway)
|
||||
@@ -470,56 +527,65 @@
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
+message(STATUS "Finding CRITERION")
|
||||
find_package(CRITERION)
|
||||
+if(CRITERION_FOUND)
|
||||
@@ -448,15 +448,15 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Finding CRITERION - not found")
|
||||
+endif()
|
||||
|
||||
|
||||
# export compilation settings to header file
|
||||
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/scip/config.h.in ${CMAKE_BINARY_DIR}/scip/config.h @ONLY)
|
||||
-include_directories(${CMAKE_BINARY_DIR})
|
||||
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/scip/config.h.in ${PROJECT_BINARY_DIR}/scip/config.h @ONLY)
|
||||
|
||||
|
||||
# go to src/ and compile the code
|
||||
add_subdirectory(src)
|
||||
|
||||
|
||||
-#
|
||||
-# we set the SCIP_DIR variable explicitly for the following examples/applications and unittests that depend on SCIP.
|
||||
-#
|
||||
@@ -481,7 +481,7 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
set(OLD_CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
|
||||
-add_subdirectory(examples)
|
||||
|
||||
|
||||
-#
|
||||
-# add applications
|
||||
-#
|
||||
@@ -533,9 +533,9 @@ diff --color -ru /tmp/scip-7.0.1/CMakeLists.txt ./CMakeLists.txt
|
||||
+else()
|
||||
+ message(STATUS "Support AMPL: OFF")
|
||||
+endif()
|
||||
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OLD_CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
|
||||
-enable_testing()
|
||||
-
|
||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
@@ -546,16 +546,16 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
+++ ./src/CMakeLists.txt 2020-08-26 00:23:47.920274032 +0200
|
||||
@@ -1,4 +1,3 @@
|
||||
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
||||
#
|
||||
# interface function for setting common library properties
|
||||
@@ -14,10 +13,10 @@
|
||||
|
||||
|
||||
#configure the scipbuildflags.c source file for the build tree
|
||||
configure_file(${PROJECT_SOURCE_DIR}/src/scipbuildflags.c.in
|
||||
- "${CMAKE_BINARY_DIR}/scipbuildflag.c" @ONLY)
|
||||
+ "${PROJECT_BINARY_DIR}/scipbuildflag.c" @ONLY)
|
||||
|
||||
|
||||
set(scipsources
|
||||
- ${CMAKE_BINARY_DIR}/scipbuildflag.c
|
||||
+ ${PROJECT_BINARY_DIR}/scipbuildflag.c
|
||||
@@ -564,7 +564,7 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
scip/bitencode.c
|
||||
@@ -953,6 +952,7 @@
|
||||
setLibProperties(liblpi "lpi")
|
||||
|
||||
|
||||
add_library(libscip ${scipsources} ${objscipsources} ${nlpisources} ${lpisources} ${tpisources} ${symsources})
|
||||
+
|
||||
if(MSVC)
|
||||
@@ -573,7 +573,7 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
@@ -960,8 +960,12 @@
|
||||
setLibProperties(libscip "scip")
|
||||
endif()
|
||||
|
||||
|
||||
+target_include_directories(libscip PUBLIC
|
||||
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
@@ -586,17 +586,17 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
${THREAD_LIBRARIES}
|
||||
@@ -983,7 +987,7 @@
|
||||
endif()
|
||||
|
||||
|
||||
include(GenerateExportHeader)
|
||||
-generate_export_header(libscip BASE_NAME scip EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/scip/scip_export.h)
|
||||
+generate_export_header(libscip BASE_NAME scip EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/scip/scip_export.h)
|
||||
target_compile_definitions(scip PRIVATE SCIP_STATIC_DEFINE)
|
||||
|
||||
|
||||
if(CMAKE_BUILD_TYPE EQUAL "Debug")
|
||||
@@ -991,8 +995,16 @@
|
||||
add_sanitizers(scip)
|
||||
endif()
|
||||
|
||||
|
||||
-target_link_libraries(scip ${ZLIB_LIBRARIES} ${Readline_LIBRARY} ${GMP_LIBRARIES}
|
||||
- ${ZIMPL_LIBRARIES} ${LPS_LIBRARIES} ${SYM_LIBRARIES} ${THREAD_LIBRARIES} ${NLPI_LIBRARIES} ${PAPILO_IMPORTED_TARGETS})
|
||||
+target_link_libraries(scip
|
||||
@@ -609,7 +609,7 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
+ ${THREAD_LIBRARIES}
|
||||
+ ${NLPI_LIBRARIES}
|
||||
+ ${PAPILO_IMPORTED_TARGETS})
|
||||
|
||||
|
||||
add_dependencies(libscip scip_update_githash)
|
||||
add_dependencies(scip scip_update_githash)
|
||||
@@ -1012,7 +1024,7 @@
|
||||
@@ -622,24 +622,24 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
install(FILES ${tinycthreadheader} DESTINATION include/tinycthread)
|
||||
install(FILES ${tpiheaders} DESTINATION include/tpi)
|
||||
@@ -1029,7 +1041,7 @@
|
||||
|
||||
|
||||
# Add all targets to the build-tree export set
|
||||
export(TARGETS scip libscip
|
||||
- FILE "${CMAKE_BINARY_DIR}/scip-targets.cmake")
|
||||
+ FILE "${PROJECT_BINARY_DIR}/scip-targets.cmake")
|
||||
|
||||
|
||||
#make soplex and zimpl dir absolute for the config file
|
||||
if(SOPLEX_NEEDED)
|
||||
@@ -1041,13 +1053,13 @@
|
||||
endif()
|
||||
|
||||
|
||||
#configure the config file for the build tree
|
||||
-set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}")
|
||||
+set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}")
|
||||
configure_file(${PROJECT_SOURCE_DIR}/scip-config.cmake.in
|
||||
- "${CMAKE_BINARY_DIR}/scip-config.cmake" @ONLY)
|
||||
+ "${PROJECT_BINARY_DIR}/scip-config.cmake" @ONLY)
|
||||
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
-${CMAKE_BINARY_DIR}/scip-config-version.cmake
|
||||
@@ -654,9 +654,9 @@ diff --color -ru /tmp/scip-7.0.1/src/CMakeLists.txt ./src/CMakeLists.txt
|
||||
- ${CMAKE_BINARY_DIR}/scip-config-version.cmake
|
||||
+ ${PROJECT_BINARY_DIR}/scip-config-version.cmake
|
||||
DESTINATION lib/cmake/scip)
|
||||
|
||||
--- scip-7.0.1-orig/src/lpi/lpi_glop.cpp 2020-06-23 10:40:54.000000000 +0200
|
||||
+++ ./src/lpi/lpi_glop.cpp 2020-10-21 19:10:35.514260597 +0200
|
||||
diff --color -ru /tmp/scip-7.0.1/src/lpi/lpi_glop.cpp ./src/lpi/lpi_glop.cpp
|
||||
--- /tmp/scip-7.0.1/src/lpi/lpi_glop.cpp 2020-06-23 10:40:54.000000000 +0200
|
||||
+++ ./src/lpi/lpi_glop.cpp 2020-10-23 01:04:58.377410527 +0200
|
||||
@@ -41,8 +41,8 @@
|
||||
#include "ortools/util/stats.h"
|
||||
#include "ortools/util/time_limit.h"
|
||||
|
||||
Reference in New Issue
Block a user