| Line 13: |
Line 13: |
| | Shannon has an order from Food Box Supermarkets for at least 30,000 pounds of semisweet chips and | | Shannon has an order from Food Box Supermarkets for at least 30,000 pounds of semisweet chips and |
| | 60,000 pounds of milk chocolate chips. How should Shannon schedule its production so that it can fill | | 60,000 pounds of milk chocolate chips. How should Shannon schedule its production so that it can fill |
| − | the order at minimum cost? What is the minimum cost? | + | the order at minimum cost? What is the minimum cost?<br> |
| | | | |
| | <div id="z3lp1" style="font-size:16px">'''z3 code: Chocolate Problem'''</div> | | <div id="z3lp1" style="font-size:16px">'''z3 code: Chocolate Problem'''</div> |
| Line 54: |
Line 54: |
| | Kansas: 7.5, | | Kansas: 7.5, |
| | Oklahoma: 7.5 }</source> | | Oklahoma: 7.5 }</source> |
| | + | |
| | + | |
| | + | '''ExampleS2: Coffee Problem<br>''' |
| | + | Fred's Coffee sells two blends of beans: Yusip Blend and Exotic Blend. Yusip Blend is one-half |
| | + | Costa Rican beans and one-half Ethiopian beans. Exotic Blend is one-quarter Costa Rican beans and |
| | + | three-quarters Ethiopian beans. Profit on the Yusip Blend is $3.50 per pound, while profit on the Exotic |
| | + | Blend is $4.00 per pound. Each day Fred receives a shipment of 200 pounds of Costa Rican beans and |
| | + | 330 pounds of Ethiopian beans to use for the two blends. How many pounds of each blend should be |
| | + | prepared each day to maximize profit? What is the maximum profit?<br> |
| | + | |
| | + | <div id="z3lp2" style="font-size:16px">'''z3 code: Coffee Problem'''</div> |
| | + | <source lang="cpp"> |
| | + | var solver = require('javascript-lp-solver'), |
| | + | results, |
| | + | model = { |
| | + | "name": "Coffee Problem", |
| | + | "optimize": "profit", |
| | + | "opType": "max", |
| | + | "constraints": { |
| | + | "costa": { |
| | + | "max": 200 |
| | + | }, |
| | + | "ethiopian": { |
| | + | "max": 330 |
| | + | } |
| | + | }, |
| | + | "variables": { |
| | + | "yusip": { |
| | + | "costa": 0.5, |
| | + | "ethiopian": 0.5, |
| | + | "profit": 3.5 |
| | + | }, |
| | + | "exotic": { |
| | + | "costa": 0.25, |
| | + | "ethiopian": 0.75, |
| | + | "profit": 4 |
| | + | } |
| | + | } |
| | + | }; |
| | + | console.log(solver.Solve(model));</source> |
| | + | |
| | + | <div style="font-size:18px">'''Solution:'''</div> |
| | + | <source lang="cpp"> |
| | + | { feasible: true, |
| | + | result: 1985, |
| | + | bounded: true, |
| | + | yusip: 270, |
| | + | exotic: 260 }</source> |