| Problem: Write a Matlab
function that takes as input the name of a file of data points whose
format is given in Problem 1 (hopefully type
A) and returns a subset of the given data points for which all
n file objects are connected (according to the
con_data matrix associated with the subset), and is such that
the sum of values of all data points in the returned subset is
minimized over all subsets for which all n file objects are
connected. Your Matlab function should use prob1.m,
prob2.m, and prob3.m.
Solution description: Build raw_data and con_data from prob1.m as follows:
[raw_data con_data] = prob1(filename);
Initialize a solution matrix. Sort the rows of
raw_data on the value. Consider each row (called
data_point) of raw_data in decreasing order of
value and act as follows: if data_point can be removed
from con_data and all objects remain connected (use
prob3.m for this test), then remove it (use prob2.m for
this); otherwise, do not remove it and add data_point to
solution. Sum all values of data points in solution.
|