Skip to content

Commit 88dfe4d

Browse files
committed
notebook: regenerate all
1 parent 6eb0802 commit 88dfe4d

File tree

292 files changed

+1969
-304
lines changed

Some content is hidden

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

292 files changed

+1969
-304
lines changed

examples/notebook/algorithms/knapsack.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@
132132
]
133133
}
134134
],
135-
"metadata": {},
135+
"metadata": {
136+
"language_info": {
137+
"name": "python"
138+
}
139+
},
136140
"nbformat": 4,
137141
"nbformat_minor": 5
138142
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "google",
6+
"metadata": {},
7+
"source": [
8+
"##### Copyright 2024 Google LLC."
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "apache",
14+
"metadata": {},
15+
"source": [
16+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n",
17+
"you may not use this file except in compliance with the License.\n",
18+
"You may obtain a copy of the License at\n",
19+
"\n",
20+
" http://www.apache.org/licenses/LICENSE-2.0\n",
21+
"\n",
22+
"Unless required by applicable law or agreed to in writing, software\n",
23+
"distributed under the License is distributed on an \"AS IS\" BASIS,\n",
24+
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
25+
"See the License for the specific language governing permissions and\n",
26+
"limitations under the License.\n"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"id": "basename",
32+
"metadata": {},
33+
"source": [
34+
"# set_cover"
35+
]
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"id": "link",
40+
"metadata": {},
41+
"source": [
42+
"<table align=\"left\">\n",
43+
"<td>\n",
44+
"<a href=\"https://colab.research.google.com/github/google/or-tools/blob/main/examples/notebook/algorithms/set_cover.ipynb\"><img src=\"https://raw.githubusercontent.com/google/or-tools/main/tools/colab_32px.png\"/>Run in Google Colab</a>\n",
45+
"</td>\n",
46+
"<td>\n",
47+
"<a href=\"https://github.com/google/or-tools/blob/main/ortools/algorithms/samples/set_cover.py\"><img src=\"https://raw.githubusercontent.com/google/or-tools/main/tools/github_32px.png\"/>View source on GitHub</a>\n",
48+
"</td>\n",
49+
"</table>"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"id": "doc",
55+
"metadata": {},
56+
"source": [
57+
"First, you must install [ortools](https://pypi.org/project/ortools/) package in this colab."
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"id": "install",
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"%pip install ortools"
68+
]
69+
},
70+
{
71+
"cell_type": "markdown",
72+
"id": "description",
73+
"metadata": {},
74+
"source": [
75+
"\n",
76+
"A simple set-covering problem.\n"
77+
]
78+
},
79+
{
80+
"cell_type": "code",
81+
"execution_count": null,
82+
"id": "code",
83+
"metadata": {},
84+
"outputs": [],
85+
"source": [
86+
"from ortools.algorithms.python import set_cover\n",
87+
"\n",
88+
"\n",
89+
"def main():\n",
90+
" model = set_cover.SetCoverModel()\n",
91+
" model.add_empty_subset(2.0)\n",
92+
" model.add_element_to_last_subset(0)\n",
93+
" model.add_empty_subset(2.0)\n",
94+
" model.add_element_to_last_subset(1)\n",
95+
" model.add_empty_subset(1.0)\n",
96+
" model.add_element_to_last_subset(0)\n",
97+
" model.add_element_to_last_subset(1)\n",
98+
"\n",
99+
" inv = set_cover.SetCoverInvariant(model)\n",
100+
" greedy = set_cover.GreedySolutionGenerator(inv)\n",
101+
" has_found = greedy.next_solution()\n",
102+
" if not has_found:\n",
103+
" print(\"No solution found by the greedy heuristic.\")\n",
104+
" return\n",
105+
" solution = inv.export_solution_as_proto()\n",
106+
"\n",
107+
" print(f\"Total cost: {solution.cost}\") # == inv.cost()\n",
108+
" print(f\"Total number of selected subsets: {solution.num_subsets}\")\n",
109+
" print(\"Chosen subsets:\")\n",
110+
" for subset in solution.subset:\n",
111+
" print(f\" {subset}\")\n",
112+
"\n",
113+
"\n",
114+
"main()\n",
115+
"\n"
116+
]
117+
}
118+
],
119+
"metadata": {
120+
"language_info": {
121+
"name": "python"
122+
}
123+
},
124+
"nbformat": 4,
125+
"nbformat_minor": 5
126+
}

examples/notebook/algorithms/simple_knapsack_program.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@
119119
]
120120
}
121121
],
122-
"metadata": {},
122+
"metadata": {
123+
"language_info": {
124+
"name": "python"
125+
}
126+
},
123127
"nbformat": 4,
124128
"nbformat_minor": 5
125129
}

examples/notebook/constraint_solver/cp_is_fun_cp.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@
155155
]
156156
}
157157
],
158-
"metadata": {},
158+
"metadata": {
159+
"language_info": {
160+
"name": "python"
161+
}
162+
},
159163
"nbformat": 4,
160164
"nbformat_minor": 5
161165
}

examples/notebook/constraint_solver/nqueens_cp.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@
139139
]
140140
}
141141
],
142-
"metadata": {},
142+
"metadata": {
143+
"language_info": {
144+
"name": "python"
145+
}
146+
},
143147
"nbformat": 4,
144148
"nbformat_minor": 5
145149
}

examples/notebook/constraint_solver/simple_cp_program.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@
128128
]
129129
}
130130
],
131-
"metadata": {},
131+
"metadata": {
132+
"language_info": {
133+
"name": "python"
134+
}
135+
},
132136
"nbformat": 4,
133137
"nbformat_minor": 5
134138
}

examples/notebook/contrib/3_jugs_mip.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@
234234
]
235235
}
236236
],
237-
"metadata": {},
237+
"metadata": {
238+
"language_info": {
239+
"name": "python"
240+
}
241+
},
238242
"nbformat": 4,
239243
"nbformat_minor": 5
240244
}

examples/notebook/contrib/3_jugs_regular.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@
333333
]
334334
}
335335
],
336-
"metadata": {},
336+
"metadata": {
337+
"language_info": {
338+
"name": "python"
339+
}
340+
},
337341
"nbformat": 4,
338342
"nbformat_minor": 5
339343
}

examples/notebook/contrib/a_round_of_golf.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@
236236
]
237237
}
238238
],
239-
"metadata": {},
239+
"metadata": {
240+
"language_info": {
241+
"name": "python"
242+
}
243+
},
240244
"nbformat": 4,
241245
"nbformat_minor": 5
242246
}

examples/notebook/contrib/all_interval.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@
185185
]
186186
}
187187
],
188-
"metadata": {},
188+
"metadata": {
189+
"language_info": {
190+
"name": "python"
191+
}
192+
},
189193
"nbformat": 4,
190194
"nbformat_minor": 5
191195
}

examples/notebook/contrib/alldifferent_except_0.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@
195195
]
196196
}
197197
],
198-
"metadata": {},
198+
"metadata": {
199+
"language_info": {
200+
"name": "python"
201+
}
202+
},
199203
"nbformat": 4,
200204
"nbformat_minor": 5
201205
}

examples/notebook/contrib/alphametic.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@
232232
]
233233
}
234234
],
235-
"metadata": {},
235+
"metadata": {
236+
"language_info": {
237+
"name": "python"
238+
}
239+
},
236240
"nbformat": 4,
237241
"nbformat_minor": 5
238242
}

examples/notebook/contrib/assignment.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@
193193
]
194194
}
195195
],
196-
"metadata": {},
196+
"metadata": {
197+
"language_info": {
198+
"name": "python"
199+
}
200+
},
197201
"nbformat": 4,
198202
"nbformat_minor": 5
199203
}

examples/notebook/contrib/assignment6_mip.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@
226226
]
227227
}
228228
],
229-
"metadata": {},
229+
"metadata": {
230+
"language_info": {
231+
"name": "python"
232+
}
233+
},
230234
"nbformat": 4,
231235
"nbformat_minor": 5
232236
}

examples/notebook/contrib/bacp.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@
167167
]
168168
}
169169
],
170-
"metadata": {},
170+
"metadata": {
171+
"language_info": {
172+
"name": "python"
173+
}
174+
},
171175
"nbformat": 4,
172176
"nbformat_minor": 5
173177
}

examples/notebook/contrib/blending.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@
216216
]
217217
}
218218
],
219-
"metadata": {},
219+
"metadata": {
220+
"language_info": {
221+
"name": "python"
222+
}
223+
},
220224
"nbformat": 4,
221225
"nbformat_minor": 5
222226
}

examples/notebook/contrib/broken_weights.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@
209209
]
210210
}
211211
],
212-
"metadata": {},
212+
"metadata": {
213+
"language_info": {
214+
"name": "python"
215+
}
216+
},
213217
"nbformat": 4,
214218
"nbformat_minor": 5
215219
}

examples/notebook/contrib/bus_schedule.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@
180180
]
181181
}
182182
],
183-
"metadata": {},
183+
"metadata": {
184+
"language_info": {
185+
"name": "python"
186+
}
187+
},
184188
"nbformat": 4,
185189
"nbformat_minor": 5
186190
}

examples/notebook/contrib/car.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@
209209
]
210210
}
211211
],
212-
"metadata": {},
212+
"metadata": {
213+
"language_info": {
214+
"name": "python"
215+
}
216+
},
213217
"nbformat": 4,
214218
"nbformat_minor": 5
215219
}

examples/notebook/contrib/check_dependencies.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@
191191
]
192192
}
193193
],
194-
"metadata": {},
194+
"metadata": {
195+
"language_info": {
196+
"name": "python"
197+
}
198+
},
195199
"nbformat": 4,
196200
"nbformat_minor": 5
197201
}

examples/notebook/contrib/circuit.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@
201201
]
202202
}
203203
],
204-
"metadata": {},
204+
"metadata": {
205+
"language_info": {
206+
"name": "python"
207+
}
208+
},
205209
"nbformat": 4,
206210
"nbformat_minor": 5
207211
}

examples/notebook/contrib/coins3.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@
173173
]
174174
}
175175
],
176-
"metadata": {},
176+
"metadata": {
177+
"language_info": {
178+
"name": "python"
179+
}
180+
},
177181
"nbformat": 4,
178182
"nbformat_minor": 5
179183
}

0 commit comments

Comments
 (0)