No BSD License  

Highlights from
MatPlanWDM v0.5

image thumbnail
from MatPlanWDM v0.5 by Pablo Pavon MariƱo
Educational network planning tool for the RWA problem in WDM networks (MILP and heuristic based)

...
% MILP_MH
% 
%>> Usage: [exitMsg exitFlag netState valueFunction timeDefinition timeOptimization] = ...
%     MILP_MH(traff_trafficMatrix, phys, oldNetState, parametersString)
% 
%>> Abstract:  This function solves solve the Virtual Topology Design
%   Problem formulated as Mixed-Integer Linear Programming (MILP) Problem,
%   but focused on using this function in Multi-Hour Analysis, where the
%   function is called 24 times for 24 different traffic matrices at 24
%   different hours in a day, obtaining 24 different virtual designs. The
%   function signature includes the 'oldNetstate' as extra input parameter,
%   as some Multi-Hour Designs take account the virtual topology
%   ('oldNetState')designed at the previous hour. In this case, the
%   'oldNetState' parameter is not used for the function, because the
%   function does not design a virtual topology from a former virtual
%   topology. 
%
%   The inputs include the traffic matrix, the physical topology and the MILP
%   parameters. The objective is to design a virtual topology by optimizing
%   a certain cost function subject to a set of constraints. The values of
%   the output variables of the MILP formulation will yield the OPTIMAL
%   VIRTUAL TOPOLOGY.
%
% Arguments:
% o	In: 
%   traff_trafficMatrix(NxN): Average traffic flow offered between node
%    pairs. The Traffic Matrix is a two-dimensional matrix with N (N:
%    number of nodes) rows and N columns. An entry(s,d) means the average
%    traffic flow from node 's' to node 'd', expressed in Gbps. The main
%    diagonal is full of 0s.
%
%  . phys: Phys Structure. More information about netState in section 
%    "Structure of phys variable" from Help.
%
%  . oldNetState: NetState Structure that represents the former virtual
%    topology designed at a previous hour for a previous traffic demand.
%    See below to know the fields of a NetState Structure.
%
%   parametersString: String of parameters defined by the user. The syntax
%    of this string consist of: 
%
%    parameter1Name = parameter1Value (, parameter2Name = parameter2Value, ...) 
%
%    The number of white spaces is not checked.
%
%    The default parameters are defines so:
%
%    {['Parameter Name'],   ['Default Value'], ['Data type'],['ValidRange']}
%
%    {['allowWavelengthConversion'],  ['true(1)'], ['boolean'],     [];...
%    ['allowTrafficLosses'],        ['false(1)'], ['boolean'],     []; ...
%    ['cost_GbpsLoss'],                  ['100'], ['numeric'], ['(0,inf)']; ...
%    ['cost_GbpsElectronicallySwitched'], ['10'], ['numeric'], ['[0,inf)']; ...
%    ['cost_opticalTxPlusRx'],             ['0'], ['numeric'], ['[0,inf)']; ...
%    ['cost_virtualPerUsedWavelength'],    ['0'], ['numeric'], ['[0,inf]']; ...
%    ['maximumAllowedUtilization'],        ['1'], ['numeric'], ['[0,1]']; ...
%    ['allowMultiLp'],               ['true(1)'], ['boolean'],     [];...
%    ['applyMaximumDistancePerLp'], ['false(1)'], ['boolean'],     [];...
%    ['maximumDistancePerLp'],           ['800'], ['numeric'], ['(0,inf)'];...
%    ['applyMaximumPhysicalHopsPerLp'], ['false(1)'], ['boolean'], [];...
%    ['maximumPhysicalHopsPerLp'],         ['6'], ['integer'],     ['[1,inf)'];
%    };
% 
%
% o Out:
%  . exitMsg: Exit Message according to the exit flag from the CPLEX
%    solver.
% 
%  . exitFlag: 
%           0, if it is possible to design the virtual topology and route
%              all the traffic flows over the virtual topology.
%           1, if it is not possible to find a feasible solution
%           2, if the some flow was not able to be routed by the flow
%              routing algorithm or the flow routing is not optimal
% 
%   . netState: NetState Structure. More information about netState in
%     section "Structure of netState variable" from Help. 
% 
%   . valueFunction(1x1): Objective function value at optimum. It is a
%     real value.
%
%    timeDefinition(1x1): Elapsed time in hours, minutes and seconds for
%     the mathematical definition of the MILP problem. It is the time
%     needed by MATLAB so as to build the matrices and vectors which
%     implement the problem constraints and the objective function.
%
%    timeOptimization(1x1): Elapsed time in hours, minutes and seconds for
%     the optimization of the MILP problem. It is the time needed by
%     TOMLAB/CPLEX so as to solve the MILP problem.
%
%
function [exitMsg exitFlag netState valueFunction timeDefinition timeOptimization] = ...
    MILP_MH(mh_trafficMatrixes, phys, parametersString)


numberTrafficMatrixes = size (mh_trafficMatrixes , 3);
mh_netState = cell (numberTrafficMatrixes,1);
lastLpSerialNumberUsed = 0;
lastFlowSerialNumberUsed = 0;

for orderTrafficMatrix=1:numberTrafficMatrixes
    trafficMatrix (:,:) = mh_trafficMatrixes(:,:,orderTrafficMatrix);
    [exitMsg exitFlag netState valueFunction timeDefinition timeOptimization] = ...
    MILP(trafficMatrix, phys, parametersString);
    if (exitFlag == 1)
        mh_netState = [];
        break;
    end
    netState.flowTable (:,1) = (lastFlowSerialNumberUsed+1):(lastFlowSerialNumberUsed+size(netState.flowTable,1));
    netState.lightpathTable (:,1) = (lastLpSerialNumberUsed+1):(lastLpSerialNumberUsed+size(netState.lightpathTable,1));    
    lastLpSerialNumberUsed = lastLpSerialNumberUsed + size(netState.lightpathTable,1);
    lastFlowSerialNumberUsed = lastFlowSerialNumberUsed + size(netState.flowTable,1);
    mh_netState {orderTrafficMatrix} = netState; 
end

Contact us at files@mathworks.com