フィルターのクリア

How to model an assignment/ allocation problem?

3 ビュー (過去 30 日間)
Rouyu Chen
Rouyu Chen 2023 年 4 月 13 日
回答済み: Divyanshu 2023 年 4 月 20 日
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 件のコメント
Torsten
Torsten 2023 年 4 月 13 日
編集済み: Torsten 2023 年 4 月 13 日
First formulate your problem mathematically, then start watching out MATLAB on how to solve it.
Sam Chak
Sam Chak 2023 年 4 月 13 日
@Rouyu Chen, Can you draw a table and show the ranking formula/algorithm?

サインインしてコメントする。

回答 (1 件)

Divyanshu
Divyanshu 2023 年 4 月 20 日
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:

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by