How to model an assignment/ allocation problem?

4 visualizzazioni (ultimi 30 giorni)
Rouyu Chen
Rouyu Chen il 13 Apr 2023
Risposto: Divyanshu il 20 Apr 2023
Dear experts,
If I have NS students from NA departments, and there is a ranking in each department. Now I want to allocate them into K different groups (where each group only has limited place) according to their in-department ranking.
For example, I can allocate students according to their relative position (relative position = student's rank in department/ number of students in the department). Students with lower relative postion will be assigned first.
While I have no idea how to use matlab to model this kind of problem, I was wondering if anyone could please give me some advice?
Many thanks!
  2 Commenti
Torsten
Torsten il 13 Apr 2023
Modificato: Torsten il 13 Apr 2023
First formulate your problem mathematically, then start watching out MATLAB on how to solve it.
Sam Chak
Sam Chak il 13 Apr 2023
@Rouyu Chen, Can you draw a table and show the ranking formula/algorithm?

Accedi per commentare.

Risposte (1)

Divyanshu
Divyanshu il 20 Apr 2023
Here is a demo MATLAB script which allocates students to K groups. Few assumptions taken are:
  • The number of places in each group is 3 and K = 3.
  • Each department has same number of students.
  • Total departments are 3 and each has 3 students.
depts = [1 2 3];
students = ["st1" "st2" "st3" "st4" "st5" "st6" "st7" "st8" "st9"];
dept_wise_rank = ["st2" "st3" "st1";"st4" "st6" "st5";"st7" "st8" "st9"];
% 2-D matrix ‘dept_wise_rank’ stores the students according to their relative rankings.
% Each row represents a department.
grp_matrix = [];
% The outer loop iterates over each department.
% The inner loop iterates over each student within a department.
for i=1:3
grp = [];
for j=1:3
grp = [grp dept_wise_rank(i,j)];
end
grp_matrix = [grp_matrix;grp];
end
% The grp_matrix is another 2-D matrix where each row represents a group.
grp_matrix
For more details about the concatenation operations on matrices and accessing of elements from a 2-D array, please go through the following documentations:

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by