time | Calls | line |
---|
| | 1 | function [outputcost1, outputcost2, outputcost3] = computenumber(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 = 200;
|
< 0.001 | 2 | 6 | costweight2 = 200;
|
< 0.001 | 2 | 7 | costweight3 = 10;
|
| | 8 |
|
< 0.001 | 2 | 9 | outputcost1 = 0;
|
< 0.001 | 2 | 10 | outputcost2 = 0;
|
< 0.001 | 2 | 11 | outputcost3 = 0;
|
| | 12 |
|
< 0.001 | 2 | 13 | for rows = 1:height(Table)
|
| | 14 |
|
| | 15 | % %check if allocated is same as behov
|
| | 16 | % if Table{rows,1} == Table{rows,6}
|
| | 17 | % cost1 = costweight1*1;
|
| | 18 | % else
|
| | 19 | % cost1 = costweight1*0;
|
| | 20 | % end
|
| | 21 |
|
< 0.001 | 360 | 22 | cost1 = 0;
|
| | 23 |
|
| | 24 |
|
| | 25 | %check if student want to sit with other student
|
| | 26 | %check if not empty
|
0.017 | 360 | 27 | if Table.(6)(rows) <= 3
|
0.015 | 292 | 28 | if Table.(2)(rows) == ""
|
< 0.001 | 264 | 29 | cost2 = costweight2*0;
|
< 0.001 | 28 | 30 | else
|
0.007 | 28 | 31 | if Table.(4)(rows) == Table.(4)(Table.(2)(rows))
|
< 0.001 | 19 | 32 | cost2 = costweight2*0;
|
< 0.001 | 9 | 33 | else
|
< 0.001 | 9 | 34 | cost2 = costweight2*1;
|
< 0.001 | 28 | 35 | end
|
< 0.001 | 292 | 36 | end
|
< 0.001 | 360 | 37 | end
|
| | 38 |
|
< 0.001 | 360 | 39 | cost3 = 0;
|
| | 40 |
|
| | 41 | %sjekke etter om studenter sitter på samme rom med andre studenter som
|
| | 42 | %har samme faglærer
|
| | 43 | %øke kostnad på de som ikke sitter sammen med samme faglærer
|
| | 44 |
|
| | 45 | %extract entries with same Faglaerer and same BehovForArbeidsplass
|
0.067 | 360 | 46 | TF = (Table.(3) == Table.(3)(rows) & Table.(10) == Table.(10)(rows));
|
0.076 | 360 | 47 | newshorttable = Table(TF,:);
|
0.020 | 360 | 48 | if Table.(6)(rows) <= 3
|
0.001 | 292 | 49 | for rows2 = 1:height(newshorttable)
|
0.158 | 1398 | 50 | if Table.(4)(rows) ~= newshorttable.(4)(rows2)
|
< 0.001 | 86 | 51 | cost3 = cost3 + costweight3*1;
|
< 0.001 | 1398 | 52 | end
|
< 0.001 | 1398 | 53 | end
|
< 0.001 | 360 | 54 | end
|
| | 55 |
|
| | 56 | % gammel versjon for sjekk av samme faglærer
|
| | 57 | % for rows2 = 1:height(Table)
|
| | 58 | % if Table{rows,1} == Table{rows2,1}
|
| | 59 | % if strncmpi(Table{rows,3}, Table{rows2,3}, 10)
|
| | 60 | % if strncmpi(Table{rows,4}, Table{rows2,4}, 10)
|
| | 61 | %
|
| | 62 | % else
|
| | 63 | % cost3 = cost3 + costweight3*1;
|
| | 64 | % end
|
| | 65 | % end
|
| | 66 | % end
|
| | 67 | % end
|
| | 68 |
|
< 0.001 | 360 | 69 | outputcost1 = outputcost1 + cost1;
|
< 0.001 | 360 | 70 | outputcost2 = outputcost2 + cost2;
|
< 0.001 | 360 | 71 | outputcost3 = outputcost3 + cost3;
|
< 0.001 | 360 | 72 | end
|
| | 73 |
|
< 0.001 | 2 | 74 | end
|