BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
t75wez1
Pyrite | Level 9

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,

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

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;

View solution in original post

25 REPLIES 25
PaigeMiller
Diamond | Level 26

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?

--
Paige Miller
t75wez1
Pyrite | Level 9

Sorry. forgot to add one constraint: each researcher should have equal workload.

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
t75wez1
Pyrite | Level 9

Could you offer the SAS code to make more general?

Thanks,

 

PaigeMiller
Diamond | Level 26
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;
--
Paige Miller
Reeza
Super User

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,


 

t75wez1
Pyrite | Level 9

Many thanks for your elegant solution!

RobPratt
SAS Super FREQ

Are there researcher-paper scores that you want to maximize or minimize?

t75wez1
Pyrite | Level 9

I don't the researcher-paper scores for the time being, but I can ask them.

Thanks,

RobPratt
SAS Super FREQ

And are all researcher-paper pairs eligible to be assigned, or are there some incompatibilities that must be respected?

t75wez1
Pyrite | Level 9

I don't have the information for eligibility and incompatibilities of those researchers.

 

Thanks,

RobPratt
SAS Super FREQ

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;
PaigeMiller
Diamond | Level 26

@RobPratt 

 

what is the benefit of the PROC OPTMODEL solution compared to the solution I gave above?

--
Paige Miller
RobPratt
SAS Super FREQ

The PROC OPTMODEL code solves an optimization problem to maximize the total score rather than just satisfying the constraints.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 25 replies
  • 1064 views
  • 4 likes
  • 5 in conversation