diff --git a/examples/notebook/algorithms/knapsack.ipynb b/examples/notebook/algorithms/knapsack.ipynb
index 76e1a70980..d8c7c861d3 100644
--- a/examples/notebook/algorithms/knapsack.ipynb
+++ b/examples/notebook/algorithms/knapsack.ipynb
@@ -41,10 +41,10 @@
"source": [
"
"
]
diff --git a/examples/notebook/algorithms/simple_knapsack_program.ipynb b/examples/notebook/algorithms/simple_knapsack_program.ipynb
index de7cf21d02..871ce6577c 100644
--- a/examples/notebook/algorithms/simple_knapsack_program.ipynb
+++ b/examples/notebook/algorithms/simple_knapsack_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"A simple knapsack problem."
]
},
diff --git a/examples/notebook/constraint_solver/cp_is_fun_cp.ipynb b/examples/notebook/constraint_solver/cp_is_fun_cp.ipynb
index ae4c0d1fa5..76f3a21b6c 100644
--- a/examples/notebook/constraint_solver/cp_is_fun_cp.ipynb
+++ b/examples/notebook/constraint_solver/cp_is_fun_cp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Cryptarithmetic puzzle.\n",
"\n",
"First attempt to solve equation CP + IS + FUN = TRUE\n",
diff --git a/examples/notebook/constraint_solver/cvrp.ipynb b/examples/notebook/constraint_solver/cvrp.ipynb
index 739a1d2aa4..cfbb9bb59e 100644
--- a/examples/notebook/constraint_solver/cvrp.ipynb
+++ b/examples/notebook/constraint_solver/cvrp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/cvrp_reload.ipynb b/examples/notebook/constraint_solver/cvrp_reload.ipynb
index 80e2e1682e..e10d3afe86 100644
--- a/examples/notebook/constraint_solver/cvrp_reload.ipynb
+++ b/examples/notebook/constraint_solver/cvrp_reload.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/cvrptw.ipynb b/examples/notebook/constraint_solver/cvrptw.ipynb
index ba2e1ce342..78d0628d1a 100644
--- a/examples/notebook/constraint_solver/cvrptw.ipynb
+++ b/examples/notebook/constraint_solver/cvrptw.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/cvrptw_break.ipynb b/examples/notebook/constraint_solver/cvrptw_break.ipynb
index a6e1fefa08..358854d3d4 100644
--- a/examples/notebook/constraint_solver/cvrptw_break.ipynb
+++ b/examples/notebook/constraint_solver/cvrptw_break.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Capacitated Vehicle Routing Problem with Time Windows (CVRPTW).\n",
"\n",
" This is a sample using the routing library python wrapper to solve a CVRPTW\n",
diff --git a/examples/notebook/constraint_solver/nqueens_cp.ipynb b/examples/notebook/constraint_solver/nqueens_cp.ipynb
index a7a4401b85..fc48174720 100644
--- a/examples/notebook/constraint_solver/nqueens_cp.ipynb
+++ b/examples/notebook/constraint_solver/nqueens_cp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"OR-Tools solution to the N-queens problem."
]
},
diff --git a/examples/notebook/constraint_solver/simple_cp_program.ipynb b/examples/notebook/constraint_solver/simple_cp_program.ipynb
index 8fc5d5379f..cb87df96b0 100644
--- a/examples/notebook/constraint_solver/simple_cp_program.ipynb
+++ b/examples/notebook/constraint_solver/simple_cp_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Constraint optimization example.\n"
]
},
diff --git a/examples/notebook/constraint_solver/simple_routing_program.ipynb b/examples/notebook/constraint_solver/simple_routing_program.ipynb
index 48b7b9dcab..5c6f37c9ad 100644
--- a/examples/notebook/constraint_solver/simple_routing_program.ipynb
+++ b/examples/notebook/constraint_solver/simple_routing_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicle Routing example.\n"
]
},
diff --git a/examples/notebook/constraint_solver/tsp.ipynb b/examples/notebook/constraint_solver/tsp.ipynb
index c47ecf3f49..2461591042 100644
--- a/examples/notebook/constraint_solver/tsp.ipynb
+++ b/examples/notebook/constraint_solver/tsp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Travelling Salesman Problem.\n",
"\n",
"A description of the problem can be found here:\n",
diff --git a/examples/notebook/constraint_solver/tsp_circuit_board.ipynb b/examples/notebook/constraint_solver/tsp_circuit_board.ipynb
index c3e533304c..1846185f62 100644
--- a/examples/notebook/constraint_solver/tsp_circuit_board.ipynb
+++ b/examples/notebook/constraint_solver/tsp_circuit_board.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Travelling Salesperson Problem (TSP) on a circuit board.\n"
]
},
diff --git a/examples/notebook/constraint_solver/tsp_cities.ipynb b/examples/notebook/constraint_solver/tsp_cities.ipynb
index 5a5bb06739..f8bf108f34 100644
--- a/examples/notebook/constraint_solver/tsp_cities.ipynb
+++ b/examples/notebook/constraint_solver/tsp_cities.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Travelling Salesperson Problem (TSP) between cities.\n"
]
},
diff --git a/examples/notebook/constraint_solver/tsp_distance_matrix.ipynb b/examples/notebook/constraint_solver/tsp_distance_matrix.ipynb
index abada7d4e6..ef7e73246a 100644
--- a/examples/notebook/constraint_solver/tsp_distance_matrix.ipynb
+++ b/examples/notebook/constraint_solver/tsp_distance_matrix.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Travelling Salesman Problem.\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp.ipynb b/examples/notebook/constraint_solver/vrp.ipynb
index 89ad8fc2fc..3d860ab44e 100644
--- a/examples/notebook/constraint_solver/vrp.ipynb
+++ b/examples/notebook/constraint_solver/vrp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Vehicles Routing Problem (VRP).\n",
"\n",
" This is a sample using the routing library python wrapper to solve a VRP\n",
diff --git a/examples/notebook/constraint_solver/vrp_breaks.ipynb b/examples/notebook/constraint_solver/vrp_breaks.ipynb
index 2bb568662b..91d2ae8fb0 100644
--- a/examples/notebook/constraint_solver/vrp_breaks.ipynb
+++ b/examples/notebook/constraint_solver/vrp_breaks.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicle Routing Problem (VRP) with breaks.\n",
"\n",
" This is a sample using the routing library python wrapper to solve a VRP\n",
diff --git a/examples/notebook/constraint_solver/vrp_breaks_from_start.ipynb b/examples/notebook/constraint_solver/vrp_breaks_from_start.ipynb
index 82294b75c6..5e68c52d7c 100644
--- a/examples/notebook/constraint_solver/vrp_breaks_from_start.ipynb
+++ b/examples/notebook/constraint_solver/vrp_breaks_from_start.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/vrp_capacity.ipynb b/examples/notebook/constraint_solver/vrp_capacity.ipynb
index 1b73061f21..7c936bfd83 100644
--- a/examples/notebook/constraint_solver/vrp_capacity.ipynb
+++ b/examples/notebook/constraint_solver/vrp_capacity.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Capacited Vehicles Routing Problem (CVRP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_drop_nodes.ipynb b/examples/notebook/constraint_solver/vrp_drop_nodes.ipynb
index 0353098f13..27b7fe5028 100644
--- a/examples/notebook/constraint_solver/vrp_drop_nodes.ipynb
+++ b/examples/notebook/constraint_solver/vrp_drop_nodes.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Capacited Vehicles Routing Problem (CVRP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_global_span.ipynb b/examples/notebook/constraint_solver/vrp_global_span.ipynb
index 65e3a74bef..ec9b8399fa 100644
--- a/examples/notebook/constraint_solver/vrp_global_span.ipynb
+++ b/examples/notebook/constraint_solver/vrp_global_span.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Vehicles Routing Problem (VRP).\n",
"\n",
" This is a sample using the routing library python wrapper to solve a VRP\n",
diff --git a/examples/notebook/constraint_solver/vrp_initial_routes.ipynb b/examples/notebook/constraint_solver/vrp_initial_routes.ipynb
index 8958dc65a0..5d943e1595 100644
--- a/examples/notebook/constraint_solver/vrp_initial_routes.ipynb
+++ b/examples/notebook/constraint_solver/vrp_initial_routes.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicles Routing Problem (VRP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_items_to_deliver.ipynb b/examples/notebook/constraint_solver/vrp_items_to_deliver.ipynb
new file mode 100644
index 0000000000..be130f08aa
--- /dev/null
+++ b/examples/notebook/constraint_solver/vrp_items_to_deliver.ipynb
@@ -0,0 +1,387 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "google",
+ "metadata": {},
+ "source": [
+ "##### Copyright 2022 Google LLC."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "apache",
+ "metadata": {},
+ "source": [
+ "Licensed under the Apache License, Version 2.0 (the \"License\");\n",
+ "you may not use this file except in compliance with the License.\n",
+ "You may obtain a copy of the License at\n",
+ "\n",
+ " http://www.apache.org/licenses/LICENSE-2.0\n",
+ "\n",
+ "Unless required by applicable law or agreed to in writing, software\n",
+ "distributed under the License is distributed on an \"AS IS\" BASIS,\n",
+ "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
+ "See the License for the specific language governing permissions and\n",
+ "limitations under the License.\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "basename",
+ "metadata": {},
+ "source": [
+ "# vrp_items_to_deliver"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "link",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "doc",
+ "metadata": {},
+ "source": [
+ "First, you must install [ortools](https://pypi.org/project/ortools/) package in this colab."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "install",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "!pip install ortools"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "description",
+ "metadata": {},
+ "source": [
+ "Vehicles Routing Problem (VRP) for delivering items from any suppliers.\n",
+ "Description:\n",
+ "Need to deliver some item X and Y at end nodes (at least 11 X and 13 Y).\n",
+ "Several locations provide them and even few provide both.\n",
+ "\n",
+ "fleet:\n",
+ " * vehicles: 2\n",
+ " * x capacity: 15\n",
+ " * y capacity: 15\n",
+ " * start node: 0\n",
+ " * end node: 1\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "code",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from ortools.constraint_solver import routing_enums_pb2\n",
+ "from ortools.constraint_solver import pywrapcp\n",
+ "\n",
+ "\n",
+ "\n",
+ "def create_data_model():\n",
+ " \"\"\"Stores the data for the problem.\"\"\"\n",
+ " data = {}\n",
+ " data['num_vehicles'] = 2\n",
+ " data['starts'] = [0] * data['num_vehicles']\n",
+ " data['ends'] = [1] * data['num_vehicles']\n",
+ " assert len(data['starts']) == data['num_vehicles']\n",
+ " assert len(data['ends']) == data['num_vehicles']\n",
+ "\n",
+ " # Need 11 X and 13 Y\n",
+ " data['providers_x'] = [\n",
+ " 0, # start\n",
+ " -11, # end\n",
+ " 2, # X supply 1\n",
+ " 2, # X supply 2\n",
+ " 4, # X supply 3\n",
+ " 4, # X supply 4\n",
+ " 4, # X supply 5\n",
+ " 5, # X supply 6\n",
+ " 1, # X/Y supply 1\n",
+ " 2, # X/Y supply 2\n",
+ " 2, # X/Y supply 3\n",
+ " 0, # Y supply 1\n",
+ " 0, # Y supply 2\n",
+ " 0, # Y supply 3\n",
+ " 0, # Y supply 4\n",
+ " 0, # Y supply 5\n",
+ " 0, # Y supply 6\n",
+ " ]\n",
+ " data['providers_y'] = [\n",
+ " 0, # start\n",
+ " -13, # ends\n",
+ " 0, # X supply 1\n",
+ " 0, # X supply 2\n",
+ " 0, # X supply 3\n",
+ " 0, # X supply 4\n",
+ " 0, # X supply 5\n",
+ " 0, # X supply 6\n",
+ " 3, # X/Y supply 1\n",
+ " 2, # X/Y supply 2\n",
+ " 1, # X/Y supply 3\n",
+ " 3, # Y supply 1\n",
+ " 3, # Y supply 2\n",
+ " 3, # Y supply 3\n",
+ " 3, # Y supply 4\n",
+ " 3, # Y supply 5\n",
+ " 5, # Y supply 6\n",
+ " ]\n",
+ " data['vehicle_capacities_x'] = [15] * data['num_vehicles']\n",
+ " data['vehicle_capacities_y'] = [15] * data['num_vehicles']\n",
+ " assert len(data['vehicle_capacities_x']) == data['num_vehicles']\n",
+ " assert len(data['vehicle_capacities_y']) == data['num_vehicles']\n",
+ " data['distance_matrix'] = [\n",
+ " [\n",
+ " 0, 548, 776, 696, 582, 274, 502, 194, 308, 194, 536, 502, 388, 354,\n",
+ " 468, 776, 662\n",
+ " ],\n",
+ " [\n",
+ " 548, 0, 684, 308, 194, 502, 730, 354, 696, 742, 1084, 594, 480,\n",
+ " 674, 1016, 868, 1210\n",
+ " ],\n",
+ " [\n",
+ " 776, 684, 0, 992, 878, 502, 274, 810, 468, 742, 400, 1278, 1164,\n",
+ " 1130, 788, 1552, 754\n",
+ " ],\n",
+ " [\n",
+ " 696, 308, 992, 0, 114, 650, 878, 502, 844, 890, 1232, 514, 628,\n",
+ " 822, 1164, 560, 1358\n",
+ " ],\n",
+ " [\n",
+ " 582, 194, 878, 114, 0, 536, 764, 388, 730, 776, 1118, 400, 514,\n",
+ " 708, 1050, 674, 1244\n",
+ " ],\n",
+ " [\n",
+ " 274, 502, 502, 650, 536, 0, 228, 308, 194, 240, 582, 776, 662, 628,\n",
+ " 514, 1050, 708\n",
+ " ],\n",
+ " [\n",
+ " 502, 730, 274, 878, 764, 228, 0, 536, 194, 468, 354, 1004, 890,\n",
+ " 856, 514, 1278, 480\n",
+ " ],\n",
+ " [\n",
+ " 194, 354, 810, 502, 388, 308, 536, 0, 342, 388, 730, 468, 354, 320,\n",
+ " 662, 742, 856\n",
+ " ],\n",
+ " [\n",
+ " 308, 696, 468, 844, 730, 194, 194, 342, 0, 274, 388, 810, 696, 662,\n",
+ " 320, 1084, 514\n",
+ " ],\n",
+ " [\n",
+ " 194, 742, 742, 890, 776, 240, 468, 388, 274, 0, 342, 536, 422, 388,\n",
+ " 274, 810, 468\n",
+ " ],\n",
+ " [\n",
+ " 536, 1084, 400, 1232, 1118, 582, 354, 730, 388, 342, 0, 878, 764,\n",
+ " 730, 388, 1152, 354\n",
+ " ],\n",
+ " [\n",
+ " 502, 594, 1278, 514, 400, 776, 1004, 468, 810, 536, 878, 0, 114,\n",
+ " 308, 650, 274, 844\n",
+ " ],\n",
+ " [\n",
+ " 388, 480, 1164, 628, 514, 662, 890, 354, 696, 422, 764, 114, 0,\n",
+ " 194, 536, 388, 730\n",
+ " ],\n",
+ " [\n",
+ " 354, 674, 1130, 822, 708, 628, 856, 320, 662, 388, 730, 308, 194,\n",
+ " 0, 342, 422, 536\n",
+ " ],\n",
+ " [\n",
+ " 468, 1016, 788, 1164, 1050, 514, 514, 662, 320, 274, 388, 650, 536,\n",
+ " 342, 0, 764, 194\n",
+ " ],\n",
+ " [\n",
+ " 776, 868, 1552, 560, 674, 1050, 1278, 742, 1084, 810, 1152, 274,\n",
+ " 388, 422, 764, 0, 798\n",
+ " ],\n",
+ " [\n",
+ " 662, 1210, 754, 1358, 1244, 708, 480, 856, 514, 468, 354, 844, 730,\n",
+ " 536, 194, 798, 0\n",
+ " ],\n",
+ " ]\n",
+ " assert len(data['providers_x']) == len(data['distance_matrix'])\n",
+ " assert len(data['providers_y']) == len(data['distance_matrix'])\n",
+ " return data\n",
+ "\n",
+ "\n",
+ "def print_solution(data, manager, routing, assignment):\n",
+ " \"\"\"Prints assignment on console.\"\"\"\n",
+ " print(f'Objective: {assignment.ObjectiveValue()}')\n",
+ " # Display dropped nodes.\n",
+ " dropped_nodes = 'Dropped nodes:'\n",
+ " for node in range(routing.Size()):\n",
+ " if routing.IsStart(node) or routing.IsEnd(node):\n",
+ " continue\n",
+ " if assignment.Value(routing.NextVar(node)) == node:\n",
+ " dropped_nodes += f' {manager.IndexToNode(node)}'\n",
+ " print(dropped_nodes)\n",
+ " # Display routes\n",
+ " total_distance = 0\n",
+ " total_load_x = 0\n",
+ " total_load_y = 0\n",
+ " for vehicle_id in range(manager.GetNumberOfVehicles()):\n",
+ " index = routing.Start(vehicle_id)\n",
+ " plan_output = f'Route for vehicle {vehicle_id}:\\n'\n",
+ " route_distance = 0\n",
+ " route_load_x = 0\n",
+ " route_load_y = 0\n",
+ " while not routing.IsEnd(index):\n",
+ " node_index = manager.IndexToNode(index)\n",
+ " route_load_x += data['providers_x'][node_index]\n",
+ " route_load_y += data['providers_y'][node_index]\n",
+ " plan_output += f' {node_index} Load(X:{route_load_x}, Y:{route_load_y}) -> '\n",
+ " previous_index = index\n",
+ " previous_node_index = node_index\n",
+ " index = assignment.Value(routing.NextVar(index))\n",
+ " node_index = manager.IndexToNode(index)\n",
+ " #route_distance += routing.GetArcCostForVehicle(previous_index, index, vehicle_id)\n",
+ " route_distance += data['distance_matrix'][previous_node_index][node_index]\n",
+ " node_index = manager.IndexToNode(index)\n",
+ " plan_output += f' {node_index} Load({route_load_x}, {route_load_y})\\n'\n",
+ " plan_output += f'Distance of the route: {route_distance}m\\n'\n",
+ " plan_output += f'Load of the route: X:{route_load_x}, Y:{route_load_y}\\n'\n",
+ " print(plan_output)\n",
+ " total_distance += route_distance\n",
+ " total_load_x += route_load_x\n",
+ " total_load_y += route_load_y\n",
+ " print(f'Total Distance of all routes: {total_distance}m')\n",
+ " print(f'Total load of all routes: X:{total_load_x}, Y:{total_load_y}')\n",
+ "\n",
+ "\n",
+ "def main():\n",
+ " \"\"\"Entry point of the program.\"\"\"\n",
+ " # Instantiate the data problem.\n",
+ " data = create_data_model()\n",
+ "\n",
+ " # Create the routing index manager.\n",
+ " manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']),\n",
+ " data['num_vehicles'],\n",
+ " data['starts'], data['ends'])\n",
+ "\n",
+ " # Create Routing Model.\n",
+ " routing = pywrapcp.RoutingModel(manager)\n",
+ "\n",
+ "\n",
+ " # Create and register a transit callback.\n",
+ " def distance_callback(from_index, to_index):\n",
+ " \"\"\"Returns the distance between the two nodes.\"\"\"\n",
+ " # Convert from routing variable Index to distance matrix NodeIndex.\n",
+ " from_node = manager.IndexToNode(from_index)\n",
+ " to_node = manager.IndexToNode(to_index)\n",
+ " return data['distance_matrix'][from_node][to_node]\n",
+ "\n",
+ " transit_callback_index = routing.RegisterTransitCallback(distance_callback)\n",
+ "\n",
+ " # Define cost of each arc.\n",
+ " routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)\n",
+ "\n",
+ " # Add Distance constraint.\n",
+ " dimension_name = 'Distance'\n",
+ " routing.AddDimension(\n",
+ " transit_callback_index,\n",
+ " 0, # no slack\n",
+ " 2000, # vehicle maximum travel distance\n",
+ " True, # start cumul to zero\n",
+ " dimension_name)\n",
+ " distance_dimension = routing.GetDimensionOrDie(dimension_name)\n",
+ " # Minimize the longest road\n",
+ " distance_dimension.SetGlobalSpanCostCoefficient(100)\n",
+ "\n",
+ " # Add Capacity constraint.\n",
+ " def demand_callback_x(from_index):\n",
+ " \"\"\"Returns the demand of the node.\"\"\"\n",
+ " # Convert from routing variable Index to demands NodeIndex.\n",
+ " from_node = manager.IndexToNode(from_index)\n",
+ " return data['providers_x'][from_node]\n",
+ "\n",
+ " demand_callback_x_index = routing.RegisterUnaryTransitCallback(demand_callback_x)\n",
+ " routing.AddDimensionWithVehicleCapacity(\n",
+ " demand_callback_x_index,\n",
+ " 0, # null capacity slack\n",
+ " data['vehicle_capacities_x'], # vehicle maximum capacities\n",
+ " True, # start cumul to zero\n",
+ " 'Load_x')\n",
+ "\n",
+ " def demand_callback_y(from_index):\n",
+ " \"\"\"Returns the demand of the node.\"\"\"\n",
+ " # Convert from routing variable Index to demands NodeIndex.\n",
+ " from_node = manager.IndexToNode(from_index)\n",
+ " return data['providers_y'][from_node]\n",
+ "\n",
+ " demand_callback_y_index = routing.RegisterUnaryTransitCallback(demand_callback_y)\n",
+ " routing.AddDimensionWithVehicleCapacity(\n",
+ " demand_callback_y_index,\n",
+ " 0, # null capacity slack\n",
+ " data['vehicle_capacities_y'], # vehicle maximum capacities\n",
+ " True, # start cumul to zero\n",
+ " 'Load_y')\n",
+ "\n",
+ " # Add constraint at end\n",
+ " solver = routing.solver()\n",
+ " load_x_dim = routing.GetDimensionOrDie('Load_x')\n",
+ " load_y_dim = routing.GetDimensionOrDie('Load_y')\n",
+ " ends = []\n",
+ " for v in range(manager.GetNumberOfVehicles()):\n",
+ " ends.append(routing.End(v))\n",
+ "\n",
+ " node_end = data['ends'][0]\n",
+ " solver.Add(solver.Sum([load_x_dim.CumulVar(l) for l in ends]) >= -data['providers_x'][node_end])\n",
+ " solver.Add(solver.Sum([load_y_dim.CumulVar(l) for l in ends]) >= -data['providers_y'][node_end])\n",
+ " #solver.Add(load_y_dim.CumulVar(end) >= -data['providers_y'][node_end])\n",
+ "\n",
+ " # Allow to freely drop any nodes.\n",
+ " penalty = 0\n",
+ " for node in range(0, len(data['distance_matrix'])):\n",
+ " if node not in data['starts'] and node not in data['ends']:\n",
+ " routing.AddDisjunction([manager.NodeToIndex(node)], penalty)\n",
+ "\n",
+ " # Setting first solution heuristic.\n",
+ " search_parameters = pywrapcp.DefaultRoutingSearchParameters()\n",
+ " search_parameters.first_solution_strategy = (\n",
+ " routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC)\n",
+ " search_parameters.local_search_metaheuristic = (\n",
+ " routing_enums_pb2.LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH)\n",
+ " # Sets a time limit; default is 100 milliseconds.\n",
+ " #search_parameters.log_search = True\n",
+ " search_parameters.time_limit.FromSeconds(1)\n",
+ "\n",
+ " # Solve the problem.\n",
+ " solution = routing.SolveWithParameters(search_parameters)\n",
+ "\n",
+ " # Print solution on console.\n",
+ " if solution:\n",
+ " print_solution(data, manager, routing, solution)\n",
+ " else:\n",
+ " print('no solution found !')\n",
+ "\n",
+ "\n",
+ "main()\n",
+ "\n"
+ ]
+ }
+ ],
+ "metadata": {},
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/examples/notebook/constraint_solver/vrp_node_max.ipynb b/examples/notebook/constraint_solver/vrp_node_max.ipynb
index e1a51f3bc1..de901b7554 100644
--- a/examples/notebook/constraint_solver/vrp_node_max.ipynb
+++ b/examples/notebook/constraint_solver/vrp_node_max.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicles Routing Problem (VRP).\n",
"\n",
"Each route as an associated objective cost equal to the max node value along the\n",
diff --git a/examples/notebook/constraint_solver/vrp_nodes_indices.ipynb b/examples/notebook/constraint_solver/vrp_nodes_indices.ipynb
index 2e3417fa7c..1a7af229b9 100644
--- a/examples/notebook/constraint_solver/vrp_nodes_indices.ipynb
+++ b/examples/notebook/constraint_solver/vrp_nodes_indices.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/vrp_pickup_delivery.ipynb b/examples/notebook/constraint_solver/vrp_pickup_delivery.ipynb
index b6e944fb5a..5a0bf25740 100644
--- a/examples/notebook/constraint_solver/vrp_pickup_delivery.ipynb
+++ b/examples/notebook/constraint_solver/vrp_pickup_delivery.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Pickup Delivery Problem (PDP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_pickup_delivery_fifo.ipynb b/examples/notebook/constraint_solver/vrp_pickup_delivery_fifo.ipynb
index 3808f10bb2..0f9c2562a2 100644
--- a/examples/notebook/constraint_solver/vrp_pickup_delivery_fifo.ipynb
+++ b/examples/notebook/constraint_solver/vrp_pickup_delivery_fifo.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Pickup Delivery Problem (PDP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_pickup_delivery_lifo.ipynb b/examples/notebook/constraint_solver/vrp_pickup_delivery_lifo.ipynb
index b8efb3ea97..dc6100cdb7 100644
--- a/examples/notebook/constraint_solver/vrp_pickup_delivery_lifo.ipynb
+++ b/examples/notebook/constraint_solver/vrp_pickup_delivery_lifo.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Pickup Delivery Problem (PDP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_resources.ipynb b/examples/notebook/constraint_solver/vrp_resources.ipynb
index a81b7cc946..e183378bf1 100644
--- a/examples/notebook/constraint_solver/vrp_resources.ipynb
+++ b/examples/notebook/constraint_solver/vrp_resources.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicles Routing Problem (VRP) with Resource Constraints.\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_starts_ends.ipynb b/examples/notebook/constraint_solver/vrp_starts_ends.ipynb
index 1ca21670f2..abd60c5dce 100644
--- a/examples/notebook/constraint_solver/vrp_starts_ends.ipynb
+++ b/examples/notebook/constraint_solver/vrp_starts_ends.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Vehicles Routing Problem.\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_time_windows.ipynb b/examples/notebook/constraint_solver/vrp_time_windows.ipynb
index 555a5472d6..9aacbe717d 100644
--- a/examples/notebook/constraint_solver/vrp_time_windows.ipynb
+++ b/examples/notebook/constraint_solver/vrp_time_windows.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicles Routing Problem (VRP) with Time Windows.\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrp_time_windows_per_vehicles.ipynb b/examples/notebook/constraint_solver/vrp_time_windows_per_vehicles.ipynb
index 91172e27f3..948c880086 100644
--- a/examples/notebook/constraint_solver/vrp_time_windows_per_vehicles.ipynb
+++ b/examples/notebook/constraint_solver/vrp_time_windows_per_vehicles.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/vrp_tokens.ipynb b/examples/notebook/constraint_solver/vrp_tokens.ipynb
index 0b37df8695..7f94f49360 100644
--- a/examples/notebook/constraint_solver/vrp_tokens.ipynb
+++ b/examples/notebook/constraint_solver/vrp_tokens.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/constraint_solver/vrp_with_time_limit.ipynb b/examples/notebook/constraint_solver/vrp_with_time_limit.ipynb
index 52103d61ff..fd01d6a4f9 100644
--- a/examples/notebook/constraint_solver/vrp_with_time_limit.ipynb
+++ b/examples/notebook/constraint_solver/vrp_with_time_limit.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Vehicles Routing Problem (VRP).\n"
]
},
diff --git a/examples/notebook/constraint_solver/vrpgs.ipynb b/examples/notebook/constraint_solver/vrpgs.ipynb
index 8279e9e152..87b74a850d 100644
--- a/examples/notebook/constraint_solver/vrpgs.ipynb
+++ b/examples/notebook/constraint_solver/vrpgs.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple Vehicles Routing Problem (VRP).\n",
"\n",
" This is a sample using the routing library python wrapper to solve a VRP\n",
diff --git a/examples/notebook/constraint_solver/vrptw_store_solution_data.ipynb b/examples/notebook/constraint_solver/vrptw_store_solution_data.ipynb
index 7a54eaa191..679cc2adc3 100644
--- a/examples/notebook/constraint_solver/vrptw_store_solution_data.ipynb
+++ b/examples/notebook/constraint_solver/vrptw_store_solution_data.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"VRPTW example that stores routes and cumulative data in an array.\n"
]
},
diff --git a/examples/notebook/contrib/3_jugs_mip.ipynb b/examples/notebook/contrib/3_jugs_mip.ipynb
index 0d84b2c363..d524c71fc5 100644
--- a/examples/notebook/contrib/3_jugs_mip.ipynb
+++ b/examples/notebook/contrib/3_jugs_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -101,19 +101,11 @@
"\n",
"\n",
"def main(sol='CBC'):\n",
- "\n",
" # Create the solver.\n",
- "\n",
" print('Solver: ', sol)\n",
- "\n",
- " # using GLPK\n",
- " if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
- " else:\n",
- " # Using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCBC',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/3_jugs_regular.ipynb b/examples/notebook/contrib/3_jugs_regular.ipynb
index f7f829e96c..09a3b718f5 100644
--- a/examples/notebook/contrib/3_jugs_regular.ipynb
+++ b/examples/notebook/contrib/3_jugs_regular.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/a_round_of_golf.ipynb b/examples/notebook/contrib/a_round_of_golf.ipynb
index 2ff0afcd88..4ebcfb378d 100644
--- a/examples/notebook/contrib/a_round_of_golf.ipynb
+++ b/examples/notebook/contrib/a_round_of_golf.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/all_interval.ipynb b/examples/notebook/contrib/all_interval.ipynb
index ec286d5b93..428ba201f9 100644
--- a/examples/notebook/contrib/all_interval.ipynb
+++ b/examples/notebook/contrib/all_interval.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/alldifferent_except_0.ipynb b/examples/notebook/contrib/alldifferent_except_0.ipynb
index c8fa4af119..0bcc12c820 100644
--- a/examples/notebook/contrib/alldifferent_except_0.ipynb
+++ b/examples/notebook/contrib/alldifferent_except_0.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/alphametic.ipynb b/examples/notebook/contrib/alphametic.ipynb
index d852b8bd87..1a677d2023 100644
--- a/examples/notebook/contrib/alphametic.ipynb
+++ b/examples/notebook/contrib/alphametic.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/assignment.ipynb b/examples/notebook/contrib/assignment.ipynb
index 4c55219fd6..4a597dd27c 100644
--- a/examples/notebook/contrib/assignment.ipynb
+++ b/examples/notebook/contrib/assignment.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/assignment6_mip.ipynb b/examples/notebook/contrib/assignment6_mip.ipynb
index c405a2c19e..74734dc1ef 100644
--- a/examples/notebook/contrib/assignment6_mip.ipynb
+++ b/examples/notebook/contrib/assignment6_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -117,14 +117,12 @@
" # Create the solver.\n",
" print('Solver: ', sol)\n",
"\n",
- " # using GLPK\n",
" if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('GLPK')\n",
" else:\n",
- " # Using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCBC',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('CBC')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/bacp.ipynb b/examples/notebook/contrib/bacp.ipynb
index cb658bd77c..e7a1130569 100644
--- a/examples/notebook/contrib/bacp.ipynb
+++ b/examples/notebook/contrib/bacp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -94,7 +94,7 @@
"parser = argparse.ArgumentParser()\n",
"\n",
"parser.add_argument(\n",
- " '--data', default='examples/data/bacp/bacp12.txt', help='path to data file')\n",
+ " '--data', default='examples/contrib/bacp.txt', help='path to data file')\n",
"\n",
"#----------------helper for binpacking posting----------------\n",
"\n",
diff --git a/examples/notebook/contrib/blending.ipynb b/examples/notebook/contrib/blending.ipynb
index 7104a78bbb..99d8ebcaa0 100644
--- a/examples/notebook/contrib/blending.ipynb
+++ b/examples/notebook/contrib/blending.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -100,14 +100,12 @@
"\n",
" print('Solver: ', sol)\n",
"\n",
- " # using GLPK\n",
" if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('GLPK')\n",
" else:\n",
- " # Using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCBC',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('CBC')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/broken_weights.ipynb b/examples/notebook/contrib/broken_weights.ipynb
index 358006b701..a76b8b22ed 100644
--- a/examples/notebook/contrib/broken_weights.ipynb
+++ b/examples/notebook/contrib/broken_weights.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/bus_schedule.ipynb b/examples/notebook/contrib/bus_schedule.ipynb
index 22920717e4..423dd26f22 100644
--- a/examples/notebook/contrib/bus_schedule.ipynb
+++ b/examples/notebook/contrib/bus_schedule.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/car.ipynb b/examples/notebook/contrib/car.ipynb
index 725a75eafe..907bada60e 100644
--- a/examples/notebook/contrib/car.ipynb
+++ b/examples/notebook/contrib/car.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/check_dependencies.ipynb b/examples/notebook/contrib/check_dependencies.ipynb
index a63a304dc8..8cdd421dde 100644
--- a/examples/notebook/contrib/check_dependencies.ipynb
+++ b/examples/notebook/contrib/check_dependencies.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/circuit.ipynb b/examples/notebook/contrib/circuit.ipynb
index 287073905c..83b27b1820 100644
--- a/examples/notebook/contrib/circuit.ipynb
+++ b/examples/notebook/contrib/circuit.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/coins3.ipynb b/examples/notebook/contrib/coins3.ipynb
index 69e25b0792..0ffd62a76e 100644
--- a/examples/notebook/contrib/coins3.ipynb
+++ b/examples/notebook/contrib/coins3.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/coins_grid.ipynb b/examples/notebook/contrib/coins_grid.ipynb
index 8259840a24..fd003d12a3 100644
--- a/examples/notebook/contrib/coins_grid.ipynb
+++ b/examples/notebook/contrib/coins_grid.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/coins_grid_mip.ipynb b/examples/notebook/contrib/coins_grid_mip.ipynb
index 3777fc78ef..936cad2764 100644
--- a/examples/notebook/contrib/coins_grid_mip.ipynb
+++ b/examples/notebook/contrib/coins_grid_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -116,12 +116,9 @@
" # Create the solver.\n",
"\n",
" # using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCBC',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
- "\n",
- " # Using CLP\n",
- " # solver = pywraplp.Solver('CoinsGridCLP',\n",
- " # pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('CBC')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # data\n",
" n = 31 # the grid size\n",
diff --git a/examples/notebook/contrib/coloring_ip.ipynb b/examples/notebook/contrib/coloring_ip.ipynb
index 27db650479..e3699f1db4 100644
--- a/examples/notebook/contrib/coloring_ip.ipynb
+++ b/examples/notebook/contrib/coloring_ip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -112,17 +112,10 @@
"def main(sol='CBC'):\n",
"\n",
" # Create the solver.\n",
- "\n",
" print('Solver: ', sol)\n",
- "\n",
- " if sol == 'GLPK':\n",
- " # using GLPK\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
- " else:\n",
- " # Using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/combinatorial_auction2.ipynb b/examples/notebook/contrib/combinatorial_auction2.ipynb
index 621bbb2cd6..ced276151f 100644
--- a/examples/notebook/contrib/combinatorial_auction2.ipynb
+++ b/examples/notebook/contrib/combinatorial_auction2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/contiguity_regular.ipynb b/examples/notebook/contrib/contiguity_regular.ipynb
index 66408f2480..de238dd9f9 100644
--- a/examples/notebook/contrib/contiguity_regular.ipynb
+++ b/examples/notebook/contrib/contiguity_regular.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/costas_array.ipynb b/examples/notebook/contrib/costas_array.ipynb
index 2046b42f1b..7052ab7052 100644
--- a/examples/notebook/contrib/costas_array.ipynb
+++ b/examples/notebook/contrib/costas_array.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/covering_opl.ipynb b/examples/notebook/contrib/covering_opl.ipynb
index ae9e626a46..3435f7c6be 100644
--- a/examples/notebook/contrib/covering_opl.ipynb
+++ b/examples/notebook/contrib/covering_opl.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/crew.ipynb b/examples/notebook/contrib/crew.ipynb
index bdc2a11006..1a091eea17 100644
--- a/examples/notebook/contrib/crew.ipynb
+++ b/examples/notebook/contrib/crew.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/crossword2.ipynb b/examples/notebook/contrib/crossword2.ipynb
index 6928087458..07bb864848 100644
--- a/examples/notebook/contrib/crossword2.ipynb
+++ b/examples/notebook/contrib/crossword2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/crypta.ipynb b/examples/notebook/contrib/crypta.ipynb
index fe1823e09d..3b6fa0733d 100644
--- a/examples/notebook/contrib/crypta.ipynb
+++ b/examples/notebook/contrib/crypta.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/crypto.ipynb b/examples/notebook/contrib/crypto.ipynb
index 2366781436..dd3d6f9862 100644
--- a/examples/notebook/contrib/crypto.ipynb
+++ b/examples/notebook/contrib/crypto.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/curious_set_of_integers.ipynb b/examples/notebook/contrib/curious_set_of_integers.ipynb
index 7229c48603..c6b21047e7 100644
--- a/examples/notebook/contrib/curious_set_of_integers.ipynb
+++ b/examples/notebook/contrib/curious_set_of_integers.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/debruijn_binary.ipynb b/examples/notebook/contrib/debruijn_binary.ipynb
index 06aa1118bb..8ece6da2be 100644
--- a/examples/notebook/contrib/debruijn_binary.ipynb
+++ b/examples/notebook/contrib/debruijn_binary.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/diet1.ipynb b/examples/notebook/contrib/diet1.ipynb
index 3a8ab98cda..522ef68063 100644
--- a/examples/notebook/contrib/diet1.ipynb
+++ b/examples/notebook/contrib/diet1.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/diet1_b.ipynb b/examples/notebook/contrib/diet1_b.ipynb
index 69429b2808..3479e4ccc7 100644
--- a/examples/notebook/contrib/diet1_b.ipynb
+++ b/examples/notebook/contrib/diet1_b.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/diet1_mip.ipynb b/examples/notebook/contrib/diet1_mip.ipynb
index 36a4690fed..f54b5222ec 100644
--- a/examples/notebook/contrib/diet1_mip.ipynb
+++ b/examples/notebook/contrib/diet1_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -112,15 +112,9 @@
" # Create the solver.\n",
"\n",
" print('Solver: ', sol)\n",
- "\n",
- " if sol == 'GLPK':\n",
- " # using GLPK\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
- " else:\n",
- " # Using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/discrete_tomography.ipynb b/examples/notebook/contrib/discrete_tomography.ipynb
index 87414228af..e459858055 100644
--- a/examples/notebook/contrib/discrete_tomography.ipynb
+++ b/examples/notebook/contrib/discrete_tomography.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/divisible_by_9_through_1.ipynb b/examples/notebook/contrib/divisible_by_9_through_1.ipynb
index 62ba85887c..90b8e7a259 100644
--- a/examples/notebook/contrib/divisible_by_9_through_1.ipynb
+++ b/examples/notebook/contrib/divisible_by_9_through_1.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/dudeney.ipynb b/examples/notebook/contrib/dudeney.ipynb
index 962e845c5d..30d1001c91 100644
--- a/examples/notebook/contrib/dudeney.ipynb
+++ b/examples/notebook/contrib/dudeney.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/einav_puzzle.ipynb b/examples/notebook/contrib/einav_puzzle.ipynb
index eb428a2f81..7019e52535 100644
--- a/examples/notebook/contrib/einav_puzzle.ipynb
+++ b/examples/notebook/contrib/einav_puzzle.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/einav_puzzle2.ipynb b/examples/notebook/contrib/einav_puzzle2.ipynb
index 24ef4e4f1c..919cd215b5 100644
--- a/examples/notebook/contrib/einav_puzzle2.ipynb
+++ b/examples/notebook/contrib/einav_puzzle2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/eq10.ipynb b/examples/notebook/contrib/eq10.ipynb
index fe395c42cb..291570ccec 100644
--- a/examples/notebook/contrib/eq10.ipynb
+++ b/examples/notebook/contrib/eq10.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/eq20.ipynb b/examples/notebook/contrib/eq20.ipynb
index 63cf9ab870..0c67477806 100644
--- a/examples/notebook/contrib/eq20.ipynb
+++ b/examples/notebook/contrib/eq20.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/fill_a_pix.ipynb b/examples/notebook/contrib/fill_a_pix.ipynb
index ff5d85ba58..13fe935d18 100644
--- a/examples/notebook/contrib/fill_a_pix.ipynb
+++ b/examples/notebook/contrib/fill_a_pix.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/furniture_moving.ipynb b/examples/notebook/contrib/furniture_moving.ipynb
index 1f4cfa2d80..305c29a379 100644
--- a/examples/notebook/contrib/furniture_moving.ipynb
+++ b/examples/notebook/contrib/furniture_moving.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/futoshiki.ipynb b/examples/notebook/contrib/futoshiki.ipynb
index 7eb52f5695..c7d2de4a0d 100644
--- a/examples/notebook/contrib/futoshiki.ipynb
+++ b/examples/notebook/contrib/futoshiki.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/game_theory_taha.ipynb b/examples/notebook/contrib/game_theory_taha.ipynb
index 8aded34f82..ca21ee20b1 100644
--- a/examples/notebook/contrib/game_theory_taha.ipynb
+++ b/examples/notebook/contrib/game_theory_taha.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -99,15 +99,9 @@
"def main(sol='CBC'):\n",
"\n",
" # Create the solver.\n",
- "\n",
- " # using GLPK\n",
- " if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_LINEAR_PROGRAMMING)\n",
- " else:\n",
- " # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CLP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # data\n",
" rows = 3\n",
diff --git a/examples/notebook/contrib/grocery.ipynb b/examples/notebook/contrib/grocery.ipynb
index 30648cf0b0..24a68aa615 100644
--- a/examples/notebook/contrib/grocery.ipynb
+++ b/examples/notebook/contrib/grocery.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/hidato.ipynb b/examples/notebook/contrib/hidato.ipynb
index 7a0a43755c..3fd203d7c9 100644
--- a/examples/notebook/contrib/hidato.ipynb
+++ b/examples/notebook/contrib/hidato.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/just_forgotten.ipynb b/examples/notebook/contrib/just_forgotten.ipynb
index 9a91d0e5fc..7320c1be7f 100644
--- a/examples/notebook/contrib/just_forgotten.ipynb
+++ b/examples/notebook/contrib/just_forgotten.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/kakuro.ipynb b/examples/notebook/contrib/kakuro.ipynb
index 4e77d46cde..3e51b2efa1 100644
--- a/examples/notebook/contrib/kakuro.ipynb
+++ b/examples/notebook/contrib/kakuro.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/kenken2.ipynb b/examples/notebook/contrib/kenken2.ipynb
index 3939c64cd5..ad646ebd49 100644
--- a/examples/notebook/contrib/kenken2.ipynb
+++ b/examples/notebook/contrib/kenken2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/killer_sudoku.ipynb b/examples/notebook/contrib/killer_sudoku.ipynb
index 543c1d4404..623bb57c8f 100644
--- a/examples/notebook/contrib/killer_sudoku.ipynb
+++ b/examples/notebook/contrib/killer_sudoku.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/knapsack_cp.ipynb b/examples/notebook/contrib/knapsack_cp.ipynb
index 13443e9359..c1716a86d5 100644
--- a/examples/notebook/contrib/knapsack_cp.ipynb
+++ b/examples/notebook/contrib/knapsack_cp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/knapsack_mip.ipynb b/examples/notebook/contrib/knapsack_mip.ipynb
index 4758f28f28..43325fc2bf 100644
--- a/examples/notebook/contrib/knapsack_mip.ipynb
+++ b/examples/notebook/contrib/knapsack_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -97,17 +97,10 @@
"def main(sol='CBC'):\n",
"\n",
" # Create the solver.\n",
- "\n",
" print('Solver: ', sol)\n",
- "\n",
- " # using GLPK\n",
- " if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
- " else:\n",
- " # Using CBC\n",
- " solver = pywraplp.Solver('CoinsGridCBC',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/labeled_dice.ipynb b/examples/notebook/contrib/labeled_dice.ipynb
index 6208d613fb..917060587b 100644
--- a/examples/notebook/contrib/labeled_dice.ipynb
+++ b/examples/notebook/contrib/labeled_dice.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/langford.ipynb b/examples/notebook/contrib/langford.ipynb
index 7c49bb3583..fee2786f3b 100644
--- a/examples/notebook/contrib/langford.ipynb
+++ b/examples/notebook/contrib/langford.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/least_diff.ipynb b/examples/notebook/contrib/least_diff.ipynb
index 716a38bba4..79beda4bfe 100644
--- a/examples/notebook/contrib/least_diff.ipynb
+++ b/examples/notebook/contrib/least_diff.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/least_square.ipynb b/examples/notebook/contrib/least_square.ipynb
index 515e399803..89c4ec74a2 100644
--- a/examples/notebook/contrib/least_square.ipynb
+++ b/examples/notebook/contrib/least_square.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -100,15 +100,9 @@
"def main(sol='CBC'):\n",
"\n",
" # Create the solver.\n",
- "\n",
- " # using GLPK\n",
- " if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_LINEAR_PROGRAMMING)\n",
- " else:\n",
- " # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CLP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # data\n",
" # number of points\n",
diff --git a/examples/notebook/contrib/lectures.ipynb b/examples/notebook/contrib/lectures.ipynb
index 398fb2c756..690f4b42b9 100644
--- a/examples/notebook/contrib/lectures.ipynb
+++ b/examples/notebook/contrib/lectures.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/magic_sequence_sat.ipynb b/examples/notebook/contrib/magic_sequence_sat.ipynb
index 24f188fa5e..ef76ec4eb0 100644
--- a/examples/notebook/contrib/magic_sequence_sat.ipynb
+++ b/examples/notebook/contrib/magic_sequence_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/magic_square.ipynb b/examples/notebook/contrib/magic_square.ipynb
index 396b6a649e..a0875202e6 100644
--- a/examples/notebook/contrib/magic_square.ipynb
+++ b/examples/notebook/contrib/magic_square.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -97,6 +97,8 @@
"def main(n, limit):\n",
" # Create the solver.\n",
" solver = pywrapcp.Solver(\"n-queens\")\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/magic_square_and_cards.ipynb b/examples/notebook/contrib/magic_square_and_cards.ipynb
index b52852ac4e..4d1bcab815 100644
--- a/examples/notebook/contrib/magic_square_and_cards.ipynb
+++ b/examples/notebook/contrib/magic_square_and_cards.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/magic_square_mip.ipynb b/examples/notebook/contrib/magic_square_mip.ipynb
index a02fcb4923..305cb79ddd 100644
--- a/examples/notebook/contrib/magic_square_mip.ipynb
+++ b/examples/notebook/contrib/magic_square_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -121,19 +121,11 @@
"\n",
"\n",
"def main(n=3, sol='CBC', use_output_matrix=0):\n",
- "\n",
" # Create the solver.\n",
- "\n",
" print('Solver: ', sol)\n",
- "\n",
- " # using GLPK\n",
- " if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
- " else:\n",
- " # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/map.ipynb b/examples/notebook/contrib/map.ipynb
index c20e3657f7..b02fc4b4ca 100644
--- a/examples/notebook/contrib/map.ipynb
+++ b/examples/notebook/contrib/map.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/marathon2.ipynb b/examples/notebook/contrib/marathon2.ipynb
index 1946e366a4..6af9c9df59 100644
--- a/examples/notebook/contrib/marathon2.ipynb
+++ b/examples/notebook/contrib/marathon2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/max_flow_taha.ipynb b/examples/notebook/contrib/max_flow_taha.ipynb
index ec10b80b5b..c05a436bd1 100644
--- a/examples/notebook/contrib/max_flow_taha.ipynb
+++ b/examples/notebook/contrib/max_flow_taha.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/max_flow_winston1.ipynb b/examples/notebook/contrib/max_flow_winston1.ipynb
index a125d72c9d..8682ff1117 100644
--- a/examples/notebook/contrib/max_flow_winston1.ipynb
+++ b/examples/notebook/contrib/max_flow_winston1.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/minesweeper.ipynb b/examples/notebook/contrib/minesweeper.ipynb
index 71e44fd03e..b42f84b726 100644
--- a/examples/notebook/contrib/minesweeper.ipynb
+++ b/examples/notebook/contrib/minesweeper.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/mr_smith.ipynb b/examples/notebook/contrib/mr_smith.ipynb
index 57181af7ff..3cb2c93bc1 100644
--- a/examples/notebook/contrib/mr_smith.ipynb
+++ b/examples/notebook/contrib/mr_smith.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nonogram_default_search.ipynb b/examples/notebook/contrib/nonogram_default_search.ipynb
index 3577069cfd..d71593736f 100644
--- a/examples/notebook/contrib/nonogram_default_search.ipynb
+++ b/examples/notebook/contrib/nonogram_default_search.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nonogram_regular.ipynb b/examples/notebook/contrib/nonogram_regular.ipynb
index 28c44be4ed..0cbabc9a69 100644
--- a/examples/notebook/contrib/nonogram_regular.ipynb
+++ b/examples/notebook/contrib/nonogram_regular.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nonogram_table.ipynb b/examples/notebook/contrib/nonogram_table.ipynb
index 01e08fe2fd..0238a58e9f 100644
--- a/examples/notebook/contrib/nonogram_table.ipynb
+++ b/examples/notebook/contrib/nonogram_table.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nonogram_table2.ipynb b/examples/notebook/contrib/nonogram_table2.ipynb
index 4b19c14d53..62b592a9f4 100644
--- a/examples/notebook/contrib/nonogram_table2.ipynb
+++ b/examples/notebook/contrib/nonogram_table2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nontransitive_dice.ipynb b/examples/notebook/contrib/nontransitive_dice.ipynb
index d0a359db22..3f8fc97c7a 100644
--- a/examples/notebook/contrib/nontransitive_dice.ipynb
+++ b/examples/notebook/contrib/nontransitive_dice.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nqueens.ipynb b/examples/notebook/contrib/nqueens.ipynb
index c2d5248083..439e21beb5 100644
--- a/examples/notebook/contrib/nqueens.ipynb
+++ b/examples/notebook/contrib/nqueens.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nqueens2.ipynb b/examples/notebook/contrib/nqueens2.ipynb
index 8dc1f76e20..e951c47e94 100644
--- a/examples/notebook/contrib/nqueens2.ipynb
+++ b/examples/notebook/contrib/nqueens2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nqueens3.ipynb b/examples/notebook/contrib/nqueens3.ipynb
index db71d282c6..ec825bf70c 100644
--- a/examples/notebook/contrib/nqueens3.ipynb
+++ b/examples/notebook/contrib/nqueens3.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nurse_rostering.ipynb b/examples/notebook/contrib/nurse_rostering.ipynb
index 29507f47c7..2c2b22afee 100644
--- a/examples/notebook/contrib/nurse_rostering.ipynb
+++ b/examples/notebook/contrib/nurse_rostering.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/nurses_cp.ipynb b/examples/notebook/contrib/nurses_cp.ipynb
index e1c722cfb9..42c7ddd86c 100644
--- a/examples/notebook/contrib/nurses_cp.ipynb
+++ b/examples/notebook/contrib/nurses_cp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/olympic.ipynb b/examples/notebook/contrib/olympic.ipynb
index 4c60823bc5..40df2a47bd 100644
--- a/examples/notebook/contrib/olympic.ipynb
+++ b/examples/notebook/contrib/olympic.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/organize_day.ipynb b/examples/notebook/contrib/organize_day.ipynb
index f32ea638f3..25ef9ec2ab 100644
--- a/examples/notebook/contrib/organize_day.ipynb
+++ b/examples/notebook/contrib/organize_day.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/p_median.ipynb b/examples/notebook/contrib/p_median.ipynb
index 0cb3a2fddc..146a2bddee 100644
--- a/examples/notebook/contrib/p_median.ipynb
+++ b/examples/notebook/contrib/p_median.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/pandigital_numbers.ipynb b/examples/notebook/contrib/pandigital_numbers.ipynb
index 9e69bc8094..53668a8c81 100644
--- a/examples/notebook/contrib/pandigital_numbers.ipynb
+++ b/examples/notebook/contrib/pandigital_numbers.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/photo_problem.ipynb b/examples/notebook/contrib/photo_problem.ipynb
index e6ce9d9adb..b29b43ad18 100644
--- a/examples/notebook/contrib/photo_problem.ipynb
+++ b/examples/notebook/contrib/photo_problem.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/place_number_puzzle.ipynb b/examples/notebook/contrib/place_number_puzzle.ipynb
index beef14b47e..bcbd6b84ea 100644
--- a/examples/notebook/contrib/place_number_puzzle.ipynb
+++ b/examples/notebook/contrib/place_number_puzzle.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/post_office_problem2.ipynb b/examples/notebook/contrib/post_office_problem2.ipynb
index d2ef79a580..a23b75dcd6 100644
--- a/examples/notebook/contrib/post_office_problem2.ipynb
+++ b/examples/notebook/contrib/post_office_problem2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/production.ipynb b/examples/notebook/contrib/production.ipynb
index f0b6c648dd..21580a7866 100644
--- a/examples/notebook/contrib/production.ipynb
+++ b/examples/notebook/contrib/production.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -97,15 +97,9 @@
"def main(sol='CBC'):\n",
"\n",
" # Create the solver.\n",
- "\n",
- " # using GLPK\n",
- " if sol == 'GLPK':\n",
- " solver = pywraplp.Solver('CoinsGridGLPK',\n",
- " pywraplp.Solver.GLPK_LINEAR_PROGRAMMING)\n",
- " else:\n",
- " # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CLP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/project_scheduling_sat.ipynb b/examples/notebook/contrib/project_scheduling_sat.ipynb
index f3a4ecfe23..d9c8d4be68 100644
--- a/examples/notebook/contrib/project_scheduling_sat.ipynb
+++ b/examples/notebook/contrib/project_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/pyls_api.ipynb b/examples/notebook/contrib/pyls_api.ipynb
index 49078c05a9..0a7348c581 100644
--- a/examples/notebook/contrib/pyls_api.ipynb
+++ b/examples/notebook/contrib/pyls_api.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/quasigroup_completion.ipynb b/examples/notebook/contrib/quasigroup_completion.ipynb
index 14f1b691c5..6a1ce82b27 100644
--- a/examples/notebook/contrib/quasigroup_completion.ipynb
+++ b/examples/notebook/contrib/quasigroup_completion.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/regular.ipynb b/examples/notebook/contrib/regular.ipynb
index 91243b3905..324951e6aa 100644
--- a/examples/notebook/contrib/regular.ipynb
+++ b/examples/notebook/contrib/regular.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/regular_table.ipynb b/examples/notebook/contrib/regular_table.ipynb
index 932713e7c4..efd9a4e274 100644
--- a/examples/notebook/contrib/regular_table.ipynb
+++ b/examples/notebook/contrib/regular_table.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/regular_table2.ipynb b/examples/notebook/contrib/regular_table2.ipynb
index 109e4c5a7b..9e24cdb570 100644
--- a/examples/notebook/contrib/regular_table2.ipynb
+++ b/examples/notebook/contrib/regular_table2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/rogo2.ipynb b/examples/notebook/contrib/rogo2.ipynb
index 06ae6e8ff9..afa4866b91 100644
--- a/examples/notebook/contrib/rogo2.ipynb
+++ b/examples/notebook/contrib/rogo2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/rostering_with_travel.ipynb b/examples/notebook/contrib/rostering_with_travel.ipynb
index aaa4f9a316..588fc32f92 100644
--- a/examples/notebook/contrib/rostering_with_travel.ipynb
+++ b/examples/notebook/contrib/rostering_with_travel.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/safe_cracking.ipynb b/examples/notebook/contrib/safe_cracking.ipynb
index 7118dce680..0722c4dfc1 100644
--- a/examples/notebook/contrib/safe_cracking.ipynb
+++ b/examples/notebook/contrib/safe_cracking.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/scheduling_speakers.ipynb b/examples/notebook/contrib/scheduling_speakers.ipynb
index 5aeb02d36c..8dd73029c7 100644
--- a/examples/notebook/contrib/scheduling_speakers.ipynb
+++ b/examples/notebook/contrib/scheduling_speakers.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/scheduling_with_transitions_sat.ipynb b/examples/notebook/contrib/scheduling_with_transitions_sat.ipynb
index bf56218df9..f4ab64bf51 100644
--- a/examples/notebook/contrib/scheduling_with_transitions_sat.ipynb
+++ b/examples/notebook/contrib/scheduling_with_transitions_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -273,7 +273,7 @@
" l_machine = task[alt_id][1]\n",
" l_type = task[alt_id][2]\n",
"\n",
- " # Link the master variables with the local ones.\n",
+ " # Link the original variables with the local ones.\n",
" model.Add(start == l_start).OnlyEnforceIf(l_presence)\n",
" model.Add(duration == l_duration).OnlyEnforceIf(l_presence)\n",
" model.Add(end == l_end).OnlyEnforceIf(l_presence)\n",
diff --git a/examples/notebook/contrib/school_scheduling_sat.ipynb b/examples/notebook/contrib/school_scheduling_sat.ipynb
index 09199a9195..0b64c6b2bd 100644
--- a/examples/notebook/contrib/school_scheduling_sat.ipynb
+++ b/examples/notebook/contrib/school_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/secret_santa.ipynb b/examples/notebook/contrib/secret_santa.ipynb
index c58cf4256b..eb09d3ea10 100644
--- a/examples/notebook/contrib/secret_santa.ipynb
+++ b/examples/notebook/contrib/secret_santa.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/secret_santa2.ipynb b/examples/notebook/contrib/secret_santa2.ipynb
index b86cbab56f..e6acf19644 100644
--- a/examples/notebook/contrib/secret_santa2.ipynb
+++ b/examples/notebook/contrib/secret_santa2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/send_more_money_any_base.ipynb b/examples/notebook/contrib/send_more_money_any_base.ipynb
index e0b99b5e2e..07246d274c 100644
--- a/examples/notebook/contrib/send_more_money_any_base.ipynb
+++ b/examples/notebook/contrib/send_more_money_any_base.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/send_most_money.ipynb b/examples/notebook/contrib/send_most_money.ipynb
index 8d9df8501d..930229739e 100644
--- a/examples/notebook/contrib/send_most_money.ipynb
+++ b/examples/notebook/contrib/send_most_money.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/seseman.ipynb b/examples/notebook/contrib/seseman.ipynb
index 589e40f03a..7ccfc8ed4c 100644
--- a/examples/notebook/contrib/seseman.ipynb
+++ b/examples/notebook/contrib/seseman.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/seseman_b.ipynb b/examples/notebook/contrib/seseman_b.ipynb
index cfb139fdb2..781a560d61 100644
--- a/examples/notebook/contrib/seseman_b.ipynb
+++ b/examples/notebook/contrib/seseman_b.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_covering.ipynb b/examples/notebook/contrib/set_covering.ipynb
index 24db7224d9..86ad62f680 100644
--- a/examples/notebook/contrib/set_covering.ipynb
+++ b/examples/notebook/contrib/set_covering.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_covering2.ipynb b/examples/notebook/contrib/set_covering2.ipynb
index cdd73cf3f2..8c4d56f10a 100644
--- a/examples/notebook/contrib/set_covering2.ipynb
+++ b/examples/notebook/contrib/set_covering2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_covering3.ipynb b/examples/notebook/contrib/set_covering3.ipynb
index 6553e8fe7b..3af24ed271 100644
--- a/examples/notebook/contrib/set_covering3.ipynb
+++ b/examples/notebook/contrib/set_covering3.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_covering4.ipynb b/examples/notebook/contrib/set_covering4.ipynb
index b13138c9b2..8ddbb50c1a 100644
--- a/examples/notebook/contrib/set_covering4.ipynb
+++ b/examples/notebook/contrib/set_covering4.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_covering_deployment.ipynb b/examples/notebook/contrib/set_covering_deployment.ipynb
index 615ad39c9f..134d01341e 100644
--- a/examples/notebook/contrib/set_covering_deployment.ipynb
+++ b/examples/notebook/contrib/set_covering_deployment.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_covering_skiena.ipynb b/examples/notebook/contrib/set_covering_skiena.ipynb
index 36d35c7e2d..5ed456c17b 100644
--- a/examples/notebook/contrib/set_covering_skiena.ipynb
+++ b/examples/notebook/contrib/set_covering_skiena.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/set_partition.ipynb b/examples/notebook/contrib/set_partition.ipynb
index e3d9c225c5..c5e9d02cc5 100644
--- a/examples/notebook/contrib/set_partition.ipynb
+++ b/examples/notebook/contrib/set_partition.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/sicherman_dice.ipynb b/examples/notebook/contrib/sicherman_dice.ipynb
index a9790f6587..0c28a6cbb8 100644
--- a/examples/notebook/contrib/sicherman_dice.ipynb
+++ b/examples/notebook/contrib/sicherman_dice.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/ski_assignment.ipynb b/examples/notebook/contrib/ski_assignment.ipynb
index e7b1c1bc11..3b6994f61d 100644
--- a/examples/notebook/contrib/ski_assignment.ipynb
+++ b/examples/notebook/contrib/ski_assignment.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/slitherlink.ipynb b/examples/notebook/contrib/slitherlink.ipynb
index 6ce05565e6..883410c490 100644
--- a/examples/notebook/contrib/slitherlink.ipynb
+++ b/examples/notebook/contrib/slitherlink.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/sports_schedule_sat.ipynb b/examples/notebook/contrib/sports_schedule_sat.ipynb
index cfe365535f..51feb126b1 100644
--- a/examples/notebook/contrib/sports_schedule_sat.ipynb
+++ b/examples/notebook/contrib/sports_schedule_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/stable_marriage.ipynb b/examples/notebook/contrib/stable_marriage.ipynb
index 712711b848..2034453cf2 100644
--- a/examples/notebook/contrib/stable_marriage.ipynb
+++ b/examples/notebook/contrib/stable_marriage.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/stable_marriage_sat.ipynb b/examples/notebook/contrib/stable_marriage_sat.ipynb
index cd3648401f..a935b346cc 100644
--- a/examples/notebook/contrib/stable_marriage_sat.ipynb
+++ b/examples/notebook/contrib/stable_marriage_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/steel.ipynb b/examples/notebook/contrib/steel.ipynb
index 85f57e3e34..1ab5a7f3b9 100644
--- a/examples/notebook/contrib/steel.ipynb
+++ b/examples/notebook/contrib/steel.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -94,7 +94,7 @@
"parser = argparse.ArgumentParser()\n",
"parser.add_argument(\n",
" '--data',\n",
- " default='examples/data/steel_mill/steel_mill_slab.txt',\n",
+ " default='examples/contrib/steel.txt',\n",
" help='path to data file')\n",
"parser.add_argument(\n",
" '--time_limit', default=20000, type=int, help='global time limit')\n",
diff --git a/examples/notebook/contrib/steel_lns.ipynb b/examples/notebook/contrib/steel_lns.ipynb
index 601f5feeb4..546e1afa5d 100644
--- a/examples/notebook/contrib/steel_lns.ipynb
+++ b/examples/notebook/contrib/steel_lns.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -95,7 +95,7 @@
"\n",
"parser.add_argument(\n",
" '--data',\n",
- " default='examples/data/steel_mill/steel_mill_slab.txt',\n",
+ " default='examples/contrib/steel.txt',\n",
" help='path to data file')\n",
"parser.add_argument(\n",
" '--time_limit', default=20000, type=int, help='global time limit')\n",
diff --git a/examples/notebook/contrib/stigler_contrib.ipynb b/examples/notebook/contrib/stigler_contrib.ipynb
index 7cf68f7e9d..2bde439855 100644
--- a/examples/notebook/contrib/stigler_contrib.ipynb
+++ b/examples/notebook/contrib/stigler_contrib.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -191,19 +191,11 @@
"\n",
"\n",
"def main(sol=\"CBC\"):\n",
- "\n",
" # Create the solver.\n",
- "\n",
" print(\"Solver: \", sol)\n",
- "\n",
- " # using GLPK\n",
- " if sol == \"GLPK\":\n",
- " solver = pywraplp.Solver(\"CoinsGridGLPK\",\n",
- " pywraplp.Solver.GLPK_MIXED_INTEGER_PROGRAMMING)\n",
- " else:\n",
- " # Using CLP\n",
- " solver = pywraplp.Solver(\"CoinsGridCLP\",\n",
- " pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver(sol)\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" #\n",
" # data\n",
diff --git a/examples/notebook/contrib/strimko2.ipynb b/examples/notebook/contrib/strimko2.ipynb
index d526712333..5047828493 100644
--- a/examples/notebook/contrib/strimko2.ipynb
+++ b/examples/notebook/contrib/strimko2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/subset_sum.ipynb b/examples/notebook/contrib/subset_sum.ipynb
index 4473ca1990..361e986f95 100644
--- a/examples/notebook/contrib/subset_sum.ipynb
+++ b/examples/notebook/contrib/subset_sum.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/survo_puzzle.ipynb b/examples/notebook/contrib/survo_puzzle.ipynb
index f59e018338..a61901b842 100644
--- a/examples/notebook/contrib/survo_puzzle.ipynb
+++ b/examples/notebook/contrib/survo_puzzle.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/toNum.ipynb b/examples/notebook/contrib/toNum.ipynb
index dd2ebfaaf1..2f90728ad9 100644
--- a/examples/notebook/contrib/toNum.ipynb
+++ b/examples/notebook/contrib/toNum.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/traffic_lights.ipynb b/examples/notebook/contrib/traffic_lights.ipynb
index ec6cef2243..d54f84914b 100644
--- a/examples/notebook/contrib/traffic_lights.ipynb
+++ b/examples/notebook/contrib/traffic_lights.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/vendor_scheduling.ipynb b/examples/notebook/contrib/vendor_scheduling.ipynb
index 555fbe89f5..62cd9fff00 100644
--- a/examples/notebook/contrib/vendor_scheduling.ipynb
+++ b/examples/notebook/contrib/vendor_scheduling.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/volsay.ipynb b/examples/notebook/contrib/volsay.ipynb
index 0cac7535b9..8325f5995d 100644
--- a/examples/notebook/contrib/volsay.ipynb
+++ b/examples/notebook/contrib/volsay.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -102,8 +102,9 @@
" # pywraplp.Solver.GLPK_LINEAR_PROGRAMMING)\n",
"\n",
" # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CLP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('CLP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # data\n",
"\n",
diff --git a/examples/notebook/contrib/volsay2.ipynb b/examples/notebook/contrib/volsay2.ipynb
index 0f5c315bff..3a135ae64a 100644
--- a/examples/notebook/contrib/volsay2.ipynb
+++ b/examples/notebook/contrib/volsay2.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -103,8 +103,9 @@
" # pywraplp.Solver.GLPK_LINEAR_PROGRAMMING)\n",
"\n",
" # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CLP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('CLP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # data\n",
" num_products = 2\n",
diff --git a/examples/notebook/contrib/volsay3.ipynb b/examples/notebook/contrib/volsay3.ipynb
index 32547c283f..5e848d4949 100644
--- a/examples/notebook/contrib/volsay3.ipynb
+++ b/examples/notebook/contrib/volsay3.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -103,8 +103,9 @@
" # pywraplp.Solver.GLPK_LINEAR_PROGRAMMING)\n",
"\n",
" # Using CLP\n",
- " solver = pywraplp.Solver('CoinsGridCLP',\n",
- " pywraplp.Solver.CLP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('CLP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # data\n",
" num_products = 2\n",
diff --git a/examples/notebook/contrib/wedding_optimal_chart.ipynb b/examples/notebook/contrib/wedding_optimal_chart.ipynb
index ffe01d105f..80a7fe2c51 100644
--- a/examples/notebook/contrib/wedding_optimal_chart.ipynb
+++ b/examples/notebook/contrib/wedding_optimal_chart.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -112,7 +112,7 @@
"minimize stress and arguments.\n",
"\n",
"Adapted from\n",
- "https://github.com/google/or-tools/blob/master/examples/csharp/wedding_optimal_chart.cs\n",
+ "https://github.com/google/or-tools/blob/main/examples/csharp/wedding_optimal_chart.cs\n",
"\"\"\"\n",
"\n",
"\n",
diff --git a/examples/notebook/contrib/who_killed_agatha.ipynb b/examples/notebook/contrib/who_killed_agatha.ipynb
index ba4ee50b00..bd94ea8993 100644
--- a/examples/notebook/contrib/who_killed_agatha.ipynb
+++ b/examples/notebook/contrib/who_killed_agatha.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/xkcd.ipynb b/examples/notebook/contrib/xkcd.ipynb
index 6028034178..712342d23f 100644
--- a/examples/notebook/contrib/xkcd.ipynb
+++ b/examples/notebook/contrib/xkcd.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/contrib/young_tableaux.ipynb b/examples/notebook/contrib/young_tableaux.ipynb
index fc727d4abe..c660e57429 100644
--- a/examples/notebook/contrib/young_tableaux.ipynb
+++ b/examples/notebook/contrib/young_tableaux.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/appointments.ipynb b/examples/notebook/examples/appointments.ipynb
index 52ff4c2628..193ed93c38 100644
--- a/examples/notebook/examples/appointments.ipynb
+++ b/examples/notebook/examples/appointments.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -178,8 +178,9 @@
" - and its associated \"num_selections\" is the number of times it was\n",
" selected.\n",
" \"\"\"\n",
- " solver = pywraplp.Solver('Select',\n",
- " pywraplp.Solver.SCIP_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('SCIP')\n",
+ " if not solver:\n",
+ " return []\n",
" n = len(ideal_item_ratios)\n",
" num_distinct_collections = len(item_collections)\n",
" max_num_items_per_collection = 0\n",
@@ -299,10 +300,12 @@
" print()\n",
" print('%d installations planned' % installed)\n",
" for a in demand:\n",
- " name = a[1]\n",
- " per_type = installed_per_type[name]\n",
- " print((' %d (%.2f%%) installations of type %s planned' %\n",
- " (per_type, per_type * 100.0 / installed, name)))\n",
+ " name = a[1]\n",
+ " per_type = installed_per_type[name]\n",
+ " if installed != 0:\n",
+ " print(f' {per_type} ({per_type * 100.0 / installed}%) installations of type {name} planned')\n",
+ " else:\n",
+ " print(f' {per_type} installations of type {name} planned')\n",
"\n",
"\n",
"solve_appointments()\n",
diff --git a/examples/notebook/examples/arc_flow_cutting_stock_sat.ipynb b/examples/notebook/examples/arc_flow_cutting_stock_sat.ipynb
index e81fb85396..2ada90122c 100644
--- a/examples/notebook/examples/arc_flow_cutting_stock_sat.ipynb
+++ b/examples/notebook/examples/arc_flow_cutting_stock_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/assignment2_sat.ipynb b/examples/notebook/examples/assignment2_sat.ipynb
index feee205007..0521472bec 100644
--- a/examples/notebook/examples/assignment2_sat.ipynb
+++ b/examples/notebook/examples/assignment2_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/assignment_with_constraints_sat.ipynb b/examples/notebook/examples/assignment_with_constraints_sat.ipynb
index 21ec3d5abb..420f2988c2 100644
--- a/examples/notebook/examples/assignment_with_constraints_sat.ipynb
+++ b/examples/notebook/examples/assignment_with_constraints_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/balance_group_sat.ipynb b/examples/notebook/examples/balance_group_sat.ipynb
index d675f90558..154294ce0b 100644
--- a/examples/notebook/examples/balance_group_sat.ipynb
+++ b/examples/notebook/examples/balance_group_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/bus_driver_scheduling_flow_sat.ipynb b/examples/notebook/examples/bus_driver_scheduling_flow_sat.ipynb
index b7b3f2e39c..bf4fc694d8 100644
--- a/examples/notebook/examples/bus_driver_scheduling_flow_sat.ipynb
+++ b/examples/notebook/examples/bus_driver_scheduling_flow_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/bus_driver_scheduling_sat.ipynb b/examples/notebook/examples/bus_driver_scheduling_sat.ipynb
index da05459665..a8dd6d53e0 100644
--- a/examples/notebook/examples/bus_driver_scheduling_sat.ipynb
+++ b/examples/notebook/examples/bus_driver_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -101,7 +101,7 @@
"class FLAGS: pass\n",
"\n",
"FLAGS.output_proto = '' # Output file to write the cp_model proto to.\n",
- "FLAGS.params = 'num_search_workers:8,log_search_progress:true' # Sat solver parameters.\n",
+ "FLAGS.params = 'num_search_workers:16,log_search_progress:true' # Sat solver parameters.\n",
"FLAGS.instance = 1 # Instance to select (1, 2, 3).\n",
"SAMPLE_SHIFTS_SMALL = [\n",
" #\n",
diff --git a/examples/notebook/examples/chemical_balance_lp.ipynb b/examples/notebook/examples/chemical_balance_lp.ipynb
index 43c9015ea7..fe6c1ebac0 100644
--- a/examples/notebook/examples/chemical_balance_lp.ipynb
+++ b/examples/notebook/examples/chemical_balance_lp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/chemical_balance_sat.ipynb b/examples/notebook/examples/chemical_balance_sat.ipynb
index 6732547fe5..e8d7525a36 100644
--- a/examples/notebook/examples/chemical_balance_sat.ipynb
+++ b/examples/notebook/examples/chemical_balance_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/clustering_sat.ipynb b/examples/notebook/examples/clustering_sat.ipynb
index 9c78f10a11..247fe99995 100644
--- a/examples/notebook/examples/clustering_sat.ipynb
+++ b/examples/notebook/examples/clustering_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/cover_rectangle_sat.ipynb b/examples/notebook/examples/cover_rectangle_sat.ipynb
index 24a5dd3be1..91a81c04fa 100644
--- a/examples/notebook/examples/cover_rectangle_sat.ipynb
+++ b/examples/notebook/examples/cover_rectangle_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/cvrptw_plot.ipynb b/examples/notebook/examples/cvrptw_plot.ipynb
index 3b193ea378..f3849f7a30 100644
--- a/examples/notebook/examples/cvrptw_plot.ipynb
+++ b/examples/notebook/examples/cvrptw_plot.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/flexible_job_shop_sat.ipynb b/examples/notebook/examples/flexible_job_shop_sat.ipynb
index 655c394d7b..5d7d02d10c 100644
--- a/examples/notebook/examples/flexible_job_shop_sat.ipynb
+++ b/examples/notebook/examples/flexible_job_shop_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -207,7 +207,7 @@
" 'interval' + alt_suffix)\n",
" l_presences.append(l_presence)\n",
"\n",
- " # Link the master variables with the local ones.\n",
+ " # Link the primary/global variables with the local ones.\n",
" model.Add(start == l_start).OnlyEnforceIf(l_presence)\n",
" model.Add(duration == l_duration).OnlyEnforceIf(l_presence)\n",
" model.Add(end == l_end).OnlyEnforceIf(l_presence)\n",
diff --git a/examples/notebook/examples/gate_scheduling_sat.ipynb b/examples/notebook/examples/gate_scheduling_sat.ipynb
index 0132081302..4d0114a02e 100644
--- a/examples/notebook/examples/gate_scheduling_sat.ipynb
+++ b/examples/notebook/examples/gate_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/golomb8.ipynb b/examples/notebook/examples/golomb8.ipynb
index fb90a5ab41..2a307a601a 100644
--- a/examples/notebook/examples/golomb8.ipynb
+++ b/examples/notebook/examples/golomb8.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/golomb_sat.ipynb b/examples/notebook/examples/golomb_sat.ipynb
index e88cc7ab28..77f307f121 100644
--- a/examples/notebook/examples/golomb_sat.ipynb
+++ b/examples/notebook/examples/golomb_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/hidato_sat.ipynb b/examples/notebook/examples/hidato_sat.ipynb
index e7c3236320..0880b31f7d 100644
--- a/examples/notebook/examples/hidato_sat.ipynb
+++ b/examples/notebook/examples/hidato_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/integer_programming.ipynb b/examples/notebook/examples/integer_programming.ipynb
index 7b60409220..07aa06be7c 100644
--- a/examples/notebook/examples/integer_programming.ipynb
+++ b/examples/notebook/examples/integer_programming.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/jobshop_ft06_distance_sat.ipynb b/examples/notebook/examples/jobshop_ft06_distance_sat.ipynb
index da68bab1c4..02398d10ce 100644
--- a/examples/notebook/examples/jobshop_ft06_distance_sat.ipynb
+++ b/examples/notebook/examples/jobshop_ft06_distance_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/jobshop_ft06_sat.ipynb b/examples/notebook/examples/jobshop_ft06_sat.ipynb
index acb5cbf5b7..ba86859427 100644
--- a/examples/notebook/examples/jobshop_ft06_sat.ipynb
+++ b/examples/notebook/examples/jobshop_ft06_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/jobshop_with_maintenance_sat.ipynb b/examples/notebook/examples/jobshop_with_maintenance_sat.ipynb
index bfe7091bb4..e96af0fa39 100644
--- a/examples/notebook/examples/jobshop_with_maintenance_sat.ipynb
+++ b/examples/notebook/examples/jobshop_with_maintenance_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/knapsack_2d_sat.ipynb b/examples/notebook/examples/knapsack_2d_sat.ipynb
index 0763581e00..40d11d60ae 100644
--- a/examples/notebook/examples/knapsack_2d_sat.ipynb
+++ b/examples/notebook/examples/knapsack_2d_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -87,10 +87,12 @@
"outputs": [],
"source": [
"import io\n",
+ "\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"from google.protobuf import text_format\n",
+ "\n",
"from ortools.sat.python import cp_model\n",
"\n",
"class FLAGS: pass\n",
diff --git a/examples/notebook/examples/linear_assignment_api.ipynb b/examples/notebook/examples/linear_assignment_api.ipynb
index 83088fefe9..11441f85c7 100644
--- a/examples/notebook/examples/linear_assignment_api.ipynb
+++ b/examples/notebook/examples/linear_assignment_api.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/linear_programming.ipynb b/examples/notebook/examples/linear_programming.ipynb
index dd2066921e..10c69dc593 100644
--- a/examples/notebook/examples/linear_programming.ipynb
+++ b/examples/notebook/examples/linear_programming.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/magic_sequence_distribute.ipynb b/examples/notebook/examples/magic_sequence_distribute.ipynb
index b46566a050..f39a685029 100644
--- a/examples/notebook/examples/magic_sequence_distribute.ipynb
+++ b/examples/notebook/examples/magic_sequence_distribute.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/maze_escape_sat.ipynb b/examples/notebook/examples/maze_escape_sat.ipynb
index b3acdd11d0..83228b1ab0 100644
--- a/examples/notebook/examples/maze_escape_sat.ipynb
+++ b/examples/notebook/examples/maze_escape_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/no_wait_baking_scheduling_sat.ipynb b/examples/notebook/examples/no_wait_baking_scheduling_sat.ipynb
index 2d58cfec7a..4c2fa78ac0 100644
--- a/examples/notebook/examples/no_wait_baking_scheduling_sat.ipynb
+++ b/examples/notebook/examples/no_wait_baking_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/prize_collecting_tsp.ipynb b/examples/notebook/examples/prize_collecting_tsp.ipynb
index 94bf888f37..1f7f38c4ea 100644
--- a/examples/notebook/examples/prize_collecting_tsp.ipynb
+++ b/examples/notebook/examples/prize_collecting_tsp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/prize_collecting_tsp_sat.ipynb b/examples/notebook/examples/prize_collecting_tsp_sat.ipynb
index b805305f64..f19ad2839c 100644
--- a/examples/notebook/examples/prize_collecting_tsp_sat.ipynb
+++ b/examples/notebook/examples/prize_collecting_tsp_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/prize_collecting_vrp.ipynb b/examples/notebook/examples/prize_collecting_vrp.ipynb
index 22dc55b39a..e2608c1b3f 100644
--- a/examples/notebook/examples/prize_collecting_vrp.ipynb
+++ b/examples/notebook/examples/prize_collecting_vrp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/prize_collecting_vrp_sat.ipynb b/examples/notebook/examples/prize_collecting_vrp_sat.ipynb
index ee6af4dbcb..63fdb13715 100644
--- a/examples/notebook/examples/prize_collecting_vrp_sat.ipynb
+++ b/examples/notebook/examples/prize_collecting_vrp_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/pyflow_example.ipynb b/examples/notebook/examples/pyflow_example.ipynb
index 171e449f05..1396ed6a6d 100644
--- a/examples/notebook/examples/pyflow_example.ipynb
+++ b/examples/notebook/examples/pyflow_example.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/qubo_sat.ipynb b/examples/notebook/examples/qubo_sat.ipynb
index 486bc51f93..fbe890b15f 100644
--- a/examples/notebook/examples/qubo_sat.ipynb
+++ b/examples/notebook/examples/qubo_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/random_tsp.ipynb b/examples/notebook/examples/random_tsp.ipynb
index 4e1942aef7..f0c5e66bab 100644
--- a/examples/notebook/examples/random_tsp.ipynb
+++ b/examples/notebook/examples/random_tsp.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/rcpsp_sat.ipynb b/examples/notebook/examples/rcpsp_sat.ipynb
index e2dfb2725a..352293f9ad 100644
--- a/examples/notebook/examples/rcpsp_sat.ipynb
+++ b/examples/notebook/examples/rcpsp_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -151,6 +151,7 @@
"\n",
" # Create the model.\n",
" model = cp_model.CpModel()\n",
+ " model.SetName(problem.name)\n",
"\n",
" num_tasks = len(problem.tasks)\n",
" num_resources = len(problem.resources)\n",
@@ -286,7 +287,7 @@
" m2]\n",
" s2 = task_starts[next_id]\n",
" p2 = task_to_presence_literals[next_id][m2]\n",
- " model.Add(s1 + delay <= s2).OnlyEnforceIf(p1, p2)\n",
+ " model.Add(s1 + delay <= s2).OnlyEnforceIf([p1, p2])\n",
" else:\n",
" # Normal dependencies (task ends before the start of successors).\n",
" for t in all_active_tasks:\n",
@@ -367,7 +368,7 @@
" solver.Solve(model)\n",
"\n",
"\n",
- "def main(_=None):\n",
+ "def main(_):\n",
" rcpsp_parser = pywraprcpsp.RcpspParser()\n",
" rcpsp_parser.ParseFile(FLAGS.input)\n",
" SolveRcpsp(rcpsp_parser.Problem(), FLAGS.output_proto, FLAGS.params)\n",
diff --git a/examples/notebook/examples/reallocate_sat.ipynb b/examples/notebook/examples/reallocate_sat.ipynb
index 8f60a38450..eec557d295 100644
--- a/examples/notebook/examples/reallocate_sat.ipynb
+++ b/examples/notebook/examples/reallocate_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/shift_scheduling_sat.ipynb b/examples/notebook/examples/shift_scheduling_sat.ipynb
index db0c169043..2d964d5070 100644
--- a/examples/notebook/examples/shift_scheduling_sat.ipynb
+++ b/examples/notebook/examples/shift_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -82,8 +82,8 @@
"metadata": {},
"outputs": [],
"source": [
- "from google.protobuf import text_format\n",
"from ortools.sat.python import cp_model\n",
+ "from google.protobuf import text_format\n",
"\n",
"class FLAGS: pass\n",
"\n",
@@ -483,7 +483,7 @@
" print(' - wall time : %f s' % solver.WallTime())\n",
"\n",
"\n",
- "def main(_=None):\n",
+ "def main(_):\n",
" solve_shift_scheduling(FLAGS.params, FLAGS.output_proto)\n",
"\n",
"\n",
diff --git a/examples/notebook/examples/single_machine_scheduling_with_setup_release_due_dates_sat.ipynb b/examples/notebook/examples/single_machine_scheduling_with_setup_release_due_dates_sat.ipynb
index da797e6373..684b1ac9ad 100644
--- a/examples/notebook/examples/single_machine_scheduling_with_setup_release_due_dates_sat.ipynb
+++ b/examples/notebook/examples/single_machine_scheduling_with_setup_release_due_dates_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/steel_mill_slab_sat.ipynb b/examples/notebook/examples/steel_mill_slab_sat.ipynb
index be07168a51..990347398c 100644
--- a/examples/notebook/examples/steel_mill_slab_sat.ipynb
+++ b/examples/notebook/examples/steel_mill_slab_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -766,8 +766,9 @@
"\n",
" # create model and decision variables.\n",
" start_time = time.time()\n",
- " solver = pywraplp.Solver('Steel',\n",
- " pywraplp.Solver.SCIP_MIXED_INTEGER_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('SCIP')\n",
+ " if not solver:\n",
+ " return\n",
" selected = [\n",
" solver.IntVar(0.0, 1.0, 'selected_%i' % i) for i in all_valid_slabs\n",
" ]\n",
diff --git a/examples/notebook/examples/sudoku_sat.ipynb b/examples/notebook/examples/sudoku_sat.ipynb
index 529cfe7f89..2ed1f17253 100644
--- a/examples/notebook/examples/sudoku_sat.ipynb
+++ b/examples/notebook/examples/sudoku_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/task_allocation_sat.ipynb b/examples/notebook/examples/task_allocation_sat.ipynb
index 97397c593a..683a231134 100644
--- a/examples/notebook/examples/task_allocation_sat.ipynb
+++ b/examples/notebook/examples/task_allocation_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/tasks_and_workers_assignment_sat.ipynb b/examples/notebook/examples/tasks_and_workers_assignment_sat.ipynb
index 0febe9ce2d..dfa33c0df6 100644
--- a/examples/notebook/examples/tasks_and_workers_assignment_sat.ipynb
+++ b/examples/notebook/examples/tasks_and_workers_assignment_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/transit_time.ipynb b/examples/notebook/examples/transit_time.ipynb
index f0946e6b9b..d267fe8188 100644
--- a/examples/notebook/examples/transit_time.ipynb
+++ b/examples/notebook/examples/transit_time.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/tsp_sat.ipynb b/examples/notebook/examples/tsp_sat.ipynb
index 2251e0e823..a1f47e1b6e 100644
--- a/examples/notebook/examples/tsp_sat.ipynb
+++ b/examples/notebook/examples/tsp_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/vendor_scheduling_sat.ipynb b/examples/notebook/examples/vendor_scheduling_sat.ipynb
index 7228603815..a6f0c1e160 100644
--- a/examples/notebook/examples/vendor_scheduling_sat.ipynb
+++ b/examples/notebook/examples/vendor_scheduling_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/wedding_optimal_chart_sat.ipynb b/examples/notebook/examples/wedding_optimal_chart_sat.ipynb
index 831f5162b3..e46e0e139a 100644
--- a/examples/notebook/examples/wedding_optimal_chart_sat.ipynb
+++ b/examples/notebook/examples/wedding_optimal_chart_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/worker_schedule_sat.ipynb b/examples/notebook/examples/worker_schedule_sat.ipynb
index 9c619998aa..f13cea61bf 100644
--- a/examples/notebook/examples/worker_schedule_sat.ipynb
+++ b/examples/notebook/examples/worker_schedule_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/examples/zebra_sat.ipynb b/examples/notebook/examples/zebra_sat.ipynb
index 9f8a05d766..16a3460c27 100644
--- a/examples/notebook/examples/zebra_sat.ipynb
+++ b/examples/notebook/examples/zebra_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/graph/assignment_linear_sum_assignment.ipynb b/examples/notebook/graph/assignment_linear_sum_assignment.ipynb
index d4f9168ec0..168e430655 100644
--- a/examples/notebook/graph/assignment_linear_sum_assignment.ipynb
+++ b/examples/notebook/graph/assignment_linear_sum_assignment.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solve assignment problem using linear assignment solver."
]
},
@@ -84,24 +85,27 @@
"source": [
"from ortools.graph.python import linear_sum_assignment\n",
"\n",
+ "import numpy as np\n",
+ "\n",
"\n",
"def main():\n",
" \"\"\"Linear Sum Assignment example.\"\"\"\n",
" assignment = linear_sum_assignment.SimpleLinearSumAssignment()\n",
"\n",
- " costs = [\n",
+ " costs = np.array([\n",
" [90, 76, 75, 70],\n",
" [35, 85, 55, 65],\n",
" [125, 95, 90, 105],\n",
" [45, 110, 95, 115],\n",
- " ]\n",
- " num_workers = len(costs)\n",
- " num_tasks = len(costs[0])\n",
+ " ])\n",
"\n",
- " for worker in range(num_workers):\n",
- " for task in range(num_tasks):\n",
- " if costs[worker][task]:\n",
- " assignment.add_arc_with_cost(worker, task, costs[worker][task])\n",
+ " # Let's transform this into 3 parallel vectors (start_nodes, end_nodes, arc_costs)\n",
+ " end_nodes_unraveled, start_nodes_unraveled = np.meshgrid(np.arange(costs.shape[1]),np.arange(costs.shape[0]))\n",
+ " start_nodes = start_nodes_unraveled.ravel()\n",
+ " end_nodes = end_nodes_unraveled.ravel()\n",
+ " arc_costs = costs.ravel()\n",
+ "\n",
+ " assignment.add_arcs_with_cost(start_nodes, end_nodes, arc_costs)\n",
"\n",
" status = assignment.solve()\n",
"\n",
diff --git a/examples/notebook/graph/assignment_min_flow.ipynb b/examples/notebook/graph/assignment_min_flow.ipynb
index 6c063fe056..337a44f023 100644
--- a/examples/notebook/graph/assignment_min_flow.ipynb
+++ b/examples/notebook/graph/assignment_min_flow.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Linear assignment example."
]
},
diff --git a/examples/notebook/graph/balance_min_flow.ipynb b/examples/notebook/graph/balance_min_flow.ipynb
index 40331bb47d..4aff9b4fd0 100644
--- a/examples/notebook/graph/balance_min_flow.ipynb
+++ b/examples/notebook/graph/balance_min_flow.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Assignment with teams of workers."
]
},
diff --git a/examples/notebook/graph/simple_max_flow_program.ipynb b/examples/notebook/graph/simple_max_flow_program.ipynb
index 7417dac559..05fcd472f0 100644
--- a/examples/notebook/graph/simple_max_flow_program.ipynb
+++ b/examples/notebook/graph/simple_max_flow_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"From Taha 'Introduction to Operations Research', example 6.4-2."
]
},
@@ -84,6 +85,8 @@
"source": [
"from ortools.graph.python import max_flow\n",
"\n",
+ "import numpy as np\n",
+ "\n",
"\n",
"def main():\n",
" \"\"\"MaxFlow simple interface example.\"\"\"\n",
@@ -93,13 +96,13 @@
" # Define three parallel arrays: start_nodes, end_nodes, and the capacities\n",
" # between each pair. For instance, the arc from node 0 to node 1 has a\n",
" # capacity of 20.\n",
- " start_nodes = [0, 0, 0, 1, 1, 2, 2, 3, 3]\n",
- " end_nodes = [1, 2, 3, 2, 4, 3, 4, 2, 4]\n",
- " capacities = [20, 30, 10, 40, 30, 10, 20, 5, 20]\n",
+ " start_nodes = np.array([0, 0, 0, 1, 1, 2, 2, 3, 3])\n",
+ " end_nodes = np.array([1, 2, 3, 2, 4, 3, 4, 2, 4])\n",
+ " capacities = np.array([20, 30, 10, 40, 30, 10, 20, 5, 20])\n",
"\n",
- " # Add each arc.\n",
- " for arc in zip(start_nodes, end_nodes, capacities):\n",
- " smf.add_arc_with_capacity(arc[0], arc[1], arc[2])\n",
+ " # Add arcs in bulk. \n",
+ " # note: we could have used add_arc_with_capacity(start, end, capacity)\n",
+ " smf.add_arcs_with_capacity(start_nodes, end_nodes, capacities)\n",
"\n",
" # Find the maximum flow between node 0 and node 4.\n",
" status = smf.solve(0, 4)\n",
diff --git a/examples/notebook/graph/simple_min_cost_flow_program.ipynb b/examples/notebook/graph/simple_min_cost_flow_program.ipynb
index c92cd85424..48da6f2704 100644
--- a/examples/notebook/graph/simple_min_cost_flow_program.ipynb
+++ b/examples/notebook/graph/simple_min_cost_flow_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"From Bradley, Hax and Maganti, 'Applied Mathematical Programming', figure 8.1."
]
},
@@ -84,6 +85,8 @@
"source": [
"from ortools.graph.python import min_cost_flow\n",
"\n",
+ "import numpy as np\n",
+ "\n",
"\n",
"def main():\n",
" \"\"\"MinCostFlow simple interface example.\"\"\"\n",
@@ -93,17 +96,16 @@
" # Define four parallel arrays: sources, destinations, capacities,\n",
" # and unit costs between each pair. For instance, the arc from node 0\n",
" # to node 1 has a capacity of 15.\n",
- " start_nodes = [0, 0, 1, 1, 1, 2, 2, 3, 4]\n",
- " end_nodes = [1, 2, 2, 3, 4, 3, 4, 4, 2]\n",
- " capacities = [15, 8, 20, 4, 10, 15, 4, 20, 5]\n",
- " unit_costs = [4, 4, 2, 2, 6, 1, 3, 2, 3]\n",
+ " start_nodes = np.array([0, 0, 1, 1, 1, 2, 2, 3, 4])\n",
+ " end_nodes = np.array([1, 2, 2, 3, 4, 3, 4, 4, 2])\n",
+ " capacities = np.array([15, 8, 20, 4, 10, 15, 4, 20, 5])\n",
+ " unit_costs = np.array([4, 4, 2, 2, 6, 1, 3, 2, 3])\n",
"\n",
" # Define an array of supplies at each node.\n",
" supplies = [20, 0, 0, -5, -15]\n",
"\n",
- " # Add each arc.\n",
- " for arc in zip(start_nodes, end_nodes, capacities, unit_costs):\n",
- " smcf.add_arc_with_capacity_and_unit_cost(arc[0], arc[1], arc[2], arc[3])\n",
+ " # Add arcs, capacities and costs in bulk using numpy.\n",
+ " smcf.add_arcs_with_capacity_and_unit_cost(start_nodes, end_nodes, capacities, unit_costs)\n",
"\n",
" # Add node supply.\n",
" for count, supply in enumerate(supplies):\n",
diff --git a/examples/notebook/linear_solver/assignment_groups_mip.ipynb b/examples/notebook/linear_solver/assignment_groups_mip.ipynb
index 9705ec038c..396e5d236e 100644
--- a/examples/notebook/linear_solver/assignment_groups_mip.ipynb
+++ b/examples/notebook/linear_solver/assignment_groups_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solve assignment problem for given group of workers."
]
},
@@ -132,6 +133,8 @@
" # Solver.\n",
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Variables\n",
" # x[worker, task] is an array of 0-1 variables, which will be 1\n",
diff --git a/examples/notebook/linear_solver/assignment_mip.ipynb b/examples/notebook/linear_solver/assignment_mip.ipynb
index af0bc7e807..50de3f1c98 100644
--- a/examples/notebook/linear_solver/assignment_mip.ipynb
+++ b/examples/notebook/linear_solver/assignment_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -101,6 +101,8 @@
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
"\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Variables\n",
" # x[i, j] is an array of 0-1 variables, which will be 1\n",
diff --git a/examples/notebook/linear_solver/assignment_task_sizes_mip.ipynb b/examples/notebook/linear_solver/assignment_task_sizes_mip.ipynb
index aa3fba7b1b..9e1fb3f00d 100644
--- a/examples/notebook/linear_solver/assignment_task_sizes_mip.ipynb
+++ b/examples/notebook/linear_solver/assignment_task_sizes_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"MIP example that solves an assignment problem."
]
},
@@ -110,6 +111,8 @@
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
"\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Variables\n",
" # x[i, j] is an array of 0-1 variables, which will be 1\n",
diff --git a/examples/notebook/linear_solver/assignment_teams_mip.ipynb b/examples/notebook/linear_solver/assignment_teams_mip.ipynb
index 6a258c2c9a..bf18513ecd 100644
--- a/examples/notebook/linear_solver/assignment_teams_mip.ipynb
+++ b/examples/notebook/linear_solver/assignment_teams_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"MIP example that solves an assignment problem."
]
},
@@ -106,6 +107,8 @@
" # Solver\n",
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Variables\n",
" # x[i, j] is an array of 0-1 variables, which will be 1\n",
diff --git a/examples/notebook/linear_solver/basic_example.ipynb b/examples/notebook/linear_solver/basic_example.ipynb
index 0a5b325511..d81901ea99 100644
--- a/examples/notebook/linear_solver/basic_example.ipynb
+++ b/examples/notebook/linear_solver/basic_example.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -89,6 +89,8 @@
"def main():\n",
" # Create the linear solver with the GLOP backend.\n",
" solver = pywraplp.Solver.CreateSolver('GLOP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Create the variables x and y.\n",
" x = solver.NumVar(0, 1, 'x')\n",
diff --git a/examples/notebook/linear_solver/bin_packing_mip.ipynb b/examples/notebook/linear_solver/bin_packing_mip.ipynb
index 55bc755917..bf6a3f7023 100644
--- a/examples/notebook/linear_solver/bin_packing_mip.ipynb
+++ b/examples/notebook/linear_solver/bin_packing_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -103,6 +103,8 @@
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
"\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Variables\n",
" # x[i, j] = 1 if item i is packed in bin j.\n",
diff --git a/examples/notebook/linear_solver/integer_programming_example.ipynb b/examples/notebook/linear_solver/integer_programming_example.ipynb
index 858c22a4bb..fc75c3f2b5 100644
--- a/examples/notebook/linear_solver/integer_programming_example.ipynb
+++ b/examples/notebook/linear_solver/integer_programming_example.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -89,7 +89,8 @@
" \"\"\"Integer programming sample.\"\"\"\n",
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
- "\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # x, y, and z are non-negative integer variables.\n",
" x = solver.IntVar(0.0, solver.infinity(), 'x')\n",
diff --git a/examples/notebook/linear_solver/linear_programming_example.ipynb b/examples/notebook/linear_solver/linear_programming_example.ipynb
index 45a8c17290..907d51a6f0 100644
--- a/examples/notebook/linear_solver/linear_programming_example.ipynb
+++ b/examples/notebook/linear_solver/linear_programming_example.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -89,6 +89,8 @@
" \"\"\"Linear programming sample.\"\"\"\n",
" # Instantiate a Glop solver, naming it LinearExample.\n",
" solver = pywraplp.Solver.CreateSolver('GLOP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Create the two variables and let them take on any non-negative value.\n",
" x = solver.NumVar(0, solver.infinity(), 'x')\n",
diff --git a/examples/notebook/linear_solver/mip_var_array.ipynb b/examples/notebook/linear_solver/mip_var_array.ipynb
index 2eac0e590a..68291b30b6 100644
--- a/examples/notebook/linear_solver/mip_var_array.ipynb
+++ b/examples/notebook/linear_solver/mip_var_array.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -106,6 +106,8 @@
" data = create_data_model()\n",
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" infinity = solver.infinity()\n",
" x = {}\n",
diff --git a/examples/notebook/linear_solver/multiple_knapsack_mip.ipynb b/examples/notebook/linear_solver/multiple_knapsack_mip.ipynb
index 73908936d7..f56b790cbb 100644
--- a/examples/notebook/linear_solver/multiple_knapsack_mip.ipynb
+++ b/examples/notebook/linear_solver/multiple_knapsack_mip.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solve a multiple knapsack problem using a MIP solver."
]
},
diff --git a/examples/notebook/linear_solver/simple_lp_program.ipynb b/examples/notebook/linear_solver/simple_lp_program.ipynb
index dc82aeb5b0..891c8780ad 100644
--- a/examples/notebook/linear_solver/simple_lp_program.ipynb
+++ b/examples/notebook/linear_solver/simple_lp_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -88,6 +88,8 @@
"def main():\n",
" # Create the linear solver with the GLOP backend.\n",
" solver = pywraplp.Solver.CreateSolver('GLOP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" infinity = solver.infinity()\n",
" # Create the variables x and y.\n",
diff --git a/examples/notebook/linear_solver/simple_mip_program.ipynb b/examples/notebook/linear_solver/simple_mip_program.ipynb
index 38a161c53c..cf8d283ddf 100644
--- a/examples/notebook/linear_solver/simple_mip_program.ipynb
+++ b/examples/notebook/linear_solver/simple_mip_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -88,6 +88,8 @@
"def main():\n",
" # Create the mip solver with the SCIP backend.\n",
" solver = pywraplp.Solver.CreateSolver('SCIP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" infinity = solver.infinity()\n",
" # x and y are integer non-negative variables.\n",
diff --git a/examples/notebook/linear_solver/stigler_diet.ipynb b/examples/notebook/linear_solver/stigler_diet.ipynb
index 2c6da1933f..b3b4413ebe 100644
--- a/examples/notebook/linear_solver/stigler_diet.ipynb
+++ b/examples/notebook/linear_solver/stigler_diet.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"The Stigler diet problem.\n",
"\n",
"A description of the problem can be found here:\n",
@@ -287,8 +288,9 @@
" ]\n",
"\n",
" # Instantiate a Glop solver and naming it.\n",
- " solver = pywraplp.Solver('StiglerDietExample',\n",
- " pywraplp.Solver.GLOP_LINEAR_PROGRAMMING)\n",
+ " solver = pywraplp.Solver.CreateSolver('GLOP')\n",
+ " if not solver:\n",
+ " return\n",
"\n",
" # Declare an array to hold our variables.\n",
" foods = [solver.NumVar(0.0, solver.infinity(), item[0]) for item in data]\n",
diff --git a/examples/notebook/model_builder/assignment_mb.ipynb b/examples/notebook/model_builder/assignment_mb.ipynb
index 0d18a8efdb..14fdb8cf51 100644
--- a/examples/notebook/model_builder/assignment_mb.ipynb
+++ b/examples/notebook/model_builder/assignment_mb.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/model_builder/bin_packing_mb.ipynb b/examples/notebook/model_builder/bin_packing_mb.ipynb
index 898d237941..7efc2bd8d0 100644
--- a/examples/notebook/model_builder/bin_packing_mb.ipynb
+++ b/examples/notebook/model_builder/bin_packing_mb.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/model_builder/simple_lp_program_mb.ipynb b/examples/notebook/model_builder/simple_lp_program_mb.ipynb
index 604cf4ad4c..09ba5e076a 100644
--- a/examples/notebook/model_builder/simple_lp_program_mb.ipynb
+++ b/examples/notebook/model_builder/simple_lp_program_mb.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Minimal example to call the GLOP solver using model_builder."
]
},
diff --git a/examples/notebook/model_builder/simple_mip_program_mb.ipynb b/examples/notebook/model_builder/simple_mip_program_mb.ipynb
index f0239a0ab8..d0e770b73c 100644
--- a/examples/notebook/model_builder/simple_mip_program_mb.ipynb
+++ b/examples/notebook/model_builder/simple_mip_program_mb.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Integer programming examples that show how to use the APIs."
]
},
diff --git a/examples/notebook/sat/assignment_groups_sat.ipynb b/examples/notebook/sat/assignment_groups_sat.ipynb
index f48706ce9e..36f2640bcf 100644
--- a/examples/notebook/sat/assignment_groups_sat.ipynb
+++ b/examples/notebook/sat/assignment_groups_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solve assignment problem for given group of workers."
]
},
diff --git a/examples/notebook/sat/assignment_sat.ipynb b/examples/notebook/sat/assignment_sat.ipynb
index dad8890502..d7217a1ff8 100644
--- a/examples/notebook/sat/assignment_sat.ipynb
+++ b/examples/notebook/sat/assignment_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/assignment_task_sizes_sat.ipynb b/examples/notebook/sat/assignment_task_sizes_sat.ipynb
index c4333e7aca..d60e6acfe8 100644
--- a/examples/notebook/sat/assignment_task_sizes_sat.ipynb
+++ b/examples/notebook/sat/assignment_task_sizes_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solve a simple assignment problem."
]
},
diff --git a/examples/notebook/sat/assignment_teams_sat.ipynb b/examples/notebook/sat/assignment_teams_sat.ipynb
index 643384006c..46919a4888 100644
--- a/examples/notebook/sat/assignment_teams_sat.ipynb
+++ b/examples/notebook/sat/assignment_teams_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solve a simple assignment problem."
]
},
diff --git a/examples/notebook/sat/assumptions_sample_sat.ipynb b/examples/notebook/sat/assumptions_sample_sat.ipynb
index 8e71eab109..6fa9af8386 100644
--- a/examples/notebook/sat/assumptions_sample_sat.ipynb
+++ b/examples/notebook/sat/assumptions_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/binpacking_problem_sat.ipynb b/examples/notebook/sat/binpacking_problem_sat.ipynb
index 1a8799289d..e32355b77c 100644
--- a/examples/notebook/sat/binpacking_problem_sat.ipynb
+++ b/examples/notebook/sat/binpacking_problem_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/bool_or_sample_sat.ipynb b/examples/notebook/sat/bool_or_sample_sat.ipynb
index 6cb4121230..d75b962489 100644
--- a/examples/notebook/sat/bool_or_sample_sat.ipynb
+++ b/examples/notebook/sat/bool_or_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/boolean_product_sample_sat.ipynb b/examples/notebook/sat/boolean_product_sample_sat.ipynb
index 7331e9961c..377e238137 100644
--- a/examples/notebook/sat/boolean_product_sample_sat.ipynb
+++ b/examples/notebook/sat/boolean_product_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/channeling_sample_sat.ipynb b/examples/notebook/sat/channeling_sample_sat.ipynb
index d2bbcad1dc..77b73816e1 100644
--- a/examples/notebook/sat/channeling_sample_sat.ipynb
+++ b/examples/notebook/sat/channeling_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/copy_model_sample_sat.ipynb b/examples/notebook/sat/copy_model_sample_sat.ipynb
index 1080132a00..cf7e4c5f77 100644
--- a/examples/notebook/sat/copy_model_sample_sat.ipynb
+++ b/examples/notebook/sat/copy_model_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/cp_is_fun_sat.ipynb b/examples/notebook/sat/cp_is_fun_sat.ipynb
index 3237755b22..71453b7a7c 100644
--- a/examples/notebook/sat/cp_is_fun_sat.ipynb
+++ b/examples/notebook/sat/cp_is_fun_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Cryptarithmetic puzzle.\n",
"\n",
"First attempt to solve equation CP + IS + FUN = TRUE\n",
diff --git a/examples/notebook/sat/cp_sat_example.ipynb b/examples/notebook/sat/cp_sat_example.ipynb
index 0132cefec4..f16ebe7888 100644
--- a/examples/notebook/sat/cp_sat_example.ipynb
+++ b/examples/notebook/sat/cp_sat_example.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple solve."
]
},
diff --git a/examples/notebook/sat/earliness_tardiness_cost_sample_sat.ipynb b/examples/notebook/sat/earliness_tardiness_cost_sample_sat.ipynb
index 60c61c317c..999c98e8b2 100644
--- a/examples/notebook/sat/earliness_tardiness_cost_sample_sat.ipynb
+++ b/examples/notebook/sat/earliness_tardiness_cost_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/interval_sample_sat.ipynb b/examples/notebook/sat/interval_sample_sat.ipynb
index 73d869b34f..358ea96d6e 100644
--- a/examples/notebook/sat/interval_sample_sat.ipynb
+++ b/examples/notebook/sat/interval_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/literal_sample_sat.ipynb b/examples/notebook/sat/literal_sample_sat.ipynb
index ce5cea3983..c6740c6258 100644
--- a/examples/notebook/sat/literal_sample_sat.ipynb
+++ b/examples/notebook/sat/literal_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/minimal_jobshop_sat.ipynb b/examples/notebook/sat/minimal_jobshop_sat.ipynb
index a9aca0e8da..63ee095f97 100644
--- a/examples/notebook/sat/minimal_jobshop_sat.ipynb
+++ b/examples/notebook/sat/minimal_jobshop_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Minimal jobshop example."
]
},
diff --git a/examples/notebook/sat/multiple_knapsack_sat.ipynb b/examples/notebook/sat/multiple_knapsack_sat.ipynb
index d7e3eeb384..3efba48f50 100644
--- a/examples/notebook/sat/multiple_knapsack_sat.ipynb
+++ b/examples/notebook/sat/multiple_knapsack_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solves a multiple knapsack problem using the CP-SAT solver."
]
},
diff --git a/examples/notebook/sat/no_overlap_sample_sat.ipynb b/examples/notebook/sat/no_overlap_sample_sat.ipynb
index 682a7d011e..b880cdff15 100644
--- a/examples/notebook/sat/no_overlap_sample_sat.ipynb
+++ b/examples/notebook/sat/no_overlap_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/nqueens_sat.ipynb b/examples/notebook/sat/nqueens_sat.ipynb
index 1898f7ef9f..59e9b1cd31 100644
--- a/examples/notebook/sat/nqueens_sat.ipynb
+++ b/examples/notebook/sat/nqueens_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"OR-Tools solution to the N-queens problem."
]
},
diff --git a/examples/notebook/sat/nurses_sat.ipynb b/examples/notebook/sat/nurses_sat.ipynb
index 5010728096..509020e057 100644
--- a/examples/notebook/sat/nurses_sat.ipynb
+++ b/examples/notebook/sat/nurses_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Example of a simple nurse scheduling problem."
]
},
diff --git a/examples/notebook/sat/optional_interval_sample_sat.ipynb b/examples/notebook/sat/optional_interval_sample_sat.ipynb
index 809bb24f1d..877b0b823b 100644
--- a/examples/notebook/sat/optional_interval_sample_sat.ipynb
+++ b/examples/notebook/sat/optional_interval_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/overlapping_intervals_sample_sat.ipynb b/examples/notebook/sat/overlapping_intervals_sample_sat.ipynb
index 08459c7830..81ffdf4a57 100644
--- a/examples/notebook/sat/overlapping_intervals_sample_sat.ipynb
+++ b/examples/notebook/sat/overlapping_intervals_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/rabbits_and_pheasants_sat.ipynb b/examples/notebook/sat/rabbits_and_pheasants_sat.ipynb
index e9dea1a52a..00b9c2b892 100644
--- a/examples/notebook/sat/rabbits_and_pheasants_sat.ipynb
+++ b/examples/notebook/sat/rabbits_and_pheasants_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/ranking_sample_sat.ipynb b/examples/notebook/sat/ranking_sample_sat.ipynb
index 39f882d8c4..21eee475ba 100644
--- a/examples/notebook/sat/ranking_sample_sat.ipynb
+++ b/examples/notebook/sat/ranking_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/reified_sample_sat.ipynb b/examples/notebook/sat/reified_sample_sat.ipynb
index 7a121e4b3e..a8e6d01e9e 100644
--- a/examples/notebook/sat/reified_sample_sat.ipynb
+++ b/examples/notebook/sat/reified_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/schedule_requests_sat.ipynb b/examples/notebook/sat/schedule_requests_sat.ipynb
index a67fb8303e..80b5228cd4 100644
--- a/examples/notebook/sat/schedule_requests_sat.ipynb
+++ b/examples/notebook/sat/schedule_requests_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Nurse scheduling problem with shift requests."
]
},
diff --git a/examples/notebook/sat/scheduling_with_calendar_sample_sat.ipynb b/examples/notebook/sat/scheduling_with_calendar_sample_sat.ipynb
index 2520e688dc..a58da5eec7 100644
--- a/examples/notebook/sat/scheduling_with_calendar_sample_sat.ipynb
+++ b/examples/notebook/sat/scheduling_with_calendar_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/search_for_all_solutions_sample_sat.ipynb b/examples/notebook/sat/search_for_all_solutions_sample_sat.ipynb
index 49ee896938..5444cc4ebf 100644
--- a/examples/notebook/sat/search_for_all_solutions_sample_sat.ipynb
+++ b/examples/notebook/sat/search_for_all_solutions_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/simple_sat_program.ipynb b/examples/notebook/sat/simple_sat_program.ipynb
index 66b59fc2eb..b8b56e7372 100644
--- a/examples/notebook/sat/simple_sat_program.ipynb
+++ b/examples/notebook/sat/simple_sat_program.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Simple solve."
]
},
diff --git a/examples/notebook/sat/solution_hinting_sample_sat.ipynb b/examples/notebook/sat/solution_hinting_sample_sat.ipynb
index 3f8b657f82..61f2fdefbc 100644
--- a/examples/notebook/sat/solution_hinting_sample_sat.ipynb
+++ b/examples/notebook/sat/solution_hinting_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/solve_and_print_intermediate_solutions_sample_sat.ipynb b/examples/notebook/sat/solve_and_print_intermediate_solutions_sample_sat.ipynb
index 0bccfad43a..db8ca7bba9 100644
--- a/examples/notebook/sat/solve_and_print_intermediate_solutions_sample_sat.ipynb
+++ b/examples/notebook/sat/solve_and_print_intermediate_solutions_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/solve_with_time_limit_sample_sat.ipynb b/examples/notebook/sat/solve_with_time_limit_sample_sat.ipynb
index f7073fe536..e96f17cb51 100644
--- a/examples/notebook/sat/solve_with_time_limit_sample_sat.ipynb
+++ b/examples/notebook/sat/solve_with_time_limit_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Solves a problem with a time limit.\n"
]
},
diff --git a/examples/notebook/sat/step_function_sample_sat.ipynb b/examples/notebook/sat/step_function_sample_sat.ipynb
index 2ad66a97a3..a8a0931974 100644
--- a/examples/notebook/sat/step_function_sample_sat.ipynb
+++ b/examples/notebook/sat/step_function_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
diff --git a/examples/notebook/sat/stop_after_n_solutions_sample_sat.ipynb b/examples/notebook/sat/stop_after_n_solutions_sample_sat.ipynb
index 2a89974ffe..4ac2dec17f 100644
--- a/examples/notebook/sat/stop_after_n_solutions_sample_sat.ipynb
+++ b/examples/notebook/sat/stop_after_n_solutions_sample_sat.ipynb
@@ -41,10 +41,10 @@
"source": [
""
]
@@ -72,6 +72,7 @@
"id": "description",
"metadata": {},
"source": [
+ "\n",
"Code sample that solves a model and displays a small number of solutions.\n"
]
},