-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcondition3.m
More file actions
executable file
·146 lines (109 loc) · 6.38 KB
/
condition3.m
File metadata and controls
executable file
·146 lines (109 loc) · 6.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
function [Assigned_proj_roll_nos,sorted_txt,stored_index,txt3,sorted_CGPA,message]...
= condition3(index,sorted_txt,sorted_Roll_nos,txt3,N_students,total_choices,sorted_CGPA,max_proj_checker,Assigned_proj_roll_with_gui)
delproj = @removingproj; % [sorted_txt] = removingproj(same_CGPA_project,sorted_txt,N_students)
assign = @assignment;
k = 2;
for j = 1: length(index)
choice(j) = sorted_txt(index(j),k);
choice_max_proj_checker(j) = sorted_txt(index(j),2);
choice_for_comparing{j} = choice{j}(1:end-1);
same_CGPA_Roll_nos(j) = sorted_Roll_nos(index(j));
same_CGPA_project(j) = sorted_txt(index(j),k);
k = k+1;
end
clear k;
%%%%%%%%%%%%%%%%% We need to also check for the availability of the
% project under that professor since there is a max
% limit on the number of projects assigned to a
% particular project.
if isequal(choice_for_comparing(1),choice_for_comparing(2)) == 1
proj_max_checker = [Assigned_proj_roll_with_gui; [choice(1) string(same_CGPA_Roll_nos(1))]];
no_of_projs_sent_for_verification = size(choice,2);
%prev_sorted_txt = sorted_txt;
BeforeOrAfter = 'Before';
[~,~,~,message_MAX_PROJS2,~] =...
max_proj_checker_deleter (proj_max_checker,max_proj_checker,N_students,sorted_txt,no_of_projs_sent_for_verification,BeforeOrAfter);
end
%message_MAX_PROJS2 = "Only1Left" % Testing purposes only
%
% How_many_left = sscanf(message_MAX_PROJS2,'Only%dLeft');
%
% Deciding_factor = no_of_projs_sent_for_verification - How_many_left;
%%%%%%%%%%%%%% MAX PROJ CHECKING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if isequal(choice_for_comparing(1),choice_for_comparing(2)) == 1 ...
&& message_MAX_PROJS2 == "Only1Left"
prof_name = choice_max_proj_checker{1}(1:end-5);
Opt.Interpreter = 'tex';
Opt.WindowStyle = 'modal';
waitfor(msgbox("\fontsize{14} Prof. " + prof_name + " has only project left according to the \bfMax Project per Professor Criteria\rm",...
'Warning','warn',Opt));
%create msgbox
Opt.Interpreter = 'tex';
Opt.WindowStyle = 'modal';
answer = questdlg('\fontsize{14}There is a clash in choices and CGPA, How do you like to continue?',...
'Choices',...
'Compare GATE Score','Do It Manually',struct('Default','','Interpreter','tex'));
switch answer
% case 'Compare GATE Score'
% % disp('Here comes the gate score function file')
% %%%%%%%%%%%%%%%%%%%%%%%%%%%GATE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [Assigned_proj_roll_nos,sorted_txt,txt3,sorted_CGPA,message]...
% = gate_allocation (index,sorted_Roll_nos,sorted_txt,txt3,N_students,total_choices,sorted_CGPA);
%
% stored_index = 0;
case 'Do It Manually'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MANUALSELECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% while true
[Assigned_proj_roll_nos,sorted_txt,txt3,sorted_CGPA] = ...
manual_selection(index,sorted_Roll_nos,sorted_txt,txt3,N_students,total_choices,sorted_CGPA);
stored_index = 0;
message='Manual Selection as per Max project criteria';
for i = 1:length(Assigned_proj_roll_nos)
Assigned_proj_rolls_checking{i,1} = Assigned_proj_roll_nos{i,1}(1:end-1);
end
clear i;
[~,idx]=unique( strcat(Assigned_proj_rolls_checking(:,1), 'rows'))
Assigned_proj_rolls_checking_unique=Assigned_proj_rolls_checking(idx,:);
if size(Assigned_proj_rolls_checking_unique,1) == size(Assigned_proj_rolls_checking,1)
disp('Assignment done as per the condition (MPpPC)')
else
Opt.Interpreter = 'tex';
Opt.WindowStyle = 'modal';
waitfor(msgbox("\fontsize{12} Prof. " + prof_name +...
" has only one project left according to the \bfMPpC\rm. But allotment is done more than one. Try alloting again ",...
'Error','error',Opt));
errordlg('Allotment stopped since the Max Project per Professor Criteria did not met')
error('Allotment stopped since the Max Project per Professor Criteria did not met');
end
% end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif isequal(choice_for_comparing(1),choice_for_comparing(2)) == 1 ...
%1 % Here we are checking for the professors, If they are same, then we will assign one to first person and second to other person.
for k = 1: 2
Assigned_proj_roll_nos(k,:) = string([same_CGPA_project(k) same_CGPA_Roll_nos(k)]);
sorted_txt = delproj(same_CGPA_project(k),sorted_txt,N_students);
stored_index = 0;
end
txt3 = assign(choice,total_choices,txt3);
message='Condition3_Direct Allocation'
else % Else if the first choice and second choice are under different professors, then gate or manual selection should do the job.
answer = questdlg('There is a clash in choices and CGPA, How do you like to continue?',...
'Choices',...
'Compare GATE Score','Do It Manually','Compare GATE Score');
switch answer
case 'Compare GATE Score'
% disp('Here comes the gate score function file')
%%%%%%%%%%%%%%%%%%%%%%%%%%%GATE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[Assigned_proj_roll_nos,sorted_txt,txt3,sorted_CGPA,message]...
= gate_allocation (index,sorted_Roll_nos,sorted_txt,txt3,N_students,total_choices,sorted_CGPA);
stored_index = 0;
% message = 'Gate Score Based Allocation'
case 'Do It Manually'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MANUALSELECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[Assigned_proj_roll_nos,sorted_txt,txt3,sorted_CGPA] = ...
manual_selection(index,sorted_Roll_nos,sorted_txt,txt3,N_students,total_choices,sorted_CGPA);
stored_index = 0;
message='Manual Allocation';
end
end