# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1284201949 -7200
# Node ID aa40b85c88b263d080936bb241448e6bbb29f82d
# Parent c7d0d23da6dc1a6aa95b569aacf390769b4e7b10
trac 9836 -- fixes in the LP thematic tutorial
diff -r c7d0d23da6dc -r aa40b85c88b2 doc/en/thematic_tutorials/linear_programming.rst
a
|
b
|
|
238 | 238 | |
239 | 239 | :: |
240 | 240 | |
241 | | sage: poids = {} |
| 241 | sage: weight = {} |
242 | 242 | sage: usefulness = {} |
243 | 243 | |
244 | 244 | .. link |
… |
… |
|
247 | 247 | |
248 | 248 | sage: set_random_seed(685474) |
249 | 249 | sage: for o in L: |
250 | | ... poids[o] = random() |
| 250 | ... weight[o] = random() |
251 | 251 | ... usefulness[o] = random() |
252 | 252 | |
253 | 253 | We can now define the MILP itself |
… |
… |
|
263 | 263 | |
264 | 264 | :: |
265 | 265 | |
266 | | sage: p.add_constraint(sum(poids[o] * taken[o] for o in L) <= C) |
| 266 | sage: p.add_constraint(sum(weight[o] * taken[o] for o in L) <= C) |
267 | 267 | |
268 | 268 | .. link |
269 | 269 | |
… |
… |
|
285 | 285 | |
286 | 286 | :: |
287 | 287 | |
288 | | sage: sum(poids[o] * taken[o] for o in L) |
| 288 | sage: sum(weight[o] * taken[o] for o in L) |
289 | 289 | 0.69649597966191712 |
290 | 290 | |
291 | 291 | Should we take a flashlight? |