Matrix Optimization using optimization toolbox

11 ビュー (過去 30 日間)
Patrick  Martin
Patrick Martin 2019 年 2 月 13 日
コメント済み: Patrick Martin 2019 年 2 月 14 日
I have a matrix with each row being a task and each column being a worker. The cells contain a performance for each worker on each task. Each worker can take up to two tasks with each task only requiring one worker. I want to alocate workers in a way that maximizes performance. How would i go about doing this?

採用された回答

Matt J
Matt J 2019 年 2 月 13 日
編集済み: Matt J 2019 年 2 月 13 日
Should be pretty easy with the problem-based linear program solver,
X = optimvar('X',numTasks,numWorkers,'Type','integer','LowerBound',0,'UpperBound',1);
prob = optimproblem('ObjectiveSense','maximize');
prob.Constraints.oneworker=sum(X,2)<=1;
prob.Constraints.maxTasks=sum(X,1)<=2;
prob.Objective=sum(performances(:).*X(:));
Xsolution = solve(prob);
  1 件のコメント
Patrick  Martin
Patrick Martin 2019 年 2 月 14 日
Worked perfectly! Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by