function [total_cost, fibre_cost, line_card_cost] ...
= compute_link_cost(links_type, links_n, links_distances)
%
% file: compute_cost.m, (c) Matthew Roughan, Tue Mar 10 2009
% created: Tue Mar 10 2009
% author: Matthew Roughan
% email: matthew.roughan@adelaide.edu.au
%
% This function computes the cost of a link, or set of links, based on the
% locations of the cities
%
% INPUTS:
% links_types: the type of link (1=OC48, 2=OC192)
% links_n: the number of parallel links of that type
% links_distances: the length of each link (in km)
%
% Note that links are assumed to be bi-directional, so this function
% computes the cost for both directions of a link.
%
% OUTPUTS:
% total_cost: a vector containing costs of all links
% fibre_cost: cost of the fibre connecting the two nodes
% line_card_cost: cost of the line cards at each end of the link
%
%
% cost parameters for this project
line_card_cost = [110; 230]; % cost for line cards
distance_cost = 4; % $ per km
% compute the costs
fibre_cost = links_distances * distance_cost;
line_card_cost = 2 * links_n .* line_card_cost(links_type);
total_cost = fibre_cost + line_card_cost;