assignment problem
Standard form for assignment questions
Mathematical Model of Assignment Problem
Assignment problems in non-standard form
General procedure for the Hungarian solution to the assignment problem
The above steps are not easy to understand. Let's show some examples to facilitate understanding.
Example of Hungarian solution
This is a more friendly example, just follow the steps and give
another example that is a bit convoluted
Computer Solutions to Assignment Problems
Integer programming problems can be solved using special software such as Lingo. For general integer programming problems, Matlab functions cannot be used directly, and Matlab programming must be used to implement branch and bound solutions and cutting plane solutions. However, for special integer programming problems such as assignment problems, Matlab's function linprog can sometimes be used directly.
Use MATLAB to solve the following assignment matrix
c=[3 8 2 10 3;8 7 2 9 7;6 4 2 7 5; 8 4 2 3 5;9 10 6 9 10];
c=c(:);
%把矩阵c转化为25维列向量
a=zeros(10,25);
%10表示有5行5列的共10个约束(行列xij的和=1)25表示有25种xij类型
for i=1:5
a(i,(i-1)*5+1:5*i)=1;
a(5+i,i:5:25)=1;%每行每列相加等于一
end
%此循环把指派问题转化为线性规划问题
b=ones(10,1);
[x,y]=linprog(c,[],[],a,b,zeros(25,1),ones(25,1));
%zeros(25,1),ones(25,1)指的是取值要么是0要么去1
X=reshape(x,5,5)
%把x变成5*5的矩阵
opt=y
Running results
In order to better understand the code, the specific element distribution of matrix a is given