| Line 155: |
Line 155: |
| | wheat: 21.875, | | wheat: 21.875, |
| | barley: 53.125 }</source> | | barley: 53.125 }</source> |
| | + | |
| | + | |
| | + | '''ExampleLP4: SAS Manufacturing Problem<br>''' |
| | + | Consider the following product mix example (Hadley, 1962). A shop that has three machines, A, B, and C, turns |
| | + | out four different products. Each product must be processed on each of the three machines (for example, lathes, |
| | + | drills, and milling machines). The following table shows the number of hours required by each product on each |
| | + | machine: |
| | + | The weekly time available on each of the machines is 2,000, 8,000, and 5,000 hours, respectively. The |
| | + | products contribute 5.24, 7.30, 8.34, and 4.18 to profit, respectively. What mixture of products can be |
| | + | manufactured to maximize profit?<br> |
| | + | |
| | + | <div id="z3lp4" style="font-size:16px">'''z3 code: SAS Problem'''</div> |
| | + | <source lang="cpp"> |
| | + | var solver = require('javascript-lp-solver'), |
| | + | results, |
| | + | model = { |
| | + | "name": "Manufacturing Problem", |
| | + | "optimize": "profit", |
| | + | "opType": "max", |
| | + | "constraints": { |
| | + | "timea": { |
| | + | "max": 2000 |
| | + | }, |
| | + | "timeb": { |
| | + | "max": 8000 |
| | + | }, |
| | + | "timec": { |
| | + | "max": 5000 |
| | + | } |
| | + | }, |
| | + | "variables": { |
| | + | "m1": { |
| | + | "timea": 1.5, |
| | + | "timeb": 1, |
| | + | "timec": 1.5, |
| | + | "profit": 5.24 |
| | + | }, |
| | + | "m2": { |
| | + | "timea": 1, |
| | + | "timeb": 5, |
| | + | "timec": 3, |
| | + | "profit": 7.3 |
| | + | }, |
| | + | "m3": { |
| | + | "timea": 2.4, |
| | + | "timeb": 1, |
| | + | "timec": 3.5, |
| | + | "profit": 8.34 |
| | + | }, |
| | + | "m4": { |
| | + | "timea": 1, |
| | + | "timeb": 3.5, |
| | + | "timec": 1, |
| | + | "profit": 4.18 |
| | + | } |
| | + | }, |
| | + | }; |
| | + | console.log(solver.Solve(model));</source> |
| | + | |
| | + | <div style="font-size:18px">'''Solution:'''</div> |
| | + | <source lang="cpp"> |
| | + | { feasible: true, |
| | + | result: 12737.05882353, |
| | + | bounded: true, |
| | + | m1: 294.11764706, |
| | + | m4: 58.82352941, |
| | + | m2: 1500 }</source> |