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

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

View Full Document Right Arrow Icon
17. More on 2D Arrays Operations Subscripting *Will see two new things. Boolean-valued functions Functions that have a function as a parameter.
Background image of page 1

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

View Full DocumentRight Arrow Icon
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.
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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?
Background image of page 4
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.
Background image of page 5

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

View Full DocumentRight Arrow Icon
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.
Background image of page 6
Purchase Order The value of PO(j) is the number product j’s that the customer wants 1 0 12 5 29 PO:
Background image of page 7

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

View Full DocumentRight Arrow Icon
How Much Does it Cost for Each Factory to Process a Purchase order?
Background image of page 8
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:
Background image of page 9

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

View Full DocumentRight Arrow Icon
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
Background image of page 10
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
Background image of page 11

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

View Full DocumentRight Arrow Icon
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
Background image of page 12
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
Background image of page 13

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

View Full DocumentRight Arrow Icon
Image of page 14
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 Right Arrow Icon
Ask a homework question - tutors are online