Matrix Optimization using optimization toolbox

조회 수: 14 (최근 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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by