time | Calls | line |
---|
| | 1 | function rowmostcost = getrowmostcost(Table)
|
| | 2 | %UNTITLED2 Summary of this function goes here
|
| | 3 | % Detailed explanation goes here
|
| | 4 | %check multible exams at same time
|
< 0.001 | 4 | 5 | costweight1 = 100;
|
< 0.001 | 4 | 6 | costweight2 = 200;
|
< 0.001 | 4 | 7 | costweight3 = 10;
|
| | 8 |
|
< 0.001 | 4 | 9 | rowmostcost = 1;
|
< 0.001 | 4 | 10 | mostcost = 0;
|
< 0.001 | 4 | 11 | for rows = 1:height(Table)
|
| | 12 | %check if allocated is same as behov
|
| | 13 | % if Table{rows,1} == Table{rows,5}
|
| | 14 | % cost1 = costweight1*1;
|
| | 15 | % else
|
| | 16 | % cost1 = costweight1*0;
|
| | 17 | % end
|
< 0.001 | 720 | 18 | cost1 = 0;
|
| | 19 |
|
| | 20 |
|
| | 21 | %check if student want to sit with other student
|
| | 22 | %check if not empty
|
0.034 | 720 | 23 | if Table.(6)(rows) <= 3
|
0.030 | 584 | 24 | if Table.(2)(rows) == ""
|
< 0.001 | 528 | 25 | cost2 = costweight2*0;
|
< 0.001 | 56 | 26 | else
|
0.014 | 56 | 27 | if Table.(4)(rows) == Table.(4)(Table.(2)(rows))
|
< 0.001 | 38 | 28 | cost2 = costweight2*0;
|
< 0.001 | 18 | 29 | else
|
< 0.001 | 18 | 30 | cost2 = costweight2*1;
|
< 0.001 | 56 | 31 | end
|
< 0.001 | 584 | 32 | end
|
< 0.001 | 720 | 33 | end
|
| | 34 |
|
< 0.001 | 720 | 35 | cost3 = 0;
|
| | 36 |
|
| | 37 | %sjekke etter om studenter sitter på samme rom med andre studenter som
|
| | 38 | %har samme faglærer
|
| | 39 | %øke kostnad på de som ikke sitter sammen med samme faglærer
|
| | 40 |
|
| | 41 | %extract entries with same Faglaerer and same BehovForArbeidsplass
|
0.136 | 720 | 42 | TF = (Table.(3) == Table.(3)(rows) & Table.(10) == Table.(10)(rows));
|
0.155 | 720 | 43 | newshorttable = Table(TF,:);
|
0.040 | 720 | 44 | if Table.(6)(rows) <= 3
|
0.002 | 584 | 45 | for rows2 = 1:height(newshorttable)
|
0.316 | 2796 | 46 | if Table.(4)(rows) ~= newshorttable.(4)(rows2)
|
< 0.001 | 172 | 47 | cost3 = cost3 + costweight3*1;
|
< 0.001 | 2796 | 48 | end
|
< 0.001 | 2796 | 49 | end
|
< 0.001 | 720 | 50 | end
|
| | 51 | % gammel versjon for sjekk av samme faglærer
|
| | 52 | % for rows2 = 1:height(Table)
|
| | 53 | % if Table{rows,1} == Table{rows2,1}
|
| | 54 | % if strncmpi(Table{rows,3}, Table{rows2,3}, 10)
|
| | 55 | % if strncmpi(Table{rows,4}, Table{rows2,4}, 10)
|
| | 56 | %
|
| | 57 | % else
|
| | 58 | % cost3 = cost3 + costweight3*1;
|
| | 59 | % end
|
| | 60 | % end
|
| | 61 | % end
|
| | 62 | % end
|
| | 63 |
|
< 0.001 | 720 | 64 | rowcost = cost1 + cost2 + cost3;
|
< 0.001 | 720 | 65 | if (rowcost > mostcost)
|
< 0.001 | 14 | 66 | mostcost = rowcost;
|
< 0.001 | 14 | 67 | rowmostcost = rows;
|
< 0.001 | 720 | 68 | end
|
| | 69 |
|
< 0.001 | 720 | 70 | end
|
| | 71 |
|
| | 72 | %rowmostcost
|
| | 73 |
|
< 0.001 | 4 | 74 | end
|
Other subfunctions in this file are not included in this listing.