Matrix Optimization using optimization toolbox

14 vues (au cours des 30 derniers jours)
Patrick  Martin
Patrick Martin le 13 Fév 2019
Commenté : Patrick Martin le 14 Fév 2019
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?

Réponse acceptée

Matt J
Matt J le 13 Fév 2019
Modifié(e) : Matt J le 13 Fév 2019
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 commentaire
Patrick  Martin
Patrick Martin le 14 Fév 2019
Worked perfectly! Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Problem-Based Optimization Setup dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by