首页 > > 详细

C++辅导流量模拟器、辅导 Blood Flow Pattern辅导留学生C/C++设计

 

Requirement

You are to write a program that determines the minimum blood flow pattern for a brain. You program will be given a list of brain cells and how blood vessels connect them, starting from the carotid artery, and ending with the jugular vein. Your program will determine how much blood should flow between connected brain cells during a series of pulses until all the brain cells have received at least one full blood cell.

You are to handin all files upon which your program is dependent, except bloodRunner.cpp, bloodRunner.h, and CPUTimer.h. The grading script will copy those three files into your directory. You must handin a Makefile! You will find those three files, brain files, and my blood.out.

Here are the specifications:

  1. CreateFile.cpp is available and worth perusing.
    • The name of a data file reflects parameters used to create it. For example, brain-25-100-5.txt has 25 brain cells, 100 blood vessels, and was created using a seed of 5 for the random number generator.
    • The first line of the file contains the number of brain cells followed by the number of blood vessels, and the length of the shortest path between the first and last cells.
    • Each succeeding lines contains information about one blood vessel: [ID] [upstream brain cell ID] [downstream brain cell ID] [carrying capacity]
  2. Brain Cells
    • Each brain cell has a unique ID. They are assigned their IDs randomly, though the IDs are contiguous. However, the first cell encountered by the carotid artery is ID 0, and the last cell before the jugular vein will have the largest ID.
    • Your program should indicate when every brain cell has received a full blood cell.
    • Each brain cell now empties exactly one full blood cell during the life of the program. Thus, if cell B is downstream from cell A, and cell A has never received a full blood cell before, then cell A must receive at least two full blood cells during a pulse so that at least one full blood cell will make it to cell B. Note that blood cells are not eaten by the brain cells, and must continue along the blood vessels once emptied.
  3. Blood Vessel
    • Each blood vessel has a unique ID. They are assigned their IDs randomly, though the IDs are contiguous, and start at zero.
    • Each blood vessel connects two brain cells. The blood flows from the first cell specified to the second cell.
    • Up to five blood vessels can connect to a single brain cell, except the last may have any number of vessels leading into it.
    • Each blood vessel has a blood cell carrying capacity.
    • While in a real brain it takes time to transport blood cells, we will assume that they are transported instantly through the whole brain. (You really don’t want to simulate time do you?).
      • Oddly, the system may be thought of as empty at the end of each pulse.
    • There are no cycles in the blood vessels for this could cause recycling of empty blood cells.
    • The total number of blood cells arriving at a brain cell must equal the total number leaving. When a brain cell empties a blood cell, the number of full cells leaving the brain cell would be one less than entering, and the number of empty cells would be one more than entering. The first and last cells do not obey this conservation of blood rule. The first cell can provide an infinite number of full blood cells, and the last cell can absorb an infinite number of blood cells.
    • Each pulse, your class is provided two arrays of ints with one position for each blood vessel. One array is for the flow of full blood cells, and the other is for the flow of empty blood cells in the blood vessels. For each pulse, the class fills each position with the number of blood cells of each type that the corresponding vessel must carry.
  4. Grading
    • Performance will be tested with three data files, each with 5000 brain cells, and 10000 vessels . Each of these values is the maximum possible for the program.
    • Correctly feed all cells. This is indicated by having no messages from checkFlows(). If a program does not correctly process the instructions, then it will receive zero for the entire assignment.
    • CPU time: min (23, 20 * Sean’s CPU Time / Your CPU Time);
      • The program terminates when all brain cells have been fed at least one full blood cell, or the number of pulses reaches 10000.
      • CPU time may not exceed 60.
      • Programs must be compiled without any optimization options. You may not use any precompiled code, including the STL and assembly.
      • You may not have any static, or global variables since they would be created before the CPU timer begins.
    • Simulated pulses to feed all brain cells
      • min(23, 20 * (Sean’s simulated pulses) / (Your simulated pulses)
  5. Suggestions
    • Keep things simple, and get things running first, and only then use gprof to learn where things are going slowly.
    • Use Weiss code as a starting point where possible.
    • Remember to turn in dsexceptions.h if your program needs it!
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!