No BSD License  

Highlights from
MatPlanWDM v0.5

image thumbnail

MatPlanWDM v0.5

by

 

29 Jan 2007 (Updated )

Educational network planning tool for the RWA problem in WDM networks (MILP and heuristic based)

libraryWA_minConv.m
% libraryWA_minConv 

% Usage: [exitFlag sequenceOfWavelengths occupiedTWCsPerNode newLightpathRoutingEntry] = ...
%    libraryWA_minConv(sequenceOfLinkIDs, sequenceOfNodeIDs , phys, netState)
%
% Abstract: This function assigns a wavelength to a given path by minimizing
% the number of used Tunable Wavelength Converters (TWCs). 
%
% Arguments:
% o	In: 
%    sequenceOfLinkIDs: Row vector with the sorted sequence of link IDs of
%     the path to which we want to assign the wavelengths. The links IDs
%     are sorted from the ingress node to the egress node of the path.
%
%   . sequenceOfNodeIDs: Row vector with the sorted sequence of node IDs
%     of the path to which we want to assign the wavelengths. The nodes IDs
%     are sorted from the ingress node to the egress node of the path.
%
%   . netState: NetState Structure. More information about netState in
%     section "Structure of netState variable" from Help. 
%
%   . phys: Phys Structure. More information about netState in section 
%     "Structure of phys variable" from Help.
%
%
% o	Out:
%    exitFlag: If it is possible to make the wavelength assignament,
%     exitFlag = 0; otherwise exitFlag = 1.
%
%   . sequenceOfWavelengths: Vector with as many elemants as number of links
%     of the path to assign. Each element is the wavelegth assigned to
%     corresponding link in the path.
%   
%   . occupiedTWCsPerNode(Nx1): N integer vector where N is the number of 
%     nodes. Each position 'i' is '1' if a converter has been occupied (used)
%     and '0' if a converter has not been occupied in the node with ID 'i'.
%
%    newLightpathRoutingEntry(1,L): 1-by-L vector where L is the number of
%     physical links. This output parameter defines the wavelenght
%     assignment over the path, if was possible to make it. Each one of the
%     L columns is a physical link 'l'. If the path uses a physical link
%     'l' with an assigned wavelength 'w'; then, the element (l) is equal
%     to 'w'. If no physical link is used by the path, the element for that
%     link is equal to '0'. It is equivalent a new entry to the field
%     "lightpathRoutingMatrix" of a structure netState.
%
%

function [exitFlag sequenceOfWavelengths occupiedTWCsPerNode newLightpathRoutingEntry] = ...
    libraryWA_minConv(sequenceOfLinkIDs, sequenceOfNodeIDs , phys, netState)

%We make a transformation of graph to obtain the auxiliary graph so as to
%assign the wavelengths by using the minimum number of converters
occupiedTWCsPerNode = zeros (length (phys.numberTxPerNode),1);

[ingressTransfId egressTransfId transfNodeTable transfLinkTable transfTWCTable] = libraryGraph_graphTransformation (sequenceOfLinkIDs , sequenceOfNodeIDs, phys, ...
    netState);

transfNodeTable = [transfNodeTable ; transfTWCTable -1*ones(size(transfTWCTable,1),1)];
transfNodeTable = sortrows (transfNodeTable , 1);
numberOfLinks = phys.M;

%We calculate the shortest paths for all the possible paths in the auxiliary graph    
[sequenceOfTransfSPFLinkIds,sequenceOfTransfSPFNodeIds , totalCost] = libraryGraph_shortestPath (transfLinkTable , ingressTransfId , egressTransfId);

%If the auxiliary graph hasn't any link or all the origin nodes or all the
%destinationes nodes are not connected to the rest of the graph, it is not
%possible to assign wavelengths to the sequence
if isempty(sequenceOfTransfSPFLinkIds),
    exitFlag=1;
    sequenceOfWavelengths=[];
    newLightpathRoutingEntry=[];
    occupiedTWCsPerNode=[];
    return
end

exitFlag = 0;
sequenceOfWavelengths = [];
newLightpathRoutingEntry = zeros (1,numberOfLinks);
previousNodeId = sequenceOfNodeIDs(1);
counterOfActualLinks = 0;

for contNodeInSequence=2:length(sequenceOfTransfSPFNodeIds)
    transfNodeId = sequenceOfTransfSPFNodeIds (contNodeInSequence);
    transfLinkId = sequenceOfTransfSPFLinkIds (contNodeInSequence - 1);
     
    [twcTransfNodeId , rowInTransfTWCTable , aux] = intersect (transfTWCTable(:,1),transfNodeId);    
    if (isempty (rowInTransfTWCTable) == 0)        
        occupiedTWCsPerNode(transfTWCTable (rowInTransfTWCTable,2)) = 1;
        continue; % the transformed nodes associated to TWCs are ignored.
    end
    counterOfActualLinks = counterOfActualLinks + 1;
    nodeId = transfNodeTable (transfNodeId,2);
    wavelength = transfLinkTable (transfLinkId,4);
    
    if (nodeId ~= sequenceOfNodeIDs (counterOfActualLinks+1))
        sequenceOfWavelengths=[];
        newLightpathRoutingEntry=[];
        return
    end
        
    sequenceOfWavelengths = [sequenceOfWavelengths wavelength];
    newLightpathRoutingEntry (sequenceOfLinkIDs(counterOfActualLinks)) = wavelength;
end






Contact us