Hello,
I have difficulty to formulate/program an assignment problem.
The problem can be described as follows:
Assume that we have total 3 researchers to review 400 papers.
Each paper must be reviewed by 2 different researchers.
How to assign those 3 researchers to review 400 papers?
Can somebody please give me some ideas on how to get the problem formulated?
Thank you,
Here is sample code for a maximization problem where each researcher is eligible to review each paper:
data ResearcherData;
do researcher = 1 to 3;
output;
end;
run;
data PaperData;
do paper = 1 to 400;
output;
end;
run;
data ScoreData;
call streaminit(1);
do researcher = 1 to 3;
do paper = 1 to 400;
score = rand('UNIFORM');
output;
end;
end;
run;
proc optmodel;
set RESEARCHERS;
set PAPERS;
num score {RESEARCHERS, PAPERS};
read data ResearcherData into RESEARCHERS=[researcher];
read data PaperData into PAPERS=[paper];
read data ScoreData into [researcher paper] score;
var X {RESEARCHERS, PAPERS} binary;
max TotalScore = sum {r in RESEARCHERS, p in PAPERS} score[r,p]*X[r,p];
con TwoReviewersPerPaper {p in PAPERS}:
sum {r in RESEARCHERS} X[r,p] = 2;
con EqualWorkload {r in RESEARCHERS}:
floor(2*card(PAPERS)/card(RESEARCHERS)) <= sum {p in PAPERS} X[r,p] <= ceil(2*card(PAPERS)/card(RESEARCHERS));
solve;
create data SolutionData from [researcher paper]={r in RESEARCHERS, p in PAPERS: X[r,p].sol > 0.5} score;
quit;
Is the assignment done randomly?
Or is it supposed to be non-random, so if there are 800 reviews and 3 reviewers, each reviewer should be assigned to review either 266 or 267 papers?
Sorry. forgot to add one constraint: each researcher should have equal workload.
So if we call the reviewers A B and C, then each paper gets assigned 2 of them.
Make a list the 400 papers, then the first one gets assigned to A and B, the second one gets assigned to A and C, the third one gets assigned B and C. Repeat for all subsequent groups of 3 papers.
Could you offer the SAS code to make more general?
Thanks,
data fake_data;
do paper=1 to 400;
output;
end;
run;
data assign;
set fake_data;
if mod(_n_,3)=1 then reviewers='A B';
else if mod(_n_,3)=2 then reviewers='A C';
else if mod(_n_,3)=0 then reviewers='B C';
run;
A few different ways.
This is relatively easy to run and should be distributed evenly.
data want;
set sashelp.class;
array _ran(3) a b c; *a, b, c are the names of the reviewers;
do i=1 to 3;
_ran(i) = ranuni(25);
end;
first_reviewer = vname(_ran(whichn(smallest(1, of _ran(*)), of _ran(*))));
second_reviewer = vname(_ran(whichn(smallest(2, of _ran(*)), of _ran(*))));
drop a b c i;
run;
Another would be to cross join with the full list of reviewers and then use PROC SURVEYSELECT to select 2 names per paper, which would guarantee a random sample.
@t75wez1 wrote:
Hello,
I have difficulty to formulate/program an assignment problem.
The problem can be described as follows:
Assume that we have total 3 researchers to review 400 papers.
Each paper must be reviewed by 2 different researchers.
How to assign those 3 researchers to review 400 papers?
Can somebody please give me some ideas on how to get the problem formulated?
Thank you,
Many thanks for your elegant solution!
Are there researcher-paper scores that you want to maximize or minimize?
I don't the researcher-paper scores for the time being, but I can ask them.
Thanks,
And are all researcher-paper pairs eligible to be assigned, or are there some incompatibilities that must be respected?
I don't have the information for eligibility and incompatibilities of those researchers.
Thanks,
Here is sample code for a maximization problem where each researcher is eligible to review each paper:
data ResearcherData;
do researcher = 1 to 3;
output;
end;
run;
data PaperData;
do paper = 1 to 400;
output;
end;
run;
data ScoreData;
call streaminit(1);
do researcher = 1 to 3;
do paper = 1 to 400;
score = rand('UNIFORM');
output;
end;
end;
run;
proc optmodel;
set RESEARCHERS;
set PAPERS;
num score {RESEARCHERS, PAPERS};
read data ResearcherData into RESEARCHERS=[researcher];
read data PaperData into PAPERS=[paper];
read data ScoreData into [researcher paper] score;
var X {RESEARCHERS, PAPERS} binary;
max TotalScore = sum {r in RESEARCHERS, p in PAPERS} score[r,p]*X[r,p];
con TwoReviewersPerPaper {p in PAPERS}:
sum {r in RESEARCHERS} X[r,p] = 2;
con EqualWorkload {r in RESEARCHERS}:
floor(2*card(PAPERS)/card(RESEARCHERS)) <= sum {p in PAPERS} X[r,p] <= ceil(2*card(PAPERS)/card(RESEARCHERS));
solve;
create data SolutionData from [researcher paper]={r in RESEARCHERS, p in PAPERS: X[r,p].sol > 0.5} score;
quit;
what is the benefit of the PROC OPTMODEL solution compared to the solution I gave above?
The PROC OPTMODEL code solves an optimization problem to maximize the total score rather than just satisfying the constraints.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.