In Matalb R2008, this error apperas: Error using ==> feval Undefined function or method 'edit6_Callback' for input arguments of type 'struct'.Please tell me the changes in ciode

14 vues (au cours des 30 derniers jours)
% HLDA (Heuristic Logical Design Algorithm) % % Usage: [exitFlag lightpathTable lightpathRoutingMatrix numberOfOccupiedTWCs numberOfOccupiedTxs numberOfOccupiedRxs] = % libraryVTD_HLDA(traff_trafficMatrix, phys) % % Abstract: this algorithm solves the virtual topology desing problem by % means of the HDLA algorithm. This algorithm attempts to maximize single % (virtual)-hop traffic flow. It aims at minimizing congestion in a given % network. % % This method solves the first three of the four classic subproblems into % which the Virtual Topology Design Problem is possible to decompose: % % 1) Virtual Topology Subproblem % 2) Lightpath Routing Subproblem % 3) Wavelength Assignment Subproblem % 4) Traffic Routing (over the Virtual Topology) Subproblem % % The HDLA considers node pairs in decreasing order of their traffic. It % selects the node pair 'X' with the most nonzero traffic flow % between them. A lightpath is established between this node pair, if % permissible. A lightpath is permissible for node pair x with these % requirements: % % 1) A physical route. % 2) A common free wavelength on the route. % 3) A free transmitter at the source node of 'X'. % 4) A free receiver at the destination node of 'X'. % % When a lightpath is established between pair 'X', the traffic associated % with 'X' is updated by substracting from it the traffic associated with % pair 'Y'. Here, node pair 'Y' has the highest traffic after pair 'X'. If % a lightpath cannot be established between node pair 'X', the traffic % associated with it is set to zero. Now, the node pair which has the % maximum amount of nonzero traffic is chosen and the above procedure is % repeated. Note that the chosen node pair could be either 'X' or 'Y'. When % all the node pairs with nonzero traffic have been considered, the % procedure stops. % % NOTE: This algorithm does not solve the traffic flow routing over the % virtual topology. For this purpose, it is necessary to apply some flow % routing method over the virtual topology obtained with this function. % % 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. % % % o Out: % . exitFlag: % 0, if it is possible to design the virtual topology % 1, if the virtual topology design is NOT FEASIBLE as there is % no sufficient resources to establish any lightpath. % % . lightpathTable(L,3): L-by-3 integer matrix. Each row is a % lightpath 'l', where the first column is the serial number of the % lightpath, the second and third columns of each row are % theorigin node 'i' and destination node 'j' of this lightpath 'l' % respectively and L is the number of lightpaths of the virtual % topology. % % . lightpathRoutingMatrix (L,M): L-by-M integer matrix where L % is the number of lightpaths and M is the number of physical fibre % links. Each row is a lightpath 'l' and each column is a physical link % 'm'. If a lightpath 'l' uses a physical link 'm' with a certain % wavelength 'w', the entry (l,m) is equal to 'w'. If no physical link % is used by the lightpath 'l', the entry is equal to '0'. % % . numberOfOccupiedTxs (Nx1): N integer vector where N is the % number of nodes. Each position 'i' is the number of occupied (used) % transmitters that the node with ID 'i' has. % % . numberOfOccupiedRxs (Nx1): N integer vector where N is the % number of nodes. Each position 'i' is the number of occupied (used) % receivers that the node with ID 'i' has. % % . numberOfOccupiedTWCs (Nx1): N integer vector where N is the % number of nodes. Each position 'i' is the number of occupied (used) % converters that the node with ID 'i' has. %
function [exitFlag lightpathTable lightpathRoutingMatrix numberOfOccupiedTWCs numberOfOccupiedTxs numberOfOccupiedRxs] = libraryVTD_HLDA(traff_trafficMatrix, phys)
%MAIN VARIABLES*********************************************************
exitFlag=0;
numberOfNodes = phys.N; numberOfLinks = phys.M;A
lightpathTable=[]; lightpathRoutingMatrix=[]; numberOfOccupiedTxs = zeros (numberOfNodes,1); numberOfOccupiedRxs = zeros (numberOfNodes,1); numberOfOccupiedTWCs = zeros (numberOfNodes,1); % does not change as this is a non-wavelength-converting heuristic
%"freeWavelengths" is a matrix, where rows are each link %((1,1)(2,1)(3,1)(4,1)(1,2)(2,2)...) and columns are a specifical %wavelength: w0, w1, w2... Each value is 0 or 1 if that is free freeWavelengths=zeros(numberOfLinks,max(phys.numberWavelengthPerFiber)); for i=1:numberOfLinks, freeWavelengths(i,1:phys.numberWavelengthPerFiber(i))=1; end
%total number of node pairs whose traffic must be considered numberOfNodePairsToBeConsidered = length(traff_trafficMatrix)^2-... sum(sum(traff_trafficMatrix==zeros(length(traff_trafficMatrix),length(traff_trafficMatrix))));
iteration=1;
%ALGORITHM DEVELOPMENT*********************************************
numberOfLightpaths=0; consideredNodePairs=[];
%Main loop. It works along such iterations as possible traffics to route while size(consideredNodePairs,1) < numberOfNodePairsToBeConsidered
%First maximum traffic value
%at first, we find the maximum traffic value. It is avoid two equal
%maximums, we take the first one.
maximumTraffic=max(max(traff_trafficMatrix));
[aux1,aux2]=find(traff_trafficMatrix==max(max(traff_trafficMatrix)));
source(iteration)=aux1(1);
destination(iteration)=aux2(1);
if(isempty(intersect(consideredNodePairs,[source(iteration) destination(iteration)],'rows')))
consideredNodePairs=[consideredNodePairs;[source(iteration) destination(iteration)]];
end
%FIRST CONDITION: A TRANSMITER IN SOURCE NODE AND A RECEIVER IN DESTINATION NODE
if(numberOfOccupiedRxs(destination(iteration))<phys.numberRxPerNode(destination(iteration)) &&...
numberOfOccupiedTxs(source(iteration))<phys.numberTxPerNode(source(iteration))),
%SECOND CONDITION: FIND A physical ROUTE BETWEEN SOURCE AND DESTINATION
linkTable=[phys.linkTable ones(numberOfLinks,1)];
[sequenceOfSPFLinkIds, sequenceOfSPFNodeIds, totalCost] = ...
libraryGraph_shortestPath (linkTable, source(iteration), destination(iteration));
%THIRD CONDITION: IT'S NECESSARY THE SAME WAVELENGTH IN ALL physical ROUTE
%A matrix such "freeWavelengths" is built. It only contains the links of
%the physical route. Now we can check which of them are availables to be used.
freeWavelengthsOnRoute = freeWavelengths(sequenceOfSPFLinkIds,:);
usedWavelength=0;
for i=1:size(freeWavelengthsOnRoute,2)%we check all wavelengths
%The column with all-ones is the used as wavelength
if(freeWavelengthsOnRoute(:,i)==ones(size(freeWavelengthsOnRoute,1),1)),
usedWavelength=i;%the wavelength is established
%trasmitters and receivers are updated in source and destination nodes
numberOfOccupiedTxs(source(iteration))=numberOfOccupiedTxs(source(iteration))+1;
numberOfOccupiedRxs(destination(iteration))=numberOfOccupiedRxs(destination(iteration))+1;
%freeWavelengths is updated when the used wavelength which is occupied (0)
freeWavelengths(sequenceOfSPFLinkIds,usedWavelength)=0;
%virtualTopology is updated with the new lightpath
serialNumberOfLightpath=size(lightpathTable,1)+1;
lightpathTable=[lightpathTable; [serialNumberOfLightpath source(iteration) destination(iteration)]];
currentLightpathRouting=zeros(1,numberOfLinks);
currentLightpathRouting(sequenceOfSPFLinkIds)=usedWavelength;
lightpathRoutingMatrix=[lightpathRoutingMatrix; currentLightpathRouting];
numberOfLightpaths=numberOfLightpaths+1;
%traff_trafficMatrix is updated
%we are going to search the second maximum value at traffic
%matrix
traff_trafficMatrix(source(iteration),destination(iteration))=0;
[aux1,aux2]=find(traff_trafficMatrix==max(max(traff_trafficMatrix)));
sourceOfSecond=aux1(1);
destinationOfSecond=aux2(1);
traff_trafficMatrix(source(iteration),destination(iteration))=maximumTraffic;%we complete the original matrix again
if traff_trafficMatrix(source(iteration),destination(iteration))>0,
traff_trafficMatrix(source(iteration),destination(iteration))=...
traff_trafficMatrix(source(iteration),destination(iteration))-traff_trafficMatrix(sourceOfSecond,destinationOfSecond);
end
break%we don't continue checking wavelengths when a successful one has been found
end
end
%Condition of used wavelength
if usedWavelength==0 %There is not avalaible wavelength for the selected physical route;
%traff_trafficMatrix updating
traff_trafficMatrix(source(iteration),destination(iteration))=0;
end
else %There is not available transmitters or receivers at node pair
%traff_trafficMatrix updating
traff_trafficMatrix(source(iteration),destination(iteration))=0;
end
iteration=iteration+1;
end%End of the main loop
if isempty(lightpathTable) isempty(lightpathRoutingMatrix), exitFlag = 1; end % there is no sufficient resources to establish any lightpath.

Réponses (1)

Jan
Jan le 14 Mar 2017
The shown code does not contain any call the the function edit6_Callback. Therefore the error cannot be produced by this code. In consequence this large block of nearly unreadable code does not allow to solve the problem.
But using the debuger does. Or search in your code for the string 'edit6_Callback' to find the wrong definition. The first input should be a handle of a uicontrol and not a struct.

Catégories

En savoir plus sur Server Management dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by