AMC153 Final Project presented by - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

AMC153 Final Project presented by

Description:

Evergreen Marine Corporation is one of the. biggest shipping firm in the world. ... This can be solved by using Markov Matrix to represent the table above. ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 11
Provided by: jin131
Learn more at: http://cng.ateneo.edu
Category:

less

Transcript and Presenter's Notes

Title: AMC153 Final Project presented by


1
AMC153 Final Projectpresented by
  • Xie, Jing Jing
  • IV BS AMC

2
Shipping Problem
  • Statement
  • Evergreen Marine Corporation is one of the
  • biggest shipping firm in the world.
  • Assume that their vessels can sail to different
    ports of call from the original port.
  • Let the number of ports be N
  • A vessel starts from Xi where i 1, 2, 3N
  • can go to other ports after each passage Xj
    where j 1, 2, 3N

3
(No Transcript)
4
  • Assuming there are only three ports (N3)
  • Hongkong (x1), Shanghai (x2), and Xiamen (x3).
  • the probability of a vessel sails from xi to xj
    is represented in the matrix below
  • started from x1 x2 x3
  • x1
  • Arrived at x2
  • x3

0.4 0.6 0.2
0.5 0.2 0.1
0.1 0.2 0.7
5
Where does a vessel go after K sailings?
  • This can be solved by using Markov Matrix to
    represent the table above.
  • Notice the sum of the elements of each column is
    always 1.0
  • Markov / transition matrix

6
Strategy
  • A master and slave approach will be implemented
    where each element of the product matrix will be
    given to a node.
  • After which, the product matrix will be set up by
    the master. once the matrix is completed, it
    will again be multiplied recursively until the
    number of sailings, K has been reached.

7
Serial Version
  • for(p1 pltPOW p) // POW loop
  • printf("Power is d, NOW d\n", POW, p)
  • lseek(fd1, 0, SEEK_SET)
  • lseek(fd2, 0, SEEK_SET)
  • lseek(fd3, 0, SEEK_SET)
  • for(i0 iltNUMNUM i) //initialize
    temp.bin
  • read(fd3, cpy, sizeof(float))
  • printf("temp.bin copying... f\n", cpy)
  • write(fd2, cpy, sizeof(float))
  • lseek(fd2, 0, SEEK_SET)
  • lseek(fd3, 0, SEEK_SET)

8
  • for(row0 rowltNUM row) // read a row from
    temp.bin
  • lseek(fd2, rowsizeof(float)NUM, SEEK_SET)
  • if(read(fd2, z2, sizeof(float)NUM)/sizeof(float)
    ltNUM)
  • printf("fd2 read too much!\n")
  • else for(i0 iltNUM i)
  • printf("ROW d, f \n",row, z2i)
  • for(col0 colltNUM col) // read column from
    a.bin
  • element 0
  • for (j0 jltNUM j)
  • lseek(fd1, jsizeof(float)NUMcolsizeof(float
    ), SEEK_SET)
  • read(fd1, temp, sizeof(float))
  • z1jtemp
  • printf("col d f\n",col, z1j)
  • for(k0 kltNUM k) // elem of matrix being
    processed
  • element element z1kz2k
  • printf("dd f \n", row, col, element)

9
Parallel Version
  • How to use this program?

10
  • THE END
Write a Comment
User Comments (0)
About PowerShow.com