Jump to content
Male HQ

Data analysts/data scientists?


Impresto

Recommended Posts

It's great that BW finally opens up interest groups that are tech-related! I applaud whoever initiated this.

 

I'm very interested in data analytics and visualization (python, R, you know - the common stuff) and am currently taking a master's degree in analytics. Just wondering if there are any guys out there who share the same interest? We can maybe get together and geek-out or something, haha.

 

Cheers and have a great day, everyone!

 

Link to comment
Share on other sites

  • 3 weeks later...

Basically I have a monte carlo simulation to perform.

 

# Develop a model to simulate 260 working days (1 year),
# and count the number of additional shifts that are required.
# Assume that the initial additional inventory is 100 units. 

# Demand over the years have been observed to be between 80 ~130 units per day.
# Currently one day has one shift, management is considering to add one more shift the next day if ending inventory falls to 50 and below
# Find the distribution of the number of shifts
# that the company would expect over the next year. 
# Explain and summarize your findings in a report
# to the plant manager and make a recommendation as to 
# how many shifts to plan in next year?fs budget.

 

I have two codes, could anyone point out which is the correct approach?

 

Code 1

 

set.seed(12345)
#consider that PLE has 5 years of production data in years
production.demand<- rdunif(1300, 130, 80)
hist(production.demand)

# Pick 260 sample data from simulated data
prod.demand <- sample(production.demand, 260)

# plot a histogram
hist(production.demand)

#We wish to predict the number of additional shifts to be planned for if inventory falls below 50 

initial.inventory <- 100
daily.production <- 100
i<-1

ending.inventory1 <- initial.inventory + daily.production - prod.demand

j<-2

ending.inventory2 <- ending.inventory1 + daily.production - prod.demand [j]  

for (j in 1:259){
  ending.inventory2 [j] <- ending.inventory1 +daily.production - prod.demand [j]
 }

Distribution.of.inventory <- ending.inventory2

append(ending.inventory1,ending.inventory2)

hist(Distribution.of.inventory)
abline(v=50,col="red")

# Probability distribution
h <-hist(Distribution.of.inventory, breaks=10)
h$counts=h$counts/sum(h$counts)
#Cumulative distribution and function
hcum <- h
hcum$counts <- cumsum(hcum$counts)
cf <- ecdf(Distribution.of.inventory)
# plot probability dist and cumulative histograms
plot(hcum, labels = paste(hcum$counts))
plot(h, add=T, col="grey")
plot(cf, add=T, col="blue")
# Draw cutoff line
abline(v=50,col="red")
cf(50)

Extra.No.of.shifts.to.be.planned <- cf(50)*260
Extra.No.of.shifts.to.be.planned

 

Code 2

 

set.seed(12345)
stocklessthan50 <- list()
j <- 0
inv_beg <- 100
production <- 100

while(j < 100)
{
  set.seed(12345)
  #demand <- c(rtriang(260, min = 80,mode = 105, max = 130))
  #demand <- c(rnorm(260, mean =105, sd = 15))
  demand <- c(runif(260, min = 80, max = 130))
  counter <- 0
  
  for(demand_today in demand){
    inv_end <- inv_beg + production - demand_today
    if(inv_end < 50){
      counter <- counter +1;
      inv_beg <- inv_end + production #Increase production if less than 
    }
    else
    {
      inv_beg <- inv_end
    }
  }
  stocklessthan50 <- append(stocklessthan50, counter)
 
  j <- j + 1
}
hist(as.numeric(stocklessthan50), main = "Results of 10 Simulations(uniform)", xlab = "Num of Shifts required" )


 

Link to comment
Share on other sites

  • 3 years later...
  • 10 months later...
×
×
  • Create New...