Question: function project _ 1 0 ( ) % PROJECT _ 1 0 project _ 1 0 ( ) is the driver function for the program.

function project_10()
% PROJECT_10 project_10() is the driver function for the program.
%
% Name:
% Date:
% Class: CMPSC 200
% Description: Determine the optimal location of a warehouse
%
% Use print_splash_screen to print your splash screen
% Enter the locations of the customers using a single call
% to get_locations - in the get_locations function you will
% need to call get_data twice for each customer. You must use
% get_data to error check that all locations are between 0
% and 100
[X1, X2, X3, X4, X5, Y1, Y2, Y3, Y4, Y5]= get_locations();
% Prompt the user for the customer volumes
% Again you only have a single call to get_volumes - in the
% get_volumes function you will
% need to call get_data once for each customer. You must use
% get_data to error check that all volumes are greater than or
% equal to 0
[V1, V2, V3, V4, V5]= get_volumes(); % Get the five volumes
% Find the optimal location
% Note that there ten input values to this function, three for each
% customer
[x, y, lowest_cost]= find_optimal(X1, X2, X3, X4, X5, Y1, Y2, Y3, Y4, Y5,
V1, V2, V3, V4, V5);
% Print results from the optimization
print_results(x, y, lowest_cost);
end
function [x_opt, y_opt, min_cost]= find_optimal(X1, X2, X3, X4, X5, Y1, Y2, Y3,
Y4, Y5, V1, V2, V3, V4, V5)
% FIND_OPTIMAL find_optimal(xLoc, yLoc, shipVolumes) is function that
% uses a brute force algorithm to find the optimal location of a warehouse.
%
% The function returns three values; the optimal x and y coordinates and
% the minimum cost
%
% Name:
% Date:
% Class: CMPSC 200
%
%
% Set a minimum value for the cost - this should be a big number (1e99)?
min_cost =1.0e99;
% Set the starting the optimal locations - make it impossible (-1,-1)?
x_opt =-1;
y_opt =-1;
% Create two nested for loops that step through all of the possible
%(x, y) pairs
for y =[0:100]
for x =[0:150]
% Calculate the 5 distances and 5 costs
% You should use a get_distance function and call it five
times
% and then call get_cost five times. Each call will use the
% distance and the volume for that customer
% Calculate the total cost by summing the five costs
% Now check the cost against the current min_cost - this is a
% simple if. If the new cost is less than min_cost, change
% min_cost and set x_opt and y_opt to the current
% location (x, y). If it is not then you do not need to do
% anything
if(cost < min_cost)
end
end
end
end solve this with ai

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!