Sync g3 -> gh
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// F#: indigo
|
||||
@startdot
|
||||
digraph CMake {
|
||||
//rankdir=BT;
|
||||
rankdir=TD;
|
||||
//rankdir=BT;
|
||||
rankdir=TD;
|
||||
|
||||
subgraph clusterPrerequisite {
|
||||
node [shape=box, style=rounded];
|
||||
|
||||
@@ -3,6 +3,6 @@ set -ex
|
||||
|
||||
rm -f *.svg *.png
|
||||
for i in *.dot; do
|
||||
plantuml -Tpng $i;
|
||||
plantuml -Tsvg $i;
|
||||
plantuml -Tpng "$i";
|
||||
plantuml -Tsvg "$i";
|
||||
done
|
||||
|
||||
@@ -68,7 +68,7 @@ FROM env AS dotnet
|
||||
# Swig install
|
||||
RUN apk add --no-cache swig
|
||||
# Add dependencies for disabling invariant mode (set in base image)
|
||||
RUN apk add --no-cache wget icu-libs libintl
|
||||
RUN apk add --no-cache wget icu-libs libintl
|
||||
# .NET install
|
||||
RUN dotnet_sdk_version=3.1.101 \
|
||||
&& wget -O dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-musl-x64.tar.gz \
|
||||
|
||||
@@ -9,12 +9,12 @@ do
|
||||
PYTAG=$(basename "${PYROOT}")
|
||||
echo "$PYTAG"
|
||||
# Clean the build dir
|
||||
rm -rf cache/manylinux/build_$PYTAG
|
||||
rm -rf "cache/manylinux/build_$PYTAG"
|
||||
|
||||
PATH=${PYROOT}/bin:${PATH_BCKP}
|
||||
python -m pip install --user virtualenv
|
||||
cmake -H. -Bcache/manylinux/build_$PYTAG \
|
||||
-DBUILD_PYTHON=ON -DPYTHON_LIBRARY=${PYROOT}/lib/ -DPYTHON_INCLUDE_DIR=${PYROOT}/include/
|
||||
cmake -H. "-Bcache/manylinux/build_$PYTAG" \
|
||||
-DBUILD_PYTHON=ON "-DPYTHON_LIBRARY=${PYROOT}/lib/" "-DPYTHON_INCLUDE_DIR=${PYROOT}/include/"
|
||||
done
|
||||
|
||||
|
||||
|
||||
@@ -108,16 +108,16 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
" print('Objective: {}'.format(assignment.ObjectiveValue()))\n",
|
||||
"def print_solution(manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" print('Objective: {}'.format(solution.ObjectiveValue()))\n",
|
||||
" index = routing.Start(0)\n",
|
||||
" plan_output = 'Route:\\n'\n",
|
||||
" route_distance = 0\n",
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" plan_output += ' {} ->'.format(manager.IndexToNode(index))\n",
|
||||
" previous_index = index\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" route_distance += routing.GetArcCostForVehicle(previous_index, index, 0)\n",
|
||||
" plan_output += ' {}\\n'.format(manager.IndexToNode(index))\n",
|
||||
" print(plan_output)\n",
|
||||
@@ -169,13 +169,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -55,16 +55,16 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
" print('Objective: {} miles'.format(assignment.ObjectiveValue()))\n",
|
||||
"def print_solution(manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" print('Objective: {} miles'.format(solution.ObjectiveValue()))\n",
|
||||
" index = routing.Start(0)\n",
|
||||
" plan_output = 'Route for vehicle 0:\\n'\n",
|
||||
" route_distance = 0\n",
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" plan_output += ' {} ->'.format(manager.IndexToNode(index))\n",
|
||||
" previous_index = index\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" route_distance += routing.GetArcCostForVehicle(previous_index, index, 0)\n",
|
||||
" plan_output += ' {}\\n'.format(manager.IndexToNode(index))\n",
|
||||
" print(plan_output)\n",
|
||||
@@ -115,13 +115,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -109,16 +109,16 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
" print('Objective: {}'.format(assignment.ObjectiveValue()))\n",
|
||||
"def print_solution(manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" print('Objective: {}'.format(solution.ObjectiveValue()))\n",
|
||||
" index = routing.Start(0)\n",
|
||||
" plan_output = 'Route for vehicle 0:\\n'\n",
|
||||
" route_distance = 0\n",
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" plan_output += ' {} ->'.format(manager.IndexToNode(index))\n",
|
||||
" previous_index = index\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" route_distance += routing.GetArcCostForVehicle(previous_index, index, 0)\n",
|
||||
" plan_output += ' {}\\n'.format(manager.IndexToNode(index))\n",
|
||||
" plan_output += 'Distance of the route: {}m\\n'.format(route_distance)\n",
|
||||
@@ -170,13 +170,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -109,9 +109,9 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(data, manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
" print('Objective: {}'.format(assignment.ObjectiveValue()))\n",
|
||||
"def print_solution(data, manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" print('Objective: {}'.format(solution.ObjectiveValue()))\n",
|
||||
" total_distance = 0\n",
|
||||
" for vehicle_id in range(data['num_vehicles']):\n",
|
||||
" index = routing.Start(vehicle_id)\n",
|
||||
@@ -120,7 +120,7 @@
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" plan_output += ' {} ->'.format(manager.IndexToNode(index))\n",
|
||||
" previous_index = index\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" route_distance += routing.GetArcCostForVehicle(\n",
|
||||
" previous_index, index, vehicle_id)\n",
|
||||
" plan_output += ' {}\\n'.format(manager.IndexToNode(index))\n",
|
||||
@@ -175,13 +175,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(data, manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(data, manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -113,8 +113,8 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(data, manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
"def print_solution(data, manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" total_distance = 0\n",
|
||||
" total_load = 0\n",
|
||||
" for vehicle_id in range(data['num_vehicles']):\n",
|
||||
@@ -127,7 +127,7 @@
|
||||
" route_load += data['demands'][node_index]\n",
|
||||
" plan_output += ' {0} Load({1}) -> '.format(node_index, route_load)\n",
|
||||
" previous_index = index\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" route_distance += routing.GetArcCostForVehicle(\n",
|
||||
" previous_index, index, vehicle_id)\n",
|
||||
" plan_output += ' {0} Load({1})\\n'.format(manager.IndexToNode(index),\n",
|
||||
@@ -205,13 +205,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(data, manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(data, manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -121,8 +121,8 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(data, manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
"def print_solution(data, manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" total_distance = 0\n",
|
||||
" for vehicle_id in range(data['num_vehicles']):\n",
|
||||
" index = routing.Start(vehicle_id)\n",
|
||||
@@ -131,7 +131,7 @@
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" plan_output += ' {} -> '.format(manager.IndexToNode(index))\n",
|
||||
" previous_index = index\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" route_distance += routing.GetArcCostForVehicle(\n",
|
||||
" previous_index, index, vehicle_id)\n",
|
||||
" plan_output += '{}\\n'.format(manager.IndexToNode(index))\n",
|
||||
@@ -209,13 +209,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(data, manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(data, manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -82,8 +82,8 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(data, manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
"def print_solution(data, manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" time_dimension = routing.GetDimensionOrDie('Time')\n",
|
||||
" total_time = 0\n",
|
||||
" for vehicle_id in range(data['num_vehicles']):\n",
|
||||
@@ -92,17 +92,17 @@
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" time_var = time_dimension.CumulVar(index)\n",
|
||||
" plan_output += '{0} Time({1},{2}) -> '.format(\n",
|
||||
" manager.IndexToNode(index), assignment.Min(time_var),\n",
|
||||
" assignment.Max(time_var))\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" manager.IndexToNode(index), solution.Min(time_var),\n",
|
||||
" solution.Max(time_var))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" time_var = time_dimension.CumulVar(index)\n",
|
||||
" plan_output += '{0} Time({1},{2})\\n'.format(manager.IndexToNode(index),\n",
|
||||
" assignment.Min(time_var),\n",
|
||||
" assignment.Max(time_var))\n",
|
||||
" solution.Min(time_var),\n",
|
||||
" solution.Max(time_var))\n",
|
||||
" plan_output += 'Time of the route: {}min\\n'.format(\n",
|
||||
" assignment.Min(time_var))\n",
|
||||
" solution.Min(time_var))\n",
|
||||
" print(plan_output)\n",
|
||||
" total_time += assignment.Min(time_var)\n",
|
||||
" total_time += solution.Min(time_var)\n",
|
||||
" print('Total time of all routes: {}min'.format(total_time))\n",
|
||||
" # [END solution_printer]\n",
|
||||
"\n",
|
||||
@@ -207,13 +207,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(data, manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(data, manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"else:\n",
|
||||
" print('No solution found !')\n",
|
||||
|
||||
@@ -55,20 +55,20 @@
|
||||
" (0, 5), # depot\n",
|
||||
" (7, 12), # 1\n",
|
||||
" (10, 15), # 2\n",
|
||||
" (5, 14), # 3\n",
|
||||
" (5, 13), # 4\n",
|
||||
" (16, 18), # 3\n",
|
||||
" (10, 13), # 4\n",
|
||||
" (0, 5), # 5\n",
|
||||
" (5, 10), # 6\n",
|
||||
" (0, 10), # 7\n",
|
||||
" (0, 4), # 7\n",
|
||||
" (5, 10), # 8\n",
|
||||
" (0, 5), # 9\n",
|
||||
" (0, 3), # 9\n",
|
||||
" (10, 16), # 10\n",
|
||||
" (10, 15), # 11\n",
|
||||
" (0, 5), # 12\n",
|
||||
" (5, 10), # 13\n",
|
||||
" (7, 12), # 14\n",
|
||||
" (7, 8), # 14\n",
|
||||
" (10, 15), # 15\n",
|
||||
" (5, 15), # 16\n",
|
||||
" (11, 15), # 16\n",
|
||||
" ]\n",
|
||||
" data['num_vehicles'] = 4\n",
|
||||
" data['depot'] = 0\n",
|
||||
@@ -77,8 +77,8 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"# [START solution_printer]\n",
|
||||
"def print_solution(data, manager, routing, assignment):\n",
|
||||
" \"\"\"Prints assignment on console.\"\"\"\n",
|
||||
"def print_solution(data, manager, routing, solution):\n",
|
||||
" \"\"\"Prints solution on console.\"\"\"\n",
|
||||
" time_dimension = routing.GetDimensionOrDie('Time')\n",
|
||||
" total_time = 0\n",
|
||||
" for vehicle_id in range(data['num_vehicles']):\n",
|
||||
@@ -87,17 +87,17 @@
|
||||
" while not routing.IsEnd(index):\n",
|
||||
" time_var = time_dimension.CumulVar(index)\n",
|
||||
" plan_output += '{0} Time({1},{2}) -> '.format(\n",
|
||||
" manager.IndexToNode(index), assignment.Min(time_var),\n",
|
||||
" assignment.Max(time_var))\n",
|
||||
" index = assignment.Value(routing.NextVar(index))\n",
|
||||
" manager.IndexToNode(index), solution.Min(time_var),\n",
|
||||
" solution.Max(time_var))\n",
|
||||
" index = solution.Value(routing.NextVar(index))\n",
|
||||
" time_var = time_dimension.CumulVar(index)\n",
|
||||
" plan_output += '{0} Time({1},{2})\\n'.format(manager.IndexToNode(index),\n",
|
||||
" assignment.Min(time_var),\n",
|
||||
" assignment.Max(time_var))\n",
|
||||
" solution.Min(time_var),\n",
|
||||
" solution.Max(time_var))\n",
|
||||
" plan_output += 'Time of the route: {}min\\n'.format(\n",
|
||||
" assignment.Min(time_var))\n",
|
||||
" solution.Min(time_var))\n",
|
||||
" print(plan_output)\n",
|
||||
" total_time += assignment.Min(time_var)\n",
|
||||
" total_time += solution.Min(time_var)\n",
|
||||
" print('Total time of all routes: {}min'.format(total_time))\n",
|
||||
" # [END solution_printer]\n",
|
||||
"\n",
|
||||
@@ -178,13 +178,13 @@
|
||||
"\n",
|
||||
"# Solve the problem.\n",
|
||||
"# [START solve]\n",
|
||||
"assignment = routing.SolveWithParameters(search_parameters)\n",
|
||||
"solution = routing.SolveWithParameters(search_parameters)\n",
|
||||
"# [END solve]\n",
|
||||
"\n",
|
||||
"# Print solution on console.\n",
|
||||
"# [START print_solution]\n",
|
||||
"if assignment:\n",
|
||||
" print_solution(data, manager, routing, assignment)\n",
|
||||
"if solution:\n",
|
||||
" print_solution(data, manager, routing, solution)\n",
|
||||
"# [END print_solution]\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
@@ -993,8 +993,8 @@ OR_TOOLS_PYTHON_VERSION := $(OR_TOOLS_MAJOR).$(OR_TOOLS_MINOR)b$(GIT_REVISION)
|
||||
endif
|
||||
|
||||
|
||||
$(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py: tools/setup.py | $(PYPI_ARCHIVE_TEMP_DIR)/ortools
|
||||
$(COPY) tools$Ssetup.py $(PYPI_ARCHIVE_TEMP_DIR)$Sortools
|
||||
$(PYPI_ARCHIVE_TEMP_DIR)/ortools/setup.py: tools/setup.py.in | $(PYPI_ARCHIVE_TEMP_DIR)/ortools
|
||||
$(COPY) tools$Ssetup.py.in $(PYPI_ARCHIVE_TEMP_DIR)$Sortools
|
||||
$(SED) -i -e 's/ORTOOLS_PYTHON_VERSION/ortools$(PYPI_OS)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Ssetup.py
|
||||
$(SED) -i -e 's/VVVV/$(OR_TOOLS_PYTHON_VERSION)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Ssetup.py
|
||||
$(SED) -i -e 's/PROTOBUF_TAG/$(PROTOBUF_TAG)/' $(PYPI_ARCHIVE_TEMP_DIR)$Sortools$Ssetup.py
|
||||
|
||||
@@ -984,7 +984,7 @@ int64 KnapsackDynamicProgrammingSolver::SolveSubProblem(int64 capacity,
|
||||
int num_items) {
|
||||
const int64 capacity_plus_1 = capacity + 1;
|
||||
std::fill_n(selected_item_ids_.begin(), capacity_plus_1, 0);
|
||||
std::fill_n(computed_profits_.begin(), capacity_plus_1, 0LL);
|
||||
std::fill_n(computed_profits_.begin(), capacity_plus_1, int64{0});
|
||||
for (int item_id = 0; item_id < num_items; ++item_id) {
|
||||
const int64 item_weight = weights_[item_id];
|
||||
const int64 item_profit = profits_[item_id];
|
||||
|
||||
@@ -9,7 +9,7 @@ set_target_properties(${NAME} PROPERTIES
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
)
|
||||
# CMake < 3.12: CMakeError: Object library may not link to anything.
|
||||
#target_link_libraries(${NAME} PRIVATE
|
||||
# ZLIB::ZLIB
|
||||
@@ -18,39 +18,39 @@ set_target_properties(${NAME} PROPERTIES
|
||||
# protobuf::libprotobuf
|
||||
# ${PROJECT_NAME}::proto)
|
||||
target_include_directories(${NAME} PRIVATE
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:absl::base,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:absl::strings,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:absl::str_format,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:glog::glog,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:absl::base,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:absl::strings,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:absl::str_format,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:glog::glog,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_compile_options(${NAME} PRIVATE
|
||||
$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:absl::base,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:absl::strings,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:absl::str_format,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:glog::glog,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_OPTIONS>
|
||||
)
|
||||
$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:absl::base,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:absl::strings,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:absl::str_format,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:glog::glog,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_OPTIONS>
|
||||
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_OPTIONS>
|
||||
)
|
||||
target_compile_definitions(${NAME} PRIVATE
|
||||
-DOR_TOOLS_MAJOR=${PROJECT_VERSION_MAJOR} -DOR_TOOLS_MINOR=${PROJECT_VERSION_MINOR}
|
||||
$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:absl::base,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:absl::strings,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:absl::str_format,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:glog::glog,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_DEFINITIONS>
|
||||
)
|
||||
$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:absl::base,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:absl::strings,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:absl::str_format,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:gflags::gflags,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:glog::glog,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:${PROJECT_NAME}::proto,INTERFACE_COMPILE_DEFINITIONS>
|
||||
)
|
||||
add_dependencies(${NAME}
|
||||
ZLIB::ZLIB
|
||||
ZLIB::ZLIB
|
||||
absl::base absl::strings absl::str_format
|
||||
gflags::gflags glog::glog
|
||||
protobuf::libprotobuf
|
||||
|
||||
@@ -27,9 +27,9 @@ dotnet run
|
||||
|
||||
* Using NuGet Package Directly
|
||||
|
||||
To use the nuget package directly a local feed is required. Create a folder where the packages
|
||||
To use the nuget package directly a local feed is required. Create a folder where the packages
|
||||
will be stored. Create a nuget.config that references this folder. Copy the nupkg file to the
|
||||
package folder.
|
||||
package folder.
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
@@ -46,9 +46,9 @@ dotnet restore
|
||||
* Referencing Directly
|
||||
|
||||
Or-Tools for .netstandard includes two libraries, a library containing managed code and a libraries containing native code.
|
||||
If a reference is made directly to the managed library, Visual Studio will not copy the native dll to the output folder.
|
||||
If a reference is made directly to the managed library, Visual Studio will not copy the native dll to the output folder.
|
||||
|
||||
A post build step is required to copy the file. In Visual Studio this can be added by selecting the "Build Events" tab in
|
||||
A post build step is required to copy the file. In Visual Studio this can be added by selecting the "Build Events" tab in
|
||||
project properties. Use the copy command example below to copy the file:
|
||||
|
||||
xcopy /Y "..\..\lib\ortools\Google.OrTools.Native.dll" "$(TargetDir)"
|
||||
@@ -73,12 +73,14 @@ https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0
|
||||
Alternatively the command below can be used to install the SDK:
|
||||
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 2.0
|
||||
|
||||
The build will attempt to detect the SDK path. If there are any issues please check the
|
||||
The build will attempt to detect the SDK path. If there are any issues please check the
|
||||
DOTNET_INSTALL_PATH variable in the Makefile.local file:
|
||||
|
||||
DOTNET_INSTALL_PATH=C:\Program Files\dotnet
|
||||
|
||||
The dotnet restore command will not update the nuget packages if the version does not change. This
|
||||
The dotnet restore command will not update the nuget packages if the version does not change. This
|
||||
can cause confusion when testing local builds. Use the command below to clear the package:
|
||||
|
||||
dotnet nuget locals all --clear
|
||||
```sh
|
||||
dotnet nuget locals all --clear
|
||||
```
|
||||
|
||||
@@ -1,103 +1,133 @@
|
||||
import logging, sys, inspect
|
||||
from optparse import OptionParser
|
||||
#!/usr/bin/env python3
|
||||
"""Check user python installation."""
|
||||
import inspect
|
||||
import logging
|
||||
import optparse
|
||||
import sys
|
||||
|
||||
#try to import setuptools
|
||||
# try to import setuptools
|
||||
try:
|
||||
from setuptools import setup, Extension
|
||||
from setuptools.command import easy_install
|
||||
from setuptools import setup # pylint: disable=g-import-not-at-top,unused-import
|
||||
from setuptools import Extension # pylint: disable=g-import-not-at-top,unused-import
|
||||
from setuptools.command import easy_install # pylint: disable=g-import-not-at-top,unused-import
|
||||
except ImportError:
|
||||
raise ImportError("""setuptools is not installed for \"""" + sys.executable + """\"
|
||||
raise ImportError("""setuptools is not installed for \"""" + sys.executable +
|
||||
"""\"
|
||||
Follow this link for installing instructions :
|
||||
https://pypi.python.org/pypi/setuptools
|
||||
make sure you use \"""" + sys.executable + """\" during the installation""")
|
||||
raise SystemExit
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from pkg_resources import parse_version # pylint: disable=g-import-not-at-top,unused-import
|
||||
|
||||
required_ortools_version = "VVVV"
|
||||
required_protobuf_version = "PROTOBUF_TAG"
|
||||
|
||||
|
||||
def notinstalled(modulename):
|
||||
return modulename + """ is not installed for \"""" + sys.executable + """\"
|
||||
return modulename + """ is not installed for \"""" + sys.executable + """\"
|
||||
Run \"""" + sys.executable + """ setup.py install --user\" to install it"""
|
||||
|
||||
|
||||
def absent_version(module, modulename):
|
||||
return """You are using a """ + modulename + """ module that doesn't have a __version__ attribute : """ + inspect.getfile(module) + """\"
|
||||
return """You are using a """ + modulename + """ module that doesn't have a __version__ attribute : """ + inspect.getfile(
|
||||
module) + """\"
|
||||
Run \"""" + sys.executable + """ setup.py install --user\" to upgrade.
|
||||
If the problem persists, remove the site-package that contains \"""" + inspect.getfile(module) + """\". You can do so either manually or by using pip."""
|
||||
If the problem persists, remove the site-package that contains \"""" + inspect.getfile(
|
||||
module) + """\". You can do so either manually or by using pip."""
|
||||
|
||||
|
||||
def wrong_version(module, modulename, required_version, installed_version):
|
||||
return """You are using """ + modulename + """-""" + installed_version + """ : """ + inspect.getfile(module) + """, while the required version is : """ + required_version + """
|
||||
return """You are using """ + modulename + """-""" + installed_version + """ : """ + inspect.getfile(
|
||||
module
|
||||
) + """, while the required version is : """ + required_version + """
|
||||
Run \"""" + sys.executable + """ setup.py install --user\" to upgrade.
|
||||
If the problem persists, remove the site-package that contains \"""" + inspect.getfile(module) + """\". You can do so either manually or by using pip."""
|
||||
If the problem persists, remove the site-package that contains \"""" + inspect.getfile(
|
||||
module) + """\". You can do so either manually or by using pip."""
|
||||
|
||||
|
||||
def log_error_and_exit(error_message):
|
||||
logging.error(error_message)
|
||||
raise SystemExit
|
||||
logging.error(error_message)
|
||||
raise SystemExit
|
||||
|
||||
|
||||
def check_absent_version(module, modulename):
|
||||
if not hasattr(module, '__version__'):
|
||||
log_error_and_exit(absent_version(module, modulename))
|
||||
if not hasattr(module, "__version__"):
|
||||
log_error_and_exit(absent_version(module, modulename))
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser('Log level')
|
||||
parser.add_option('-l','--log',type='string',help='Available levels are CRITICAL (3), ERROR (2), WARNING (1), INFO (0), DEBUG (-1)',default='INFO')
|
||||
options,args = parser.parse_args()
|
||||
|
||||
#Create the logger
|
||||
try:
|
||||
loglevel = getattr(logging,options.log.upper())
|
||||
except AttributeError:
|
||||
loglevel = {3:logging.CRITICAL,
|
||||
2:logging.ERROR,
|
||||
1:logging.WARNING,
|
||||
0:logging.INFO,
|
||||
-1:logging.DEBUG,
|
||||
}[int(options.log)]
|
||||
if __name__ == "__main__":
|
||||
parser = optparse.OptionParser("Log level")
|
||||
parser.add_option(
|
||||
"-l",
|
||||
"--log",
|
||||
type="string",
|
||||
help="Available levels are CRITICAL (3), ERROR (2), WARNING (1), INFO (0), DEBUG (-1)",
|
||||
default="INFO")
|
||||
options, args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(format='[%(levelname)s] %(message)s', stream=sys.stdout, level=loglevel)
|
||||
# Create the logger
|
||||
try:
|
||||
loglevel = getattr(logging, options.log.upper())
|
||||
except AttributeError:
|
||||
loglevel = {
|
||||
3: logging.CRITICAL,
|
||||
2: logging.ERROR,
|
||||
1: logging.WARNING,
|
||||
0: logging.INFO,
|
||||
-1: logging.DEBUG,
|
||||
}[int(options.log)]
|
||||
|
||||
#Display Python Version and path
|
||||
logging.info("Python path : " + sys.executable)
|
||||
logging.info("Python version : " + sys.version)
|
||||
logging.basicConfig(
|
||||
format="[%(levelname)s] %(message)s", stream=sys.stdout, level=loglevel)
|
||||
|
||||
#Choose the pypi package
|
||||
ortools_name = "ortools"
|
||||
# Display Python Version and path
|
||||
logging.info(f"Python path : {sys.executable}")
|
||||
logging.info(f"Python version : {sys.version}")
|
||||
|
||||
#try to import ortools
|
||||
try:
|
||||
import ortools
|
||||
except ImportError:
|
||||
log_error_and_exit(notinstalled(ortools_name))
|
||||
# Choose the pypi package
|
||||
ortools_name = "ortools"
|
||||
|
||||
#try to import protobuf
|
||||
try:
|
||||
import google.protobuf
|
||||
except ImportError:
|
||||
log_error_and_exit(notinstalled("protobuf"))
|
||||
# try to import ortools
|
||||
try:
|
||||
import ortools # pylint: disable=g-import-not-at-top
|
||||
except ImportError:
|
||||
log_error_and_exit(notinstalled(ortools_name))
|
||||
|
||||
#check ortools version
|
||||
try:
|
||||
check_absent_version(ortools, "ortools")
|
||||
if required_ortools_version != ortools.__version__:
|
||||
raise Exception
|
||||
logging.info("or-tools version : " + ortools.__version__ + "\n" + inspect.getfile(ortools))
|
||||
except (AttributeError, Exception):
|
||||
log_error_and_exit(wrong_version(ortools, ortools_name, required_ortools_version, ortools.__version__))
|
||||
# try to import protobuf
|
||||
try:
|
||||
import google.protobuf # pylint: disable=g-import-not-at-top
|
||||
except ImportError:
|
||||
log_error_and_exit(notinstalled("protobuf"))
|
||||
|
||||
#check protobuf version
|
||||
try:
|
||||
check_absent_version(google.protobuf, "protobuf")
|
||||
if required_protobuf_version != google.protobuf.__version__:
|
||||
raise Exception
|
||||
logging.info("protobuf version : " + google.protobuf.__version__+ "\n" + inspect.getfile(google.protobuf) )
|
||||
except (AttributeError, Exception):
|
||||
log_error_and_exit(wrong_version(google.protobuf, "protobuf", required_protobuf_version, google.protobuf.__version__))
|
||||
# check ortools version
|
||||
try:
|
||||
check_absent_version(ortools, "ortools")
|
||||
if required_ortools_version != ortools.__version__:
|
||||
raise Exception
|
||||
logging.info("or-tools version : " + ortools.__version__ + "\n" +
|
||||
inspect.getfile(ortools))
|
||||
except (AttributeError, Exception): # pylint: disable=broad-except
|
||||
log_error_and_exit(
|
||||
wrong_version(ortools, ortools_name, required_ortools_version,
|
||||
ortools.__version__))
|
||||
|
||||
# Check if python can load the libraries' modules
|
||||
# this is useful when the library architecture is not compatbile with the python executable,
|
||||
# or when the library's dependencies are not available or not compatible.
|
||||
from ortools.constraint_solver import _pywrapcp
|
||||
from ortools.linear_solver import _pywraplp
|
||||
from ortools.algorithms import _pywrapknapsack_solver
|
||||
from ortools.graph import _pywrapgraph
|
||||
# check protobuf version
|
||||
try:
|
||||
check_absent_version(google.protobuf, "protobuf")
|
||||
if required_protobuf_version != google.protobuf.__version__:
|
||||
raise Exception
|
||||
logging.info("protobuf version : " + google.protobuf.__version__ + "\n" +
|
||||
inspect.getfile(google.protobuf))
|
||||
except (AttributeError, Exception): # pylint: disable=broad-except
|
||||
log_error_and_exit(
|
||||
wrong_version(google.protobuf, "protobuf", required_protobuf_version,
|
||||
google.protobuf.__version__))
|
||||
|
||||
# Check if python can load the libraries' modules
|
||||
# this is useful when the library architecture is not compatbile with the
|
||||
# python executable, or when the library's dependencies are not available or
|
||||
# not compatible.
|
||||
from ortools.constraint_solver import _pywrapcp # pylint: disable=g-import-not-at-top,unused-import
|
||||
from ortools.linear_solver import _pywraplp # pylint: disable=g-import-not-at-top,unused-import
|
||||
from ortools.algorithms import _pywrapknapsack_solver # pylint: disable=g-import-not-at-top,unused-import
|
||||
from ortools.graph import _pywrapgraph # pylint: disable=g-import-not-at-top,unused-import
|
||||
|
||||
@@ -1,56 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Transform any Python sample or example to Python NoteBook."""
|
||||
import ast
|
||||
from nbformat import v3, v4
|
||||
import sys
|
||||
from nbformat import v3
|
||||
from nbformat import v4
|
||||
|
||||
input = sys.argv[1]
|
||||
print('reading %s' % input)
|
||||
with open(input) as fpin:
|
||||
text = fpin.read()
|
||||
input_file = sys.argv[1]
|
||||
print('reading %s' % input_file)
|
||||
with open(input_file) as fpin:
|
||||
text = fpin.read()
|
||||
|
||||
nbook = v3.reads_py('')
|
||||
nbook = v4.upgrade(nbook) # Upgrade v3 to v4
|
||||
|
||||
all_blocks = ast.parse(text).body
|
||||
line_start = [c.lineno-1 for c in all_blocks]
|
||||
line_start = [c.lineno - 1 for c in all_blocks]
|
||||
line_start[0] = 0
|
||||
lines = text.split('\n')
|
||||
|
||||
full_text = ''
|
||||
|
||||
for c_block, s, e in zip(all_blocks, line_start, line_start[1:]+[len(lines)]):
|
||||
c_text = '\n'.join(lines[s:e])
|
||||
if isinstance(c_block, ast.If) and c_block.test.comparators[0].s=='__main__':
|
||||
print('Skip if main', lines[s:e])
|
||||
elif isinstance(c_block, ast.FunctionDef) and c_block.name=='main':
|
||||
# remove start and de-indent lines
|
||||
c_lines = lines[s+1:e]
|
||||
spaces_to_delete = c_block.body[0].col_offset
|
||||
fixed_lines = [n_line[spaces_to_delete:] if n_line.startswith(' '*spaces_to_delete)
|
||||
else n_line for n_line in c_lines]
|
||||
fixed_text = '\n'.join(fixed_lines)
|
||||
print('Unwrapping main function')
|
||||
full_text += fixed_text
|
||||
else:
|
||||
print('appending', c_block)
|
||||
full_text += c_text + '\n'
|
||||
for c_block, s, e in zip(all_blocks, line_start, line_start[1:] + [len(lines)]):
|
||||
c_text = '\n'.join(lines[s:e])
|
||||
if isinstance(c_block,
|
||||
ast.If) and c_block.test.comparators[0].s == '__main__':
|
||||
print('Skip if main', lines[s:e])
|
||||
elif isinstance(c_block, ast.FunctionDef) and c_block.name == 'main':
|
||||
# remove start and de-indent lines
|
||||
c_lines = lines[s + 1:e]
|
||||
spaces_to_delete = c_block.body[0].col_offset
|
||||
fixed_lines = [
|
||||
n_line[spaces_to_delete:]
|
||||
if n_line.startswith(' ' * spaces_to_delete) else n_line
|
||||
for n_line in c_lines
|
||||
]
|
||||
fixed_text = '\n'.join(fixed_lines)
|
||||
print('Unwrapping main function')
|
||||
full_text += fixed_text
|
||||
else:
|
||||
print('appending', c_block)
|
||||
full_text += c_text + '\n'
|
||||
|
||||
nbook['cells'].append(v4.new_code_cell(full_text))
|
||||
|
||||
|
||||
jsonform = v4.writes(nbook) + '\n'
|
||||
output = input
|
||||
output = output.replace('.py', '.ipynb')
|
||||
output_file = input_file
|
||||
output_file = output_file.replace('.py', '.ipynb')
|
||||
# For example/python/foo.py -> example/notebook/examples/foo.ipynb
|
||||
output = output.replace('examples/python', 'examples/notebook/examples')
|
||||
output_file = output_file.replace('examples/python',
|
||||
'examples/notebook/examples')
|
||||
|
||||
# For example/contrib/foo.py -> example/notebook/contrib/foo.ipynb
|
||||
output = output.replace('examples/contrib', 'examples/notebook/contrib')
|
||||
output_file = output_file.replace('examples/contrib',
|
||||
'examples/notebook/contrib')
|
||||
|
||||
# For ortools/*/samples/foo.py -> example/notebook/*/foo.ipynb
|
||||
output = output.replace('ortools', 'examples/notebook')
|
||||
output = output.replace('samples/', '')
|
||||
output_file = output_file.replace('ortools', 'examples/notebook')
|
||||
output_file = output_file.replace('samples/', '')
|
||||
|
||||
print('writing %s' % output)
|
||||
with open(output, "w") as fpout:
|
||||
fpout.write(jsonform)
|
||||
print('writing %s' % output_file)
|
||||
with open(output_file, 'w') as fpout:
|
||||
fpout.write(jsonform)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
for deps in `grep -e "\#include \"$dir" src/$1/*.h src/$1/*cc | cut -d '"' -f 2 | sort -u`
|
||||
for deps in $(grep -e "\#include \"$dir" "src/$1/*.h" "src/$1/*.cc" | cut -d '"' -f 2 | sort -u)
|
||||
do
|
||||
echo $deps
|
||||
echo "$deps"
|
||||
done
|
||||
|
||||
@@ -35,7 +35,7 @@ done
|
||||
for FILE in examples/contrib/*.py; do
|
||||
# if no files found do nothing
|
||||
[[ -e "$FILE" ]] || continue
|
||||
if [ $(basename "$FILE") == "word_square.py" ]; then continue; fi
|
||||
if [[ $(basename "$FILE") == "word_square.py" ]]; then continue; fi
|
||||
mkdir -p examples/notebook/contrib
|
||||
echo "Generating ${FILE%.py}.ipynb"
|
||||
./tools/export_to_ipynb.py "$FILE";
|
||||
@@ -47,8 +47,8 @@ done
|
||||
for FILE in ortools/*/samples/*.py ; do
|
||||
# if no files found do nothing
|
||||
[[ -e "$FILE" ]] || continue
|
||||
D=$(dirname $(dirname "${FILE}"))
|
||||
mkdir -p ${D/ortools/examples\/notebook}
|
||||
D=$(dirname "$(dirname "${FILE}")")
|
||||
mkdir -p "${D/ortools/examples\/notebook}"
|
||||
echo "Generating ${FILE%.py}.ipynb"
|
||||
./tools/export_to_ipynb.py "$FILE"
|
||||
done
|
||||
|
||||
@@ -41,7 +41,7 @@ function print_paths {
|
||||
# Output: all the files these files depend on (given by their #include,
|
||||
# by their "import" for proto files).
|
||||
function get_dependencies {
|
||||
grep -e "^\(#include\|import\) \"ortools/" $* \
|
||||
grep -e "^\(#include\|import\) \"ortools/" "$*" \
|
||||
| cut -d '"' -f 2 | LC_COLLATE=C sort -u
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ function get_dependencies {
|
||||
# Output: dependencies command for that file:
|
||||
# objs/sub_dir/filename.o : ortools/
|
||||
function print_dependencies {
|
||||
cmd=$(gcc -MM -MT objs/${2}/${1}.o -c ortools/${2}/${1}.cc -I. -Iortools/gen \
|
||||
cmd=$(gcc -MM -MT "objs/${2}/${1}.o" -c "ortools/${2}/${1}.cc" -I. -Iortools/gen \
|
||||
-isystem dependencies/install/include \
|
||||
-isystem dependencies/install/include/coin \
|
||||
-DUSE_GLOP -DUSE_BOP -DUSE_CLP -DUSE_CBC \
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
from sys import executable
|
||||
"""Setup.py for data package."""
|
||||
from os import path
|
||||
import sys
|
||||
|
||||
setuptools_import_error_message = """setuptools is not installed for """ + executable + """
|
||||
setuptools_import_error_message = """setuptools is not installed for """ + sys.executable + """
|
||||
Please follow this link for installing instructions :
|
||||
https://pypi.python.org/pypi/setuptools
|
||||
make sure you use \"""" + executable + """\" during the installation"""
|
||||
make sure you use \"""" + sys.executable + """\" during the installation"""
|
||||
|
||||
try:
|
||||
from setuptools import setup, Extension
|
||||
from setuptools import setup # pylint: disable=g-import-not-at-top
|
||||
except ImportError:
|
||||
raise ImportError(setuptools_import_error_message)
|
||||
|
||||
from os.path import join as pjoin
|
||||
from os.path import dirname
|
||||
from sys import version_info
|
||||
raise ImportError(setuptools_import_error_message)
|
||||
|
||||
|
||||
# Utility function to read the README file.
|
||||
@@ -20,23 +18,23 @@ from sys import version_info
|
||||
# README file and 2) it's easier to type in the README file than to put a raw
|
||||
# string in below ...
|
||||
def read(fname):
|
||||
return open(pjoin(dirname(__file__), fname)).read()
|
||||
return open(path.join(path.dirname(__file__), fname)).read()
|
||||
|
||||
install_requires = ["ortoolsXXXX == VVVV"]
|
||||
install_requires = ['ortoolsXXXX == VVVV']
|
||||
|
||||
setup(
|
||||
name='ortools_examples',
|
||||
version='VVVV',
|
||||
install_requires = install_requires,
|
||||
install_requires=install_requires,
|
||||
license='Apache 2.0',
|
||||
author = 'Google Inc',
|
||||
author_email = 'lperron@google.com',
|
||||
description = 'Google OR-Tools python libraries and modules',
|
||||
keywords = ('operations research, constraint programming, ' +
|
||||
'linear programming,' + 'flow algorithms,' +
|
||||
'python'),
|
||||
url = 'https://developers.google.com/optimization/',
|
||||
classifiers = [
|
||||
author='Google Inc',
|
||||
author_email='lperron@google.com',
|
||||
description='Google OR-Tools python libraries and modules',
|
||||
keywords=('operations research, constraint programming, ' +
|
||||
'linear programming,' + 'flow algorithms,' +
|
||||
'python'),
|
||||
url='https://developers.google.com/optimization/',
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
@@ -52,5 +50,5 @@ setup(
|
||||
'Topic :: Scientific/Engineering',
|
||||
'Topic :: Scientific/Engineering :: Mathematics',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules'],
|
||||
long_description = read('README.txt'),
|
||||
long_description=read('README.txt'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user