time | Calls | line |
---|
| | 1 | function [rowcosts] = getrowmostcost(Table)
|
| | 2 | %UNTITLED2 Summary of this function goes here
|
| | 3 | % Detailed explanation goes here
|
| | 4 | %check multible exams at same time
|
< 0.001 | 2 | 5 | costweight1 = 100;
|
< 0.001 | 2 | 6 | costweight2 = 200;
|
| 2 | 7 | costweight3 = 10;
|
| | 8 |
|
< 0.001 | 2 | 9 | rowcosts = [];
|
< 0.001 | 2 | 10 | mostcost = 0;
|
< 0.001 | 2 | 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 | 360 | 18 | cost1 = 0;
|
| | 19 |
|
| | 20 |
|
| | 21 | %check if student want to sit with other student
|
| | 22 | %check if not empty
|
0.018 | 360 | 23 | if Table.(6)(rows) <= 3
|
0.016 | 292 | 24 | if Table.(2)(rows) == ""
|
< 0.001 | 264 | 25 | cost2 = costweight2*0;
|
< 0.001 | 28 | 26 | else
|
0.007 | 28 | 27 | if Table.(4)(rows) == Table.(4)(Table.(2)(rows))
|
< 0.001 | 18 | 28 | cost2 = costweight2*0;
|
< 0.001 | 10 | 29 | else
|
< 0.001 | 10 | 30 | cost2 = costweight2*1;
|
< 0.001 | 28 | 31 | end
|
< 0.001 | 292 | 32 | end
|
< 0.001 | 360 | 33 | end
|
| | 34 |
|
< 0.001 | 360 | 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.070 | 360 | 42 | TF = (Table.(3) == Table.(3)(rows) & Table.(10) == Table.(10)(rows));
|
0.079 | 360 | 43 | newshorttable = Table(TF,:);
|
0.021 | 360 | 44 | if Table.(6)(rows) <= 3
|
0.001 | 292 | 45 | for rows2 = 1:height(newshorttable)
|
0.166 | 1398 | 46 | if Table.(4)(rows) ~= newshorttable.(4)(rows2)
|
< 0.001 | 88 | 47 | cost3 = cost3 + costweight3*1;
|
< 0.001 | 1398 | 48 | end
|
< 0.001 | 1398 | 49 | end
|
< 0.001 | 360 | 50 | end
|
| | 51 |
|
| | 52 | % gammel versjon for sjekk av samme faglærer
|
| | 53 | % for rows2 = 1:height(Table)
|
| | 54 | % if Table{rows,1} == Table{rows2,1}
|
| | 55 | % if strncmpi(Table{rows,3}, Table{rows2,3}, 10)
|
| | 56 | % if strncmpi(Table{rows,4}, Table{rows2,4}, 10)
|
| | 57 | %
|
| | 58 | % else
|
| | 59 | % cost3 = cost3 + costweight3*1;
|
| | 60 | % end
|
| | 61 | % end
|
| | 62 | % end
|
| | 63 | % end
|
| | 64 |
|
| | 65 |
|
< 0.001 | 360 | 66 | rowcosts(rows) = cost1 + cost2 + cost3;
|
< 0.001 | 360 | 67 | end
|
| | 68 |
|
< 0.001 | 2 | 69 | rowcosts;
|
| | 70 |
|
< 0.001 | 2 | 71 | end
|
Other subfunctions in this file are not included in this listing.