Skip to content

Commit c316431

Browse files
committed
examples: regenerate notebook
1 parent 2f299d5 commit c316431

File tree

63 files changed

+1903
-909
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1903
-909
lines changed

examples/notebook/algorithms/knapsack.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"from ortools.algorithms.python import knapsack_solver\n",
8787
"\n",
8888
"\n",
89+
"\n",
8990
"def main():\n",
9091
" # Create the solver.\n",
9192
" solver = knapsack_solver.KnapsackSolver(\n",

examples/notebook/algorithms/simple_knapsack_program.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"from ortools.algorithms.python import knapsack_solver\n",
8787
"\n",
8888
"\n",
89+
"\n",
8990
"def main():\n",
9091
" # Create the solver.\n",
9192
" solver = knapsack_solver.KnapsackSolver(\n",

examples/notebook/contrib/permutation_flow_shop.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
"import numpy as np\n",
9696
"\n",
9797
"from ortools.sat.colab import flags\n",
98-
"from google.protobuf import text_format\n",
9998
"from ortools.sat.python import cp_model\n",
10099
"\n",
101100
"_PARAMS = flags.define_string(\n",
@@ -217,7 +216,7 @@
217216
"\n",
218217
" solver = cp_model.CpSolver()\n",
219218
" if params:\n",
220-
" text_format.Parse(params, solver.parameters)\n",
219+
" solver.parameters.parse_text_format(params)\n",
221220
" solver.parameters.log_search_progress = log\n",
222221
" solver.parameters.max_time_in_seconds = time_limit\n",
223222
"\n",

examples/notebook/contrib/scheduling_with_transitions_sat.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"import collections\n",
9191
"\n",
9292
"from ortools.sat.python import cp_model\n",
93-
"from google.protobuf import text_format\n",
9493
"\n",
9594
"#----------------------------------------------------------------------------\n",
9695
"# Command line arguments.\n",
@@ -376,7 +375,7 @@
376375
" solver = cp_model.CpSolver()\n",
377376
" solver.parameters.max_time_in_seconds = 60 * 60 * 2\n",
378377
" if parameters:\n",
379-
" text_format.Merge(parameters, solver.parameters)\n",
378+
" solver.parameters.merge_text_format(parameters)\n",
380379
" solution_printer = SolutionPrinter(makespan)\n",
381380
" status = solver.Solve(model, solution_printer)\n",
382381
"\n",

examples/notebook/examples/appointments.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
"\n",
245245
"\n",
246246
"def get_optimal_schedule(\n",
247-
" demand: list[tuple[float, str, int]]\n",
247+
" demand: list[tuple[float, str, int]],\n",
248248
") -> list[tuple[int, list[tuple[int, str]]]]:\n",
249249
" \"\"\"Computes the optimal schedule for the installation input.\n",
250250
"\n",

examples/notebook/examples/arc_flow_cutting_stock_sat.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
"from ortools.sat.colab import flags\n",
9090
"import numpy as np\n",
9191
"\n",
92-
"from google.protobuf import text_format\n",
9392
"from ortools.linear_solver.python import model_builder as mb\n",
9493
"from ortools.sat.python import cp_model\n",
9594
"\n",
@@ -387,7 +386,7 @@
387386
" # Solve model.\n",
388387
" solver = cp_model.CpSolver()\n",
389388
" if params:\n",
390-
" text_format.Parse(params, solver.parameters)\n",
389+
" solver.parameters.parse_text_format(params)\n",
391390
" solver.parameters.log_search_progress = True\n",
392391
" solver.Solve(model)\n",
393392
"\n",

examples/notebook/examples/balance_group_sat.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"Each item has a color and a value. We want the sum of values of each group to\n",
7979
"be as close to the average as possible.\n",
8080
"Furthermore, if one color is an a group, at least k items with this color must\n",
81-
"be in that group.\n"
81+
"be in that group.\n",
82+
"\n"
8283
]
8384
},
8485
{

examples/notebook/examples/bus_driver_scheduling_sat.ipynb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
"import math\n",
9898
"\n",
9999
"from ortools.sat.colab import flags\n",
100-
"from google.protobuf import text_format\n",
101100
"from ortools.sat.python import cp_model\n",
102101
"\n",
103102
"_OUTPUT_PROTO = flags.define_string(\n",
@@ -149,7 +148,7 @@
149148
" [25, \"15:40\", \"15:56\", 940, 956, 16],\n",
150149
" [26, \"15:58\", \"16:45\", 958, 1005, 47],\n",
151150
" [27, \"16:04\", \"17:30\", 964, 1050, 86],\n",
152-
"] # yapf:disable\n",
151+
"]\n",
153152
"\n",
154153
"SAMPLE_SHIFTS_SMALL = [\n",
155154
" #\n",
@@ -211,7 +210,7 @@
211210
" [47, \"18:34\", \"19:58\", 1114, 1198, 84],\n",
212211
" [48, \"19:56\", \"20:34\", 1196, 1234, 38],\n",
213212
" [49, \"20:05\", \"20:48\", 1205, 1248, 43],\n",
214-
"] # yapf:disable\n",
213+
"]\n",
215214
"\n",
216215
"SAMPLE_SHIFTS_MEDIUM = [\n",
217216
" [0, \"04:30\", \"04:53\", 270, 293, 23],\n",
@@ -414,7 +413,7 @@
414413
" [197, \"00:02\", \"00:12\", 1442, 1452, 10],\n",
415414
" [198, \"00:07\", \"00:39\", 1447, 1479, 32],\n",
416415
" [199, \"00:25\", \"01:12\", 1465, 1512, 47],\n",
417-
"] # yapf:disable\n",
416+
"]\n",
418417
"\n",
419418
"SAMPLE_SHIFTS_LARGE = [\n",
420419
" [0, \"04:18\", \"05:00\", 258, 300, 42],\n",
@@ -1773,7 +1772,7 @@
17731772
" [1353, \"00:47\", \"01:26\", 1487, 1526, 39],\n",
17741773
" [1354, \"00:54\", \"01:04\", 1494, 1504, 10],\n",
17751774
" [1355, \"00:57\", \"01:07\", 1497, 1507, 10],\n",
1776-
"] # yapf:disable\n",
1775+
"]\n",
17771776
"\n",
17781777
"\n",
17791778
"def bus_driver_scheduling(minimize_drivers: bool, max_num_drivers: int) -> int:\n",
@@ -2049,7 +2048,7 @@
20492048
" # Solve model.\n",
20502049
" solver = cp_model.CpSolver()\n",
20512050
" if _PARAMS.value:\n",
2052-
" text_format.Parse(_PARAMS.value, solver.parameters)\n",
2051+
" solver.parameters.parse_text_format(_PARAMS.value)\n",
20532052
"\n",
20542053
" status = solver.solve(model)\n",
20552054
"\n",

0 commit comments

Comments
 (0)