1400PS4F23_Exercise
pdf
keyboard_arrow_up
School
Oakland University *
*We aren’t endorsed by this school
Course
1400
Subject
Industrial Engineering
Date
Dec 6, 2023
Type
Pages
3
Uploaded by ProfessorMoon1664
C
OMPUTER
P
ROBLEM
-S
OLVING IN
EGR
1400
E
NGINEERING AND
C
OMPUTER
S
CIENCE
F
ALL
2023
P
ROBLEM
-S
OLVING
E
XERCISE
#4
S
IMULATION
As we’ve previously seen, equations describing situations often contain uncertain parameters, that
is, parameters that aren’t necessarily a single value but instead are associated with a probability
distribution function.
When more than one of the variables is unknown, the outcome is difficult
to visualize.
A common way to overcome this difficulty is to simulate the scenario many times
and count the number of times different ranges of outcomes occur.
One such popular simulation
is called a Monte Carlo Simulation.
In this problem-solving exercise you will develop a program
that will perform a Monte Carlo simulation on a simple profit function.
Consider the following total profit function:
P
T
= nP
v
Where
P
T
is the total profit,
n
is the number of vehicles sold and
P
v
is the profit per vehicle.
P
ART
A
Compute 5 iterations of a Monte Carlo simulation given the following information:
n
follows a uniform distribution with minimum of 1 and maximum 10
P
v
follows a normal distribution with a mean of
$5250 and a standard deviation of $1100
Number of bins:
10
Recall that for all practical purposes we will use 3 std. deviations from the mean as the maximum
value for parameters following a normal distribution. Obviously, 5 iterations are not very many.
In fact, typically you would simulate 10,000 iterations or so to view meaningful results but we
figured that we
’d give you a break
☺
.
i.)
What are the ranges for the 10 bins?
ii.)
Fill in the table below:
Parameter
Iteration 1
Iteration 2
Iteration 3
Iteration 4
Iteration 5
n
8
5
9
2
8
P
v
$3300
$4725
$4500
$7250
$5725
P
T
Bin #
$ Range
iii.)
Fill in the frequency of occurrences of each bin:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
P
ART
B
Write the following three methods and include in the Part D code listing
:
public int GetRandomUniform(int min, int max)
This method returns a random number from a uniform distribution between
min
and
max
.
public double GetRandomNormal(double mean, double stddev)
This method returns a random number from a normal distribution with a mean of
mean
and standard
deviation of
stddev
public int GetBinIndex(double mini, double maxi, int numbins, double valuetobin)
This method returns the Bin Index given an input minimum of
mini
, input maximum of
maxi
,
numbins
number of bins, and a value to bin of
valuetobin
P
ART
C
Include the methods created in part B to develop a Visual C# .NET program that will simulate the
basic profit calculation, P
T
= nP
v
, where
n
follows a uniform distribution,
P
v
follows a normal
distribution, and the user can input the number of bins and number of iterations.
The user must
also input the
min
and
max
for
n
and the
mean
and
standard deviation
for
P
v
.
Finally, the user can
click a button and the results will be graphed on a bar chart using the Microsoft Chart Control and
the average total profit (P
T
) will be displayed in a textbox.
Turn in a screen shot of the resulting
chart using:
1. Iterations:
10000 Bins:
5
n-min
:
1
n-max
:
10
P
v
-mean
:
7725
P
v
-stddev
:
2100
2. Iterations:
10000 Bins:
10
n-min
:
1
n-max
:
10
P
v
-mean
:
7725
P
v
-stddev
:
2100
3. Iterations:
10000 Bins:
10
n-min
:
1
n-max
:
10
P
v
-mean
:
8000
P
v
-stddev
:
2250
That’s
three screen shots.
P
ART
D
Extend the Visual C# .NET program developed in part C to simulate the basic profit calculation,
P
T
= nP
v
, where the user can select either a uniform or normal distribution for
n
using radio buttons
and then must input the appropriate parameters (
min
and
max
if they select uniform,
mean
and
standard
deviation
if they select normal) and they can similarly select either a uniform or normal
distribution for
P
v
with appropriate parameters depending on the selection.
Of course, the user
will input the number of bins and number of iterations.
Finally, the user can click a button and the
results will be graphed on a bar chart using the Microsoft Chart Control and the average total profit
(P
T
) will be displayed in a textbox.
Also include in the program any necessary input validation for
all input values.
Turn in a listing of the code and a screen shot of the resulting chart using:
1. Iterations:
10000 Bins:
5
n-min
:
6
n-max
:
11
P
v
-mean
:
6125
P
v
-stddev
: 1150
2. Iterations:
10000 Bins:
10
n-mean
: 9
n-stddev
:
2
P
v
-min
:
1000
P
v
-max
: 6000
3. Iterations:
10000 Bins:
10
n- mean
:
12
n- stddev
: 2
P
v
-min
:
2300
P
v
-max
:
5850
That’s three screen shots and a
listing of the code for Parts B and D.
P
ART
E
You’re going
to go to a job interview for OU Car Co.
Knowing that the field is highly competitive,
you have run sales scenarios ahead of time experimenting with different numbers of customers
and vehicle profits given that in one month OU Car Co. sells between 3 and 10 cars uniformly
distributed with profits of $7,250 on the average with standard deviation of $1050.
Which has a
higher payoff, focusing on selling to a couple more customers or by increasing the average sale
(with the same std. dev. of $1050) by retraining your sales force or do they have basically the same
effect on total sales?
Support your answer.
P
ROBLEM
S
OLVING
D
ELIVERABLES
You should work in teams of either two or three.
You may not work alone.
Turn in your results
for Parts A, B, C, D, and E and your
team’s signed cover page at the beginning of your team’s
lecture on Monday, November 13, 2023 for Professor Siadat
’s
lecture or Tuesday, November 14,
2022 for Professor Hanna
’s lecture.
One set of results should be submitted per team.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help