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)

addEventToListOfPendingEvents.m
%>>>addEventToListOfPendingEvents 
%This function adds a new event to the list of pending events. At first,
%the event is added to the list and after that, the list is sorted
%according to the arrived/end time.
%
%>>>The inputs are:
%
% 1) eventType: type of event. If Its an arrived event, eventType is '0'.
%    If Its an end event, eventType is '1'.
%
% 2) eventTime: arrived/end time for the flow with serial number 'serialNumber'.
%
% 3) serialNumber: serial number to identify the flow.
%
% 4) listOfPendingEvents: list of pending events where the first column is
%    the type of event, the second column is the arrived/end time of the flow
%    and the third column is the serial number of the flow.
%
%>>>The output is:
%
% 1)listOfPendingEvents: updated 'listOfPendingEvents'. We add the new
%   event and sort the list according to the arrived/end time.


function listOfPendingEvents=addEventToListOfPendingEvents (eventType , eventTime , serialNumber,listOfPendingEvents)

%New event to add
newPendingEvent=[eventType , eventTime , serialNumber];

if isempty(listOfPendingEvents)
    listOfPendingEvents=[newPendingEvent];
else
    listOfPendingEvents=[listOfPendingEvents;newPendingEvent];  %Add the event.
    listOfPendingEvents=sortrows(listOfPendingEvents,2);        %Sort the list.
end

Contact us