suppressMessages(suppressWarnings(library(ggplot2)))
suppressMessages(suppressWarnings(library(ggthemes)))
suppressMessages(suppressWarnings(library(tidyr)))
suppressMessages(suppressWarnings(library(dplyr)))
suppressMessages(suppressWarnings(library(knitr)))

Homework 7.1 (select 1 question from below list, due next week):

Page B-13: #4 Page B-17: #1 Page B-21: #4 Page B-25: #1 Page B-29: #1

Homework 7.2 Chapter A: Homework

Chapter 15. Graphs of Function as Models

15.1 An Arm Race

Page B-13: #4

4.Discuss how you might go about validating the nuclear arms race model. What data would you collect? Is it possible to obtain the data?

Answer:

Since we will not be able to get the real data for the nuclear arms race as the war did not really happen. To validate the nuclear arms race model, we can simulate the historical great power races which had led to wars, such as the arms race from 1870 to 1913 perior to World War I and the arms race in Europe from 1925 to 1939 prior to World War II.

The data need to collected to validating the model include:

  1. The amount of great power arms which is corrpespinding to the long-range intercontinental ballistic missiles in the model such as mortars, artillery or aircraft in World War I and V2 rocket, anti-air craft guns or mines in World War II. These data may be difficult to find because they could be confidential. Even some data could be find, they could be not completed and need to be processed before fitting into the model.

  2. the destruction effeciency of above mentioned weapons.These data could be found in the military literature.

15.2 Modeling an Arm Race in Stages

Page B-17: #1

  1. Build a numerical solution to Equations (15.8).

$$

\[\begin{equation} y_{n+1} &= 120+\frac{1}{2}x_n \\ x_{n+1} &= 60+\frac{1}{3}y_n \end{equation}\]

$$

with

\[ \begin{equation} x_0 = 100 \\ y_0 = 200 \end{equation} \]

  1. Graph your results.

Solution

f1 <- function(x) 120 + 0.5 * x  
f2 <- function(y) 60 + 1/3 * y

calc_arms <- function(x0,y0, n, fun1, fun2){
    x <- x0
    y <- y0
    id <- 0
    for (i in 1:n){
        y <- append(y, fun1(x[i]))
        x <- append(x, fun2(y[i]))
        id <- append(id,i) 
    }
    data.frame(id=id,country.x=x,country.y=y) 
   
}

df <- calc_arms(100,200,10,f1,f2)

ggplot(df, aes(x=id)) + 
  geom_line(aes(y=country.x,colour = "country.x")) + 
  geom_line(aes(y=country.y,colour = "country.y")) + 
  theme_few() + 
  labs(title="Dynamics of an arms race", x = "stage", y= "Number of weapons)") +
  theme(plot.title = element_text(hjust = 0.2))

  1. Is an equilibrium value reached?

Answer

From the graph, we can see both x and y reached equilibrium value.

  1. Try other starting values. Do you think the equilibrium value is stable?

Solution

df <- calc_arms(500,400,10,f1,f2)

ggplot(df, aes(x=id)) + 
  geom_line(aes(y=country.x,colour = "country.x")) + 
  geom_line(aes(y=country.y,colour = "country.y")) + 
  theme_few() + 
  labs(title="Dynamics of an arms race", x = "stage", y= "Number of weapons)") +
  theme(plot.title = element_text(hjust = 0.2))

tail(df)
##    id country.x country.y
## 6   5  122.0370  185.2778
## 7   6  121.7593  181.0185
## 8   7  120.3395  180.8796
## 9   8  120.2932  180.1698
## 10  9  120.0566  180.1466
## 11 10  120.0489  180.0283

From the graph and the numerated results, the equilibrium value for country x and country y are stable, 120 and 180 respectively.

  1. Explore other values for the survival coefficients of Countries X and Y. Describe your results.

Solution

If we change the coefficient to 0.6 and 0.7 for country x and country y respectively:

f1 <- function(x) 120 + 0.6 * x  
f2 <- function(y) 60 + 0.7 * y

df <- calc_arms(100,200,10,f1,f2)

ggplot(df, aes(x=id)) + 
  geom_line(aes(y=country.x,colour = "country.x")) + 
  geom_line(aes(y=country.y,colour = "country.y")) + 
  theme_few() + 
  labs(title="Dynamics of an arms race", x = "stage", y= "Number of weapons)") +
  theme(plot.title = element_text(hjust = 0.2))

The size of the arms of country will increase when country x increase its arms storage but the arms storage of both countries will reach a equilibrium value.

Chapter A. Integer Programming

A company is assembling a team to carry out a series of operations. There are four members of the team: A, B, C and D, and four operations to be carried out. Each team member can carry out exactly one operation. All four operations must be carried out successfully for the overall project to succeed, however the probability of a particular team member succeeding in a particular operation varies, as shown in the table below. For example, if the team members were assigned to operations in the order ABCD, then the overall probability of successful completion of the project is (0.9)(0.6)(0.85)(0.7) = 0.3213. If there is any possible way that the team can be arranged such that the overall probability of success exceeds 45%, then the manager will approve the project. Will the manager approve the project? If yes, what is the arrangement of the team that gives the highest probability of success?

##      1   2    3    4
## A 0.90 0.8 0.90 0.85
## B 0.70 0.6 0.80 0.70
## C 0.85 0.7 0.85 0.80
## D 0.75 0.7 0.75 0.70
library(data.tree)

assignment <- Node$new("Start 0.9*0.8*0.8*0.7=0.4032")
  A_1 <- assignment$AddChild("A_1:0.4032")
  A_2 <- assignment$AddChild("A_2:0.3808")
  A_3 <- assignment$AddChild("A_3:0.3528")
  A_4 <- assignment$AddChild("A_4:0.4046")
    B_1 <- A_4$AddChild("B_1:0.354025")
    B_2 <- A_4$AddChild("B_2:0.325125")
    B_3 <- A_4$AddChild("B_3:0.4046")
      c_1 <- B_3$AddChild("C_1/D_2:0.4046")
      c_2 <- B_3$AddChild("C_2/D_1:0.357")

print(assignment)
##                       levelName
## 1  Start 0.9*0.8*0.8*0.7=0.4032
## 2   ¦--A_1:0.4032              
## 3   ¦--A_2:0.3808              
## 4   ¦--A_3:0.3528              
## 5   °--A_4:0.4046              
## 6       ¦--B_1:0.354025        
## 7       ¦--B_2:0.325125        
## 8       °--B_3:0.4046          
## 9           ¦--C_1/D_2:0.4046  
## 10          °--C_2/D_1:0.357
plot(assignment)

Based on the results of branch-and-bound, the maximum probability of successful completion of the project is 40.46%. So, there is no way to get a overall probability of success exceeding 45% to persude the manager to approve the project.

Reference:

  1. Michael D. Wallace, Arms races and the balance of power: a mathematical model.