This is a static copy of a profile report

Home

computecost (Calls: 377, Time: 66.469 s)
Generated 04-Jun-2021 04:11:18 using performance time.
function in file C:\Users\willi\OneDrive\NTNU\Masteroppgave_Ke\Matlab\computecost.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
script9script377
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
53
if Table.(4)(rows) ~= newshort...
26352329.160 s43.9%
50
newshorttable = Table(TF,:);
6786014.040 s21.1%
49
TF = (Table.(3) == Table.(3)(r...
6786012.376 s18.6%
51
if Table.(6)(rows) <= 3
678603.631 s5.5%
30
if Table.(6)(rows) <= 3
678603.079 s4.6%
All other lines  4.182 s6.3%
Totals  66.469 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
tabular.subsreffunction107294242.384 s63.8%
categorical.nefunction2635233.260 s4.9%
categorical.eqfunction731381.007 s1.5%
tabular.numArgumentsFromSubscriptfunction1357200.248 s0.4%
tabular.heightfunction554190.101 s0.2%
Self time (built-ins, overhead, etc.)  19.468 s29.3%
Totals  66.469 s100% 
Code Analyzer results
Line numberMessage
4The value assigned to variable 'costweight1' might be unused.
Coverage results
Show coverage for parent directory
Total lines in function76
Non-code lines (comments, blank lines)45
Code lines (lines that can run)31
Code lines that did run31
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
Calls 
 line
   1 
function outputcost = computecost(Table)
   2 
%UNTITLED2 Summary of this function goes here
   3 
%   Detailed explanation goes here
< 0.001 
    377 
   4
costweight1 = 200; 
< 0.001 
    377 
   5
costweight2 = 200; 
< 0.001 
    377 
   6
costweight3 = 10; 
   7 

   8 
%legee til samme faglærer
   9 

< 0.001 
    377 
  10
outputcost = 0; 
  0.002 
    377 
  11
for rows = 1:height(Table) 
  12 

  13 
    %not necesacrry if init is correct
  14 
%     %check if allocated is same as behov
  15 
%     if Table{rows,1} == Table{rows,5}
  16 
%         cost1 = costweight1*1;
  17 
%     else
  18 
%         cost1 = costweight1*0;
  19 
%     end
  0.004 
  67860 
  20
    cost1 = 0; 
  21 
    
  22 
    %check if student want to sit with other student
  23 
    %check if not empty
  24 
    
  25 
    %todo: need to check that it doesnt count double if both students add
  26 
    %each other
  27 
    %tenk litt på det
  28 
    %mulighet for å skru av og på
  29 
    %fjerne dublikater før optimalisering
  3.079 
  67860 
  30
    if Table.(6)(rows) <= 3 
  2.719 
  55042 
  31
        if Table.(2)(rows) == "" 
  0.002 
  49764 
  32
            cost2 = costweight2*0; 
< 0.001 
   5278 
  33
        else 
  1.223 
   5278 
  34
            if Table.(4)(rows) == Table.(4)(Table.(2)(rows)) 
< 0.001 
   3490 
  35
                cost2 = costweight2*0; 
< 0.001 
   1788 
  36
            else 
< 0.001 
   1788 
  37
                cost2 = costweight2*1; 
< 0.001 
   5278 
  38
            end 
  0.002 
  55042 
  39
        end 
  0.003 
  67860 
  40
    end 
  41 
    
  0.003 
  67860 
  42
    cost3 = 0; 
  43 
    
  44 
    %sjekke etter om studenter sitter på samme rom med andre studenter som
  45 
    %har samme faglærer
  46 
    %øke kostnad på de som ikke sitter sammen med samme faglærer
  47 
    
  48 
    %extract entries with same Faglaerer and same BehovForArbeidsplass
 12.376 
  67860 
  49
    TF = (Table.(3) == Table.(3)(rows) & Table.(10) == Table.(10)(rows)); 
 14.040 
  67860 
  50
    newshorttable = Table(TF,:); 
  3.631 
  67860 
  51
    if Table.(6)(rows) <= 3 
  0.175 
  55042 
  52
        for rows2 = 1:height(newshorttable) 
 29.160 
 263523 
  53
            if Table.(4)(rows) ~= newshorttable.(4)(rows2) 
  0.001 
  18320 
  54
                cost3 = cost3 + costweight3*1; 
  0.011 
 263523 
  55
            end 
  0.015 
 263523 
  56
        end 
  0.004 
  67860 
  57
    end 
  58 
% gammel versjon for sjekk av samme faglærer
  59 
%     for rows2 = 1:height(Table)
  60 
%         if Table{rows,1} == Table{rows2,1}
  61 
%             if strncmpi(Table{rows,3}, Table{rows2,3}, 10)
  62 
%                 if strncmpi(Table{rows,4}, Table{rows2,4}, 10)
  63 
% 
  64 
%                 else
  65 
%                     cost3 = cost3 + costweight3*1;
  66 
%                 end
  67 
%             end
  68 
%         end
  69 
%     end
  70 
    
  0.004 
  67860 
  71
    rowcost = cost1 + cost2 + cost3; 
  72 
    
  0.003 
  67860 
  73
    outputcost = outputcost + rowcost; 
  0.005 
  67860 
  74
end 
  75 

  0.003 
    377 
  76
end 

Other subfunctions in this file are not included in this listing.