CS 100 M Lecture 17

# CS 100 M Lecture 17 - 17. More on 2D Arrays Operations...

This preview shows pages 1–14. Sign up to view the full content.

17. More on 2D Arrays Operations Subscripting *Will see two new things. Boolean-valued functions Functions that have a function as a parameter.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Two Applications A commercial setting that involves cost arrays, inventory arrays, and purchase orders. A setting that requires the visualization of a function of two variables f(x,y) via contour plotting.
A Cost/Inventory Setting A company has 3 factories that make 5 different products. The cost of making a product varies from factory to factory. The inventory varies from factory to factory.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problems A customer submits a purchase order that is to be filled by a single factory. 1. How much would it cost a factory to fill the order? 2. Does a factory have enough inventory to fill the order? 3. Among the factories that can fill the order, who can do it most cheaply?
Cost Array C: 10 36 22 15 12 35 20 12 13 37 21 16 66 62 59 The value of C(i,j) is what it costs factory i to make product j.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Inventory Array 38 5 99 34 82 19 83 12 Inv: 51 29 21 56 42 42 87 The value of Inv(i,j) is the inventory in factory i of product j.
Purchase Order The value of PO(j) is the number product j’s that the customer wants 1 0 12 5 29 PO:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
How Much Does it Cost for Each Factory to Process a Purchase order?
1 0 12 5 29 PO: C: 10 36 22 15 12 35 20 12 13 37 21 16 66 62 59 1*10 + 0*36 + 12*22 + 29* 15 + 5*62 For factory 1:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1 0 12 5 29 PO: C: 10 36 22 15 12 35 20 12 13 37 21 16 66 62 59 s = 0; for j=1:5 s = s + C(1,j) * PO(j) end For factory 1: j = 1
1 0 12 5 29 PO: C: 10 36 22 15 12 35 20 12 13 37 21 16 66 62 59 s = 0; for j=1:5 s = s + C(1,j) * PO(j) end For factory 1: j = 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1 0 12 5 29 PO: C: 10 36 22 15 12 35 20 12 13 37 21 16 66 62 59 s = 0; for j=1:5 s = s + C(1,j) * PO(j) end For factory 1: j = 3
1 0 12 5 29 PO: C: 10 36 22 15 12 35 20 12 13 37 21 16 66 62 59 s = 0; for j=1:5 s = s + C(1,j) * PO(j) end For factory 1: j = 4

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/23/2008 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell University (Engineering School).

### Page1 / 52

CS 100 M Lecture 17 - 17. More on 2D Arrays Operations...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online