|
8 | 8 | "\n", |
9 | 9 | "This tutorial includes everything you need to set up decision optimization engines, build constraint programming models.\n", |
10 | 10 | "\n", |
11 | | - "\n", |
12 | 11 | "When you finish this tutorial, you'll have a foundational knowledge of _Prescriptive Analytics_.\n", |
13 | 12 | "\n", |
14 | 13 | ">This notebook is part of the **[Prescriptive Analytics for Python](https://rawgit.com/IBMDecisionOptimization/docplex-doc/master/docs/index.html)**\n", |
15 | 14 | "\n", |
16 | | - ">It requires a valid subscription to **Decision Optimization on the Cloud** or a **local installation of CPLEX Optimizers**. \n", |
| 15 | + ">It requires a **local installation of CPLEX Optimizers**. \n", |
17 | 16 | "\n", |
18 | 17 | "Discover us [here](https://developer.ibm.com/docloud)\n", |
19 | 18 | "\n", |
20 | | - "\n", |
21 | 19 | "Table of contents:\n", |
22 | 20 | "\n", |
23 | 21 | "- [Describe the business problem](#Describe-the-business-problem)\n", |
24 | 22 | "* [How decision optimization (prescriptive analytics) can help](#How--decision-optimization-can-help)\n", |
25 | 23 | "* [Use decision optimization](#Use-decision-optimization)\n", |
26 | 24 | " * [Step 1: Download the library](#Step-1:-Download-the-library)\n", |
27 | | - " * [Step 2: Set up the engines](#Step-2:-Set-up-the-prescriptive-engine)\n", |
28 | | - " - [Step 3: Model the Data](#Step-3:-Model-the-data)\n", |
29 | | - " - [Step 4: Set up the prescriptive model](#Step-4:-Set-up-the-prescriptive-model)\n", |
| 25 | + " * [Step 2: Model the Data](#Step-2:-Model-the-data)\n", |
| 26 | + " * [Step 3: Set up the prescriptive model](#Step-3:-Set-up-the-prescriptive-model)\n", |
30 | 27 | " * [Define the decision variables](#Define-the-decision-variables)\n", |
31 | 28 | " * [Express the business constraints](#Express-the-business-constraints)\n", |
32 | 29 | " * [Express the objective](#Express-the-objective)\n", |
33 | 30 | " * [Solve with Decision Optimization solve service](#Solve-with-Decision-Optimization-solve-service)\n", |
34 | | - " * [Step 5: Investigate the solution and run an example analysis](#Step-5:-Investigate-the-solution-and-then-run-an-example-analysis)\n", |
| 31 | + " * [Step 4: Investigate the solution and run an example analysis](#Step-4:-Investigate-the-solution-and-then-run-an-example-analysis)\n", |
35 | 32 | "* [Summary](#Summary)\n", |
36 | 33 | "****" |
37 | 34 | ] |
|
143 | 140 | "cell_type": "markdown", |
144 | 141 | "metadata": {}, |
145 | 142 | "source": [ |
146 | | - "### Step 2: Set up the prescriptive engine\n", |
147 | | - "\n", |
148 | | - "* Subscribe to the [Decision Optimization on Cloud solve service](https://developer.ibm.com/docloud).\n", |
149 | | - "* Get the service URL and your personal API key." |
150 | | - ] |
151 | | - }, |
152 | | - { |
153 | | - "cell_type": "code", |
154 | | - "execution_count": null, |
155 | | - "metadata": { |
156 | | - "collapsed": true |
157 | | - }, |
158 | | - "outputs": [], |
159 | | - "source": [ |
160 | | - "# Initialize IBM Decision Optimization credentials\n", |
161 | | - "SVC_URL = \"ENTER YOUR URL HERE\"\n", |
162 | | - "SVC_KEY = \"ENTER YOUR KEY HERE\"" |
163 | | - ] |
164 | | - }, |
165 | | - { |
166 | | - "cell_type": "markdown", |
167 | | - "metadata": {}, |
168 | | - "source": [ |
169 | | - "Now, we need to import all required modeling functions that are provided by the <i>docplex.cp</i> package:" |
| 143 | + "### Step 2: Model the data\n" |
170 | 144 | ] |
171 | 145 | }, |
172 | 146 | { |
|
185 | 159 | "cell_type": "markdown", |
186 | 160 | "metadata": {}, |
187 | 161 | "source": [ |
188 | | - "### Step 3: Model the data\n", |
189 | 162 | "<h4>Define model input data</h4>\n", |
190 | 163 | "<p>\n", |
191 | 164 | "The first thing to define is the model input data.\n", |
|
208 | 181 | "cell_type": "markdown", |
209 | 182 | "metadata": {}, |
210 | 183 | "source": [ |
211 | | - "### Step 4: Set up the prescriptive model" |
| 184 | + "### Step 3: Set up the prescriptive model" |
212 | 185 | ] |
213 | 186 | }, |
214 | 187 | { |
|
411 | 384 | "source": [ |
412 | 385 | "#### Solve with Decision Optimization solve service\n", |
413 | 386 | "\n", |
414 | | - "If url and key are None, the Modeling layer will look for a local runtime, otherwise will use the credentials.\n", |
| 387 | + "By default, the modeling layer look for a local runtime, but other solving environments, such as *docloud*, are also available.\n", |
415 | 388 | "Look at the documentation for a good understanding of the various solving/generation modes.\n", |
416 | 389 | "\n", |
417 | 390 | "If you're using a Community Edition of CPLEX runtimes, depending on the size of the problem, the solve stage may fail and will need a paying subscription or product installation." |
|
434 | 407 | "source": [ |
435 | 408 | "# Solve the model\n", |
436 | 409 | "print(\"Solving model....\")\n", |
437 | | - "msol = mdl.solve(url=SVC_URL, key=SVC_KEY, TimeLimit=10)" |
| 410 | + "msol = mdl.solve(TimeLimit=10)" |
438 | 411 | ] |
439 | 412 | }, |
440 | 413 | { |
441 | 414 | "cell_type": "markdown", |
442 | 415 | "metadata": {}, |
443 | 416 | "source": [ |
444 | | - "### Step 6: Investigate the solution and then run an example analysis\n", |
| 417 | + "### Step 4: Investigate the solution and then run an example analysis\n", |
445 | 418 | "\n", |
446 | 419 | "The shortest way to output the solution that has been found by the solver is to call the method <i>print_solution()</i> as follows:" |
447 | 420 | ] |
|
456 | 429 | "source": [ |
457 | 430 | "# Print solution\n", |
458 | 431 | "print(\"Solution: \")\n", |
459 | | - "msol.print_solution()" |
| 432 | + "msol.write()" |
460 | 433 | ] |
461 | 434 | }, |
462 | 435 | { |
|
531 | 504 | "source": [ |
532 | 505 | "## Summary\n", |
533 | 506 | "\n", |
534 | | - "You learned how to set up and use the IBM Decision Optimization CPLEX Modeling for Python to formulate a Constraint Programming model and solve it with IBM Decision Optimization on the cloud." |
| 507 | + "You learned how to set up and use the IBM Decision Optimization CPLEX Modeling for Python to build and solve a Constraint Programming model." |
535 | 508 | ] |
536 | 509 | }, |
537 | 510 | { |
|
549 | 522 | "cell_type": "markdown", |
550 | 523 | "metadata": {}, |
551 | 524 | "source": [ |
552 | | - "Copyright © 2017 IBM. IPLA licensed Sample Materials." |
| 525 | + "Copyright © 2017, 2018 IBM. IPLA licensed Sample Materials." |
553 | 526 | ] |
554 | 527 | } |
555 | 528 | ], |
|
0 commit comments