Question
Develop and test a program that implements the bad microchip problem and a simulation based upon probability distributions. For the first part, the idea is
Develop and test a program that implements the bad microchip problem and a simulation based upon probability distributions.
For the first part, the idea is that some batches of chips might not be tested. and the goal is to detect bad batches without testing all the chips in the batch. We will be simulating the process of sampling chips from a collection of batches of chips.
Part 1a: Generate data sets.
Automate creation of what would otherwise be user-specified number of datasets with a user-specified number of batches, batch size, percentage of the datasets containing bad chips, and percentage of bad chips in a dataset.
When the program runs, it will automatically read four (4) configuration files titled c1.txt, c2.txt, c3.txt, and c4.txt, containing specs for each run, simulating how the program would work if it were getting these parameters interactively from the user. These configuration files should have the following values written as integers, one per row:
Specification | c1.txt | c2.txt | c3.txt | c4.txt |
Number of batches of items | 100 | 100 | 500 | 500 |
Number of items in each batch | 2000 | 2000 | 1000 | 1000 |
Percentage of batches containing bad items | 24 | 10 | 10 | 1 |
Percentage of items that are bad in a bad batch | 7 | 10 | 10 | 1 |
Items sampled from each batch | 30 | 50 | 50 | 50 |
Generate a dataset from the input specification. The dataset will contain an individual file for each batch of items. Save each file in the dataset as ds1.txt, ds2.txt, ... , dsn.txt. To create an individual file, decide if it has bad items or not. Run a loop for the number of items in the batch. If it is a good batch, just write 'g' to the file (one per line) for the total number of items in the batch. If it is a bad batch, use a random number generator for the input-specified percentage of bad chips: Example - assume the spec is that 10% of chips are bad. Generate datasets by generating random numbers on [0..99] if 0 .. 9 comes up, add a bad chip (write the char 'b' to the file), otherwise, add a good chip to the data set (write a 'g' to the file).
Part 1b: Create the Monte Carlo process to determine which of the chip batches are bad. It should know how many data sets there are, read them one at a time, sample the appropriate number of items, and report good batch or bad batch. Your output should look like the output below. Create a summary report detailing the
Example output: Running: Number of batches of items: 100 Number of items in each batch 2000 Percentage of batches containing bad items 24% Percentage of items that are bad in a bad set 7% Items sampled from each set 30 Generating data sets: Create bad set batch # 4, totBad = 133 total = 2000 badpct = 7 Create bad set batch # 8, totBad = 145 total = 2000 badpct = 7 Create bad set batch # 12, totBad = 122 total = 2000 badpct = 7 Create bad set batch # 16, totBad = 142 total = 2000 badpct = 7 Create bad set batch # 20, totBad = 160 total = 2000 badpct = 7 Create bad set batch # 24, totBad = 148 total = 2000 badpct = 7 Create bad set batch # 28, totBad = 166 total = 2000 badpct = 7 Create bad set batch # 32, totBad = 137 total = 2000 badpct = 7 Create bad set batch # 36, totBad = 145 total = 2000 badpct = 7 Create bad set batch # 40, totBad = 123 total = 2000 badpct = 7 Create bad set batch # 44, totBad = 123 total = 2000 badpct = 7 Create bad set batch # 48, totBad = 165 total = 2000 badpct = 7 Create bad set batch # 52, totBad = 142 total = 2000 badpct = 7 Create bad set batch # 56, totBad = 117 total = 2000 badpct = 7 Create bad set batch # 60, totBad = 144 total = 2000 badpct = 7 Create bad set batch # 64, totBad = 124 total = 2000 badpct = 7 Create bad set batch # 68, totBad = 152 total = 2000 badpct = 7 Create bad set batch # 72, totBad = 120 total = 2000 badpct = 7 Create bad set batch # 76, totBad = 141 total = 2000 badpct = 7 Create bad set batch # 80, totBad = 158 total = 2000 badpct = 7 Create bad set batch # 84, totBad = 119 total = 2000 badpct = 7 Create bad set batch # 88, totBad = 144 total = 2000 badpct = 7 Create bad set batch # 92, totBad = 145 total = 2000 badpct = 7 Create bad set batch # 96, totBad = 158 total = 2000 badpct = 7 Total bad sets = 24 Analyzing Data Sets: batch #0 is bad batch #4 is bad batch #12 is bad batch #16 is bad batch #20 is bad batch #24 is bad batch #28 is bad batch #32 is bad batch #36 is bad batch #40 is bad batch #44 is bad batch #48 is bad batch #52 is bad batch #60 is bad batch #64 is bad batch #68 is bad batch #72 is bad batch #76 is bad batch #80 is bad batch #84 is bad batch #88 is bad batch #92 is bad Base = 0.930000 exponent = 30 P(failure to detect bad item) = 0.113367 P(batch is good) = 0.886633 Percentage of bad batches detected = 88%
Program must in C language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started