Skip to content

Commit 7e2a289

Browse files
Updated the codes
1 parent bba489e commit 7e2a289

6 files changed

+1072
-92
lines changed

Integer programming model.Rmd

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
---
22
output:
33
html_document:
4+
toc: true
5+
toc_depth: '4'
46
df_print: paged
57
---
68

7-
#### **To:** Seattle Museum of Modern Art: Board of directors
9+
##### **To:** Seattle Museum of Modern Art: Board of directors
810

9-
#### **From:** Afsar Ali
11+
##### **From:** Afsar Ali
1012

11-
#### **Date:** `r format(Sys.time(), '%B %d, %Y')`
13+
##### **Date:** `r format(Sys.time(), '%B %d, %Y')`
1214

13-
#### **RE:** Analysis of 3 Proposal: Artie's Dream
15+
##### **RE:** Analysis of 3 Proposal: Artie's Dream
1416

1517
***
16-
```{r message=FALSE, warning=FALSE, include=FALSE}
18+
```{r echo=TRUE, message=FALSE, warning=FALSE}
1719
1820
# Title: Artie's Dream
1921
# Purpose: Final Project
@@ -35,7 +37,7 @@ library(kableExtra)
3537
library(formattable)
3638
```
3739

38-
```{r message=FALSE, warning=FALSE, include=FALSE}
40+
```{r echo=TRUE, message=FALSE, warning=FALSE}
3941
4042
# Import Data
4143
data <- read.csv("5260_S18_Arties_Dream.csv", header = TRUE)
@@ -46,7 +48,7 @@ data <- read.csv("5260_S18_Arties_Dream.csv", header = TRUE)
4648
Artie Fophartie has recently caught our attention with his willingness to fund an entire exhibit and generously donating $1 million to the museum from his lottery ticket winnings. Since the exhibit pieces would remain on display for two months, a thorough analysis is needed to calculate the cost and determine which art pieces should be displayed. This analysis is based on the 34 art pieces that Artie selected from the modern art community. Celeste McKenzie and Artie made specific requirements for the exhibit and based on these requirements there are three proposals for you to review. The first proposal reflects the budget of $4 million set by Artie. The second proposal reflects Celeste's decision to include at least 20 art pieces to ensure that the exhibit draws the attention of the public. The third proposal reflects cost uncertainty.
4749

4850

49-
```{r message=FALSE, warning=FALSE, include=FALSE}
51+
```{r echo=TRUE, message=FALSE, warning=FALSE}
5052
# This model has choice variables that are binary
5153
p1 <- make.lp(0, 35)
5254
lp.control(p1, sense = "max")
@@ -130,7 +132,7 @@ With $4 million to fund the exhibit and the specific requirements from Artie and
130132

131133
*Table 1: List of 15 art pieces displayed without exceeding the budget*
132134

133-
```{r echo=FALSE, message=FALSE, warning=FALSE}
135+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
134136
#Stracture Table
135137
data$Solution <- get.variables(p1)[1:34]
136138
data1 <- subset(data, Solution == 1)
@@ -149,7 +151,7 @@ kable("html", row.names = TRUE) %>%
149151
```
150152

151153

152-
```{r include=FALSE}
154+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
153155
154156
# This model has choice variables that are binary
155157
p1 <- make.lp(0, 35)
@@ -233,7 +235,7 @@ In proposal 2, we are considering at least 20 pieces to ensure that the exhibit
233235

234236
*Table 2: Minimum cost is $5.45 Million for displaying at least 20 art pieces*
235237

236-
```{r echo=FALSE, message=FALSE, warning=FALSE}
238+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
237239
#Stracture Table
238240
data$Solution2 <- get.variables(p1)[1:34]
239241
data2 <- subset(data, Solution2 == 1)
@@ -252,7 +254,7 @@ data2 %>%
252254
```
253255

254256

255-
```{r include=FALSE}
257+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
256258
# Number of simulations
257259
set.seed(1234)
258260
n <- 1000
@@ -348,7 +350,7 @@ We know from our previous experiences, cost associated with each art piece varie
348350

349351

350352
*Table 3: Impact on Proposal 2 with cost uncertainty ranges from $4.9 Million to $5.9 Million*
351-
```{r echo=FALSE}
353+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
352354
# Make table of output
353355
out_rp3 <- round(rbind(apply(rp3, 2, mean), apply(rp3, 2, sd),
354356
apply(rp3, 2, max), apply(rp3, 2, min)), 2)
Lines changed: 453 additions & 9 deletions
Large diffs are not rendered by default.

Inventory optimization model.Rmd

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
---
2-
output: html_document
2+
output:
3+
html_document:
4+
toc: true
5+
toc_depth: '4'
6+
df_print: paged
37
---
48

5-
#### **To:** Seymore Butts
9+
##### **To:** Seymore Butts
610

7-
#### **From:** Afsar Ali
11+
##### **From:** Afsar Ali
812

9-
#### **Date:** `r format(Sys.time(), '%B %d, %Y')`
13+
##### **Date:** `r format(Sys.time(), '%B %d, %Y')`
1014

11-
#### **RE:** Analysis of the Proposals to reduce average level of in-process inventory
15+
##### **RE:** Analysis of the Proposals to reduce average level of in-process inventory
1216

1317
***
14-
```{r message=FALSE, warning=FALSE, include=FALSE}
18+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
1519
1620
# Title: Artie's Dream
1721
# Purpose: Final Project
@@ -39,7 +43,7 @@ library(formattable)
3943
How can we reduce the average number of poster sheets waiting to complete inspection? I was tasked with analyzing and producing solutions to reduce the backlog by taking into account the cost associated with each task and cost of in-process inventory. According to my findings, we should only use 8 printing press, increase the print time by 15 mins and hire an additional inspector. This will reduce our **Total cost by $50.63 per hour** from current the total cost of $203.14 per hour to $152.51 per hour and optimizes our overall operation. With the task of analyzing the two initial proposals we discussed, I was able to create a third solution that maximizes the poster sheet flow while minimizing our cost.
4044

4145

42-
```{r message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
46+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
4347
#Current Status:
4448
4549
# Evaluating the status quo print reproductions of the paintings and photographs
@@ -102,7 +106,7 @@ Table 1 breaks down our status quo. Our current **total cost is $203.14 per hour
102106

103107
*Table 1: Currently the Total Cost is $203.14 per hour *
104108

105-
```{r echo=FALSE, message=FALSE, warning=FALSE}
109+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
106110
now <- as.data.frame(cbind(p4_p[3,],#using 10 presses and 1 inspector
107111
p4_i[1,])) #using 10 presses and 1 inspector
108112
#L is the all inventory (work in process) of the queue system while Lq (ork To Process)is the portion of L that is idle (queue waiting)
@@ -128,7 +132,7 @@ now %>%
128132
column_spec(4, bold = T)
129133
```
130134

131-
```{r message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
135+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
132136
##Proposal 4: Take slightly longer to make the prints (which would increase their average time to make a print to 1.2 hours), so that the inspector can keep up with his output better. This also would reduce the cost of the power for running each press from $7.00 to $6.50 per hour. (By contrast, decreasing the time would increase this cost to $7.50 per hour while decreasing the average time to make a print to 0.8 hour.):
133137
134138
# Evaluating the status quo print reproductions of the paintings and photographs
@@ -191,7 +195,7 @@ If we were to take slightly longer time to make the prints, so that the inspecto
191195

192196
*Table 2: Decreasing print time by 10 mins would increase Total Cost by $23.24 per hour *
193197

194-
```{r echo=FALSE, message=FALSE, warning=FALSE}
198+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
195199
p4a <- as.data.frame(cbind(p4_p[2,],#using 10 presses and 1 inspector
196200
p4_i[1,])) #using 10 presses and 1 inspector
197201
#L is the all inventory (work in process) of the queue system while Lq (ork To Process)is the portion of L that is idle (queue waiting)
@@ -221,7 +225,7 @@ now1 %>%
221225
add_header_above(c(" ", "Current" = 3, "Proposed: Decreasing print time" = 3))
222226
```
223227

224-
```{r message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
228+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
225229
##Proposal 4: Take slightly longer to make the prints (which would increase their average time to make a print to 1.2 hours), so that the inspector can keep up with his output better. This also would reduce the cost of the power for running each press from $7.00 to $6.50 per hour. (By contrast, decreasing the time would increase this cost to $7.50 per hour while decreasing the average time to make a print to 0.8 hour.):
226230
227231
# Evaluating the status quo print reproductions of the paintings and photographs
@@ -284,7 +288,7 @@ By contrast, if we were increasing the print time, it would increase the cost of
284288

285289
*Table 3: Increasing print time by 15 mins would decrease the Total Cost by $9.63 per hour *
286290

287-
```{r echo=FALSE, message=FALSE, warning=FALSE}
291+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
288292
p4b <- as.data.frame(cbind(p4_p[5,],#using 10 presses and 1 inspector
289293
p4_i[1,])) #using 10 presses and 1 inspector
290294
#L is the all inventory (work in process) of the queue system while Lq (ork To Process)is the portion of L that is idle (queue waiting)
@@ -314,7 +318,7 @@ now2 %>%
314318
add_header_above(c(" ", "Current" = 3, "Proposed: Increasing print time" = 3))
315319
```
316320

317-
```{r message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
321+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
318322
#Proposal 5: Substitute a more experienced inspector for this task. She is somewhat faster at 7 minutes per poster, so she should keep up better. However, this inspector is in a job classification that calls for a total compensation (including benefits) of $19 per hour, whereas the current inspector is in a lower job classification where the compensation is $17 per hour:
319323
320324
# Evaluating the status quo print reproductions of the paintings and photographs
@@ -377,7 +381,7 @@ If we were to substitute a more experienced inspector, the **total cost would de
377381

378382
*Table 4: Experienced inspector would decrease the Total Cost by $18.36 per hour *
379383

380-
```{r echo=FALSE, message=FALSE, warning=FALSE}
384+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
381385
p5a <- as.data.frame(cbind(p4_p[3,],#using 10 presses and 1 inspector
382386
p4_i[1,])) #using 10 presses and 1 inspector
383387
#L is the all inventory (work in process) of the queue system while Lq (ork To Process)is the portion of L that is idle (queue waiting)
@@ -409,7 +413,7 @@ now3 %>%
409413
add_header_above(c(" ", "Current" = 3, "Proposed: Increasing print time" = 3, "Proposed: Experienced inspector" = 3))
410414
```
411415

412-
```{r message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
416+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
413417
# My Proposal:
414418
415419
# Evaluating the status quo print reproductions of the paintings and photographs
@@ -472,7 +476,7 @@ The recommended proposal is a combination of both of the initial proposal. In Ta
472476

473477
*Table 5: 2 Inspector, 8 Presses at increased rate would decrease the Total Cost by $50.63 per hour*
474478

475-
```{r echo=FALSE, message=FALSE, warning=FALSE}
479+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
476480
477481
p6 <- as.data.frame(cbind(p4_p[3,],#using 8 presses and 2 inspector
478482
p4_i[2,])) #using 8 presses and 1 inspector
Lines changed: 531 additions & 8 deletions
Large diffs are not rendered by default.

Network optimization model EDA.Rmd

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Ali_BUAN Midterm Project"
2+
title: "Network optimization Project"
33
author: "Afsar Ali"
44
date: '`r format(Sys.time(), "%B %d, %Y")`'
55
output:
@@ -9,7 +9,7 @@ output:
99
---
1010

1111
# Objective
12-
```{r}
12+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
1313
# Course: BUAN 5260
1414
# Title: Week 4-Network optimization
1515
# Purpose: USE IFRC Information information to model scenarios
@@ -18,7 +18,7 @@ output:
1818
1919
```
2020

21-
```{r, echo=FALSE, message=FALSE, warning=FALSE}
21+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
2222
# Clear packages
2323
if(is.null(sessionInfo()$otherPkgs) == FALSE)lapply(
2424
paste("package:", names(sessionInfo()$otherPkgs), sep=""),
@@ -39,7 +39,7 @@ set.seed(123)
3939
```
4040
#Loading and cleaning the data
4141

42-
```{r, message=FALSE, warning=FALSE}
42+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
4343
#load Data
4444
ifrc <- read.csv("5260_S18_Aiding_Africa_Data.csv", skip = 1)
4545
#Naming and Creating each table
@@ -80,7 +80,7 @@ edges$ID <- paste(edges$From, edges$To, sep = ' > ')
8080

8181
#1 Netowrk Map
8282
- Make sense all the Air Routes are the Fastest
83-
```{r, message=FALSE, warning=FALSE}
83+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
8484
net <- graph_from_data_frame(d=edges, vertices=nodes, directed=T)
8585
8686
net$layout <- matrix(c(-800, -800,
@@ -123,7 +123,7 @@ plot(net, edge.arrow.size=.3, edge.label = round(E(net)$Time, 2),
123123
+Jacksonville, FL > Niamey, Niger = 22.87
124124

125125

126-
```{r}
126+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
127127
#Create Table for shortest time
128128
distMatrix <- shortest.paths(net, v=V(net), to=V(net))
129129
@@ -152,7 +152,7 @@ plot(shortMatrix, edge.arrow.size=.2, edge.label = round(E(net)$Time, 2))
152152
#3 - 2nd Plan considering cost and constraints
153153

154154

155-
```{r}
155+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
156156
#Part 3 - Min Cost
157157
# Set up model
158158
min_cost <- make.lp(0, 30)
@@ -251,7 +251,7 @@ tm1
251251

252252
##Graph the Min Cost Solution
253253

254-
```{r}
254+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
255255
256256
# Include solution in edges dataframe
257257
edges$flow <- get.variables(min_cost)
@@ -292,7 +292,7 @@ plot(g, edge.width = 15*E(g)$Mincost/max(E(g)$Mincost),
292292

293293
#4 - Last Plan Max Flow with many constraints
294294

295-
```{r}
295+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
296296
#Maximum Flow
297297
298298
# Set up model
@@ -406,7 +406,7 @@ tm3
406406

407407
##Graph Max Cost Solution
408408

409-
```{r}
409+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
410410
# Include solution in edges dataframe
411411
edges$Mflow <- get.variables(max_flow)[3:32]
412412
edges$TotalAid <- edges$Mflow * edges$Capacity
@@ -452,7 +452,7 @@ E(g1)$TotalAid
452452

453453
#4 - Last Plan Testing Max Flow by relaxing some constraints to congos
454454

455-
```{r}
455+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
456456
#Maximum Flow
457457
458458
# Set up model
@@ -567,7 +567,7 @@ tm3
567567

568568
##Graph Max Cost Solution
569569

570-
```{r}
570+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
571571
# Include solution in edges dataframe
572572
edges$Mflow <- get.variables(max_flow)[3:32]
573573
edges$TotalAid <- edges$Mflow * edges$Capacity
@@ -615,7 +615,7 @@ E(g1)$TotalAid
615615

616616
##Fuction to run Matrix
617617

618-
```{r}
618+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
619619
620620
621621
@@ -744,7 +744,7 @@ write.csv(CM, file = "MyData.csv")
744744

745745
#Using I graph to calculate min and max (didnt work)
746746

747-
```{r}
747+
```{r echo=TRUE, message=FALSE, warning=FALSE, paged.print=TRUE}
748748
#Addmore attributes to the Graph
749749
750750
E(net)$Group <- E(net)$Type
Lines changed: 40 additions & 33 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)