Sync google <=> github
This commit is contained in:
@@ -64,6 +64,7 @@ CMake as a standalone project or it can be incorporated into an existing CMake
|
||||
project.
|
||||
|
||||
<a name="deps"></a>
|
||||
|
||||
## Dependencies
|
||||
|
||||
OR-Tools depends on severals mandatory libraries. You can compile them all at
|
||||
@@ -96,10 +97,13 @@ default):
|
||||
test it on public CI and support can be broken.**
|
||||
|
||||
<a name="options"></a>
|
||||
|
||||
## CMake Options
|
||||
|
||||
There are several options that can be passed to CMake to modify how the code is built.<br>
|
||||
For all of these options and parameters you have to use `-D<Parameter_name>=<value>`.<br>
|
||||
Following a list of available options, for the full list run:
|
||||
|
||||
```sh
|
||||
cmake -S. -Bbuild -LH
|
||||
```
|
||||
@@ -145,8 +149,8 @@ cmake -S. -Bbuild -LH
|
||||
| `UNIVERSAL_JAVA_PACKAGE` | OFF | Build a multi platform package (i.e. `ortools-java` will depends on all native packages)<br>Only available if `BUILD_JAVA=ON` |
|
||||
| | | |
|
||||
|
||||
|
||||
<a name="integration"></a>
|
||||
|
||||
## Integrating OR-Tools in your CMake Project
|
||||
|
||||
You should be able to integrate OR-Tools in your C++ CMake project following one
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
// distances are computed using the Manhattan distance. Distances are assumed
|
||||
// to be in meters and times in seconds.
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/flags/parse.h"
|
||||
@@ -61,8 +62,8 @@ ABSL_FLAG(std::string, routing_search_parameters, "",
|
||||
|
||||
const char* kTime = "Time";
|
||||
const char* kCapacity = "Capacity";
|
||||
const int64 kMaxNodesPerGroup = 10;
|
||||
const int64 kSameVehicleCost = 1000;
|
||||
const int64_t kMaxNodesPerGroup = 10;
|
||||
const int64_t kSameVehicleCost = 1000;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
@@ -80,9 +81,9 @@ int main(int argc, char** argv) {
|
||||
RoutingModel routing(manager);
|
||||
|
||||
// Setting up locations.
|
||||
const int64 kXMax = 100000;
|
||||
const int64 kYMax = 100000;
|
||||
const int64 kSpeed = 10;
|
||||
const int64_t kXMax = 100000;
|
||||
const int64_t kYMax = 100000;
|
||||
const int64_t kSpeed = 10;
|
||||
LocationContainer locations(
|
||||
kSpeed, absl::GetFlag(FLAGS_vrp_use_deterministic_random_seed));
|
||||
for (int location = 0; location <= absl::GetFlag(FLAGS_vrp_orders);
|
||||
@@ -99,8 +100,8 @@ int main(int argc, char** argv) {
|
||||
routing.SetArcCostEvaluatorOfAllVehicles(vehicle_cost);
|
||||
|
||||
// Adding capacity dimension constraints.
|
||||
const int64 kVehicleCapacity = 40;
|
||||
const int64 kNullCapacitySlack = 0;
|
||||
const int64_t kVehicleCapacity = 40;
|
||||
const int64_t kNullCapacitySlack = 0;
|
||||
RandomDemand demand(manager.num_nodes(), kDepot,
|
||||
absl::GetFlag(FLAGS_vrp_use_deterministic_random_seed));
|
||||
demand.Initialize();
|
||||
@@ -112,8 +113,8 @@ int main(int argc, char** argv) {
|
||||
/*fix_start_cumul_to_zero=*/true, kCapacity);
|
||||
|
||||
// Adding time dimension constraints.
|
||||
const int64 kTimePerDemandUnit = 300;
|
||||
const int64 kHorizon = 24 * 3600;
|
||||
const int64_t kTimePerDemandUnit = 300;
|
||||
const int64_t kHorizon = 24 * 3600;
|
||||
ServiceTimePlusTransition time(
|
||||
kTimePerDemandUnit,
|
||||
[&demand](RoutingNodeIndex i, RoutingNodeIndex j) {
|
||||
@@ -132,25 +133,25 @@ int main(int argc, char** argv) {
|
||||
// Adding time windows.
|
||||
std::mt19937 randomizer(
|
||||
GetSeed(absl::GetFlag(FLAGS_vrp_use_deterministic_random_seed)));
|
||||
const int64 kTWDuration = 5 * 3600;
|
||||
const int64_t kTWDuration = 5 * 3600;
|
||||
for (int order = 1; order < manager.num_nodes(); ++order) {
|
||||
const int64 start =
|
||||
const int64_t start =
|
||||
absl::Uniform<int32_t>(randomizer, 0, kHorizon - kTWDuration);
|
||||
time_dimension.CumulVar(order)->SetRange(start, start + kTWDuration);
|
||||
}
|
||||
|
||||
// Adding penalty costs to allow skipping orders.
|
||||
const int64 kPenalty = 10000000;
|
||||
const int64_t kPenalty = 10000000;
|
||||
const RoutingIndexManager::NodeIndex kFirstNodeAfterDepot(1);
|
||||
for (RoutingIndexManager::NodeIndex order = kFirstNodeAfterDepot;
|
||||
order < manager.num_nodes(); ++order) {
|
||||
std::vector<int64> orders(1, manager.NodeToIndex(order));
|
||||
std::vector<int64_t> orders(1, manager.NodeToIndex(order));
|
||||
routing.AddDisjunction(orders, kPenalty);
|
||||
}
|
||||
|
||||
// Adding same vehicle constraint costs for consecutive nodes.
|
||||
if (absl::GetFlag(FLAGS_vrp_use_same_vehicle_costs)) {
|
||||
std::vector<int64> group;
|
||||
std::vector<int64_t> group;
|
||||
for (RoutingIndexManager::NodeIndex order = kFirstNodeAfterDepot;
|
||||
order < manager.num_nodes(); ++order) {
|
||||
group.push_back(manager.NodeToIndex(order));
|
||||
|
||||
@@ -146,7 +146,6 @@
|
||||
#define OR_TOOLS_BASE_INT_TYPE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <ostream> // NOLINT
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <jni.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
|
||||
class JNIUtil {
|
||||
|
||||
@@ -208,7 +208,7 @@ static void GetHostName(string* hostname) {
|
||||
*buf.nodename = '\0';
|
||||
}
|
||||
*hostname = buf.nodename;
|
||||
#else // _MSC_VER
|
||||
#else // _MSC_VER
|
||||
char buf[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
if (GetComputerNameA(buf, &len)) {
|
||||
@@ -650,7 +650,7 @@ static void ColoredWriteToStderr(LogSeverity severity, const char* message,
|
||||
fflush(stderr);
|
||||
// Restores the text color.
|
||||
SetConsoleTextAttribute(stderr_handle, old_color_attrs);
|
||||
#else // !_MSC_VER
|
||||
#else // !_MSC_VER
|
||||
fprintf(stderr, "\033[0;3%sm", GetAnsiColorCode(color));
|
||||
fwrite(message, len, 1, stderr);
|
||||
fprintf(stderr, "\033[m"); // Resets the terminal to default.
|
||||
@@ -1186,7 +1186,7 @@ LogMessage::~LogMessage() {
|
||||
} else {
|
||||
delete allocated_;
|
||||
}
|
||||
#else // !defined(GLOG_THREAD_LOCAL_STORAGE)
|
||||
#else // !defined(GLOG_THREAD_LOCAL_STORAGE)
|
||||
delete allocated_;
|
||||
#endif // defined(GLOG_THREAD_LOCAL_STORAGE)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#define OR_TOOLS_BASE_MATHUTIL_H_
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ function unpack() {
|
||||
local -r DESTINATION="${ARCHIVE_DIR}/${RELATIVE_DIR}"
|
||||
if [[ ! -d "${DESTINATION}" ]] ; then
|
||||
local -r ARCHIVE_NAME=$(basename "${URL}")
|
||||
test -f "${ARCHIVE_NAME}" || wget "${URL}"
|
||||
[[ -f "${ARCHIVE_NAME}" ]] || wget "${URL}"
|
||||
extract "${ARCHIVE_NAME}"
|
||||
rm -f "${ARCHIVE_NAME}"
|
||||
fi
|
||||
@@ -52,8 +52,8 @@ function install_qemu() {
|
||||
|
||||
# Qemu (meson based build) depends on: pkgconf, libglib2.0, python3, ninja
|
||||
./configure \
|
||||
--prefix=${QEMU_INSTALL} \
|
||||
--target-list=${QEMU_TARGET} \
|
||||
--prefix="${QEMU_INSTALL}" \
|
||||
--target-list="${QEMU_TARGET}" \
|
||||
--audio-drv-list= \
|
||||
--disable-brlapi \
|
||||
--disable-curl \
|
||||
@@ -222,13 +222,13 @@ function run_test() {
|
||||
set -x
|
||||
case ${PROJECT} in
|
||||
glop)
|
||||
${RUN_CMD} bin/simple_glop_program ;;
|
||||
"${RUN_CMD}" bin/simple_glop_program ;;
|
||||
or-tools)
|
||||
for test_binary in \
|
||||
"${BUILD_DIR}"/bin/simple_* \
|
||||
"${BUILD_DIR}"/bin/*tsp* \
|
||||
"${BUILD_DIR}"/bin/*vrp*; do
|
||||
${RUN_CMD} "${test_binary}"
|
||||
"${RUN_CMD}" "${test_binary}"
|
||||
done
|
||||
;;
|
||||
*)
|
||||
@@ -280,7 +280,8 @@ function main() {
|
||||
assert_defined PROJECT
|
||||
assert_defined TARGET
|
||||
|
||||
declare -r PROJECT_DIR="$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)"
|
||||
declare -r PROJECT_DIR
|
||||
PROJECT_DIR="$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)"
|
||||
declare -r ARCHIVE_DIR="${PROJECT_DIR}/build_cross/archives"
|
||||
declare -r BUILD_DIR="${PROJECT_DIR}/build_cross/${TARGET}"
|
||||
declare -r TOOLCHAIN_FILE=${ARCHIVE_DIR}/toolchain_${TARGET}.cmake
|
||||
|
||||
@@ -15,3 +15,4 @@ tools/generate_deps.sh GSCIP gscip base port
|
||||
tools/generate_deps.sh GUROBI gurobi base
|
||||
tools/generate_deps.sh LP linear_solver base util lp_data glop bop gscip gurobi
|
||||
tools/generate_deps.sh CP constraint_solver base util graph linear_solver sat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user