Notebook
Notebook
Question 2
Inverse of matrix B:
[[ 13. 12. -29.]
[ 4. 4. -9.]
[ -3. -3. 7.]]
Question 3
[ 7. 2. -2.]
Question 4
Setup:
(a) Total number of people
t + s = 288
Question 6
Question 7
Setup: Let be the number of MX300 video games and let be the number of XL2000
x1 x2
video games
Subject to:
3x1 + x2 ≤ 255
x1 ≥ 0, x2 ≥ 0
If you have not installed pulp, uncomment the cell below and run the cell before running the
code for the next two problems. Contact your TA if you run into difficulties.
30.0
105.0
1905.0
Question 8
Setup:
Minimize: w = 680y1 + 700y2 + 720y3
Subject to:
20y1 + 30y2 + 10y3 ≥ 1030
y1 ≥ 0, y2 ≥ 0, y3 ≥ 0
Question 9
Question 10
Question 11
In 1971 the percent of persons over 65 in poverty was 20.1703 and the rate of cha
nge was -0.9767
In 1992 the percent of persons over 65 in poverty was 11.3564 and the rate of cha
nge was -0.2170
In 2009 the percent of persons over 65 in poverty was 8.4946 and the rate of chan
ge was -0.1332
Question 12
Question 13
The total number of barrels that the ship will leak on the first day = 373
The total number of barrels that the ship will leak on the second day = 172
Question 14
Question 16
y = 0
x = 10
Minimal costs will be $ 210
Question 17
He [is not] able to achieve his goal because by Euler's Theorem, since this graph [does]
have a vertex with odd degree, it [does not] have a Euler circuit.
file:///Users/vijay/Downloads/MSDS 400 Practice Final Solutions.html 9/13
20/06/2025, 13:44 Notebook
Question 17 (continued)
The written approach to this problem is much different than the solution in Python. The first
thing to do it to sketch the graph of this scenario. We can think of the vertices as the street
corners and each side of the road as an edge. So there are vertices and edges. Next,
9 14
Now consider the degrees of each vertex. In order from through , the degrees are
A I
. Since there is at least one vertex with odd degree, there is not an
2, 3, 3, 3, 4, 4, 3, 4, 2
Euler circuit.
False
Question 18
Q: Is a Hamilton circuit possible for this graph? If so, give your answer as a list of vertices,
starting and ending at the same vertex. Example: ABCA If it is not possible, enter DNE.
Q: Is a Hamilton path possible for the given graph? If so, give your answer as a list of
vertices, for example, ABCD. If it is not possible, enter DNE.
We have Python code to find the Hamiltonian Circuit first. Then we can find the Hamiltonian
Path:
Hamilton Circuit:
array([[0, 1, 0, 0, 1],
[1, 0, 1, 1, 0],
[0, 1, 0, 1, 0],
[0, 1, 1, 0, 1],
[1, 0, 0, 1, 0]])
Solution Exists: Following is one Hamiltonian Cycle
A B C D E A
True
Hamilton Path:
Question 19
Q: Apply the repeated nearest neighbor algorithm to the graph above. Starting at which
vertex or vertices produces the circuit of lowest cost?
array([[ 0, 0, 0, 3, 13, 2],
[ 0, 0, 0, 11, 8, 1],
[ 0, 0, 0, 6, 15, 7],
[ 3, 11, 6, 0, 0, 0],
[13, 8, 15, 0, 0, 0],
[ 2, 1, 7, 0, 0, 0]])
Q: What is the circuit produced by the nearest neighbor algorithm? Give your answer as a
list of vertices, starting and ending at vertex A.
Example: ABCDEFA
['A', 'F', 'B', 'E', 'C', 'D', 'A']
Question 20
The selected graph edges for the minimum tree is ['a-f', 'c-f', 'b-f', 'c-d', 'c-
e']
Question 20 (continued)
Apply Kruskal's algorithm and order the edges by weight in ascending order:
AF → 2
CF → 4
BF → 6
CD → 7
AD → 10
CE → 12
AE → 13
BE → 14
BD → 15
Add edges in order except if adding an edge forms a circuit. Once all vertices have been
used, the spanning tree is complete.
AF → CF → BF → CD → AD forms a circuit
AF → CF → BF → CD → CE and the spanning tree is complete.
The total weight of the edges is 2 + 4 + 6 + 7 + 12 = 31 .
Cost: 2
Cost: 4
Cost: 6
Cost: 7
Cost: 12
Computed cost: 31