Need help with an AMPL Model for the following: The professor in charge of an in
ID: 3773542 • Letter: N
Question
Need help with an AMPL Model for the following:
The professor in charge of an industrial engineering design course is faced with the problem of assigning 28 students to eight projects. Each student must be assigned to one project, and each project group must have 3 or 4 students. The students have been asked to rank the projects, with 1 being the best ranking and higher numbers representing lower rankings. The professor’s goal is to assign projects to every student while minimizing the sum of rankings.
Some of the projects are harder than others to reach without a car. Thus it is desirable that at least a certain number of students assigned to each project must have a car; the numbers of necessary cars vary by project as follows:
A 1 ED 0 EZ 0 G 2 H1 2 H2 2 RB 1 SC 1
The students who have cars are:
Chung, Eng, Manheim, Nathan, Rollins, Demming, Holmes, Morris, Patrick, and Young.
Modify the model to add this car constraint, and solve the problem.
Formulate and solve and alegebraric model in AMPL for the following table of rankings.
I need to know what to put in a .mod file and a .dat file
Explanation / Answer
set STU; # students
set PRJ; # projects
param teamSizeLo {PRJ} integer >= 0;
param teamSizeHi {p in PRJ} integer >= teamSizeLo[p];
# limits on project team sizes
param assignRank {STU,PRJ} integer >= 1, <= card {PRJ};
# student rankings for projects, 1 for the top ranked
var Assign {STU,PRJ} >= 0, <= 1;
# Assign[s,p] is 1 if student s is assigned project p
# Assign[s,p] is 0 otherwise
minimize TotalRank:
sum {s in STU, p in PRJ} assignRank[s,p] * Assign[s,p];
subject to StuAssign {s in STU}:
sum {p in PRJ} Assign[s,p] = 1;
subject to PrjAssign {p in PRJ}:
teamSizeLo[p] <= sum {s in STU} Assign[s,p] <= teamSizeHi[p];
model for grouping students into project teams so as to maximize the sum of students’ preferences for the projects to which they are assigned(assign.mod).
ORIG - STU # students
DEST - PRJ # projects
Every student must be assigned. Viewed as a separate “origin,” the lower and upper number of assignments for each student are both 1. For the projects, the
lower and upper number of assignments are the limits on the project team size.
Thus we have:
origLo - 1 # each student assigned to
origHi - 1 # exactly one team
destLo - teamSizeLo # lower and upper limits
destHi - teamSizeHi # on size of teams
Because origLo and origHi both become 1, the inequality constraint OrigAvl
in Figure 5–3 becomes 1 <= sum {d in DEST} Ship[o,d] <= 1,
which collapses to an equality.
It remains to reinterpret as assignments the transportation model’s references
to shipments. We would like to claim the following:
shipLo - 0
shipHi - 1
shipCost - assignRank
Ship - Assign # Assign[s,p] = 1 if student s put in group p
# Assign[s,p] = 0 if not
set STU :=
Cane Gentil Chung Michael Goldrich Matthew Grasparil Michelle
Henry Steve Jurishica Carley Laurie Alina Lawless Katie
Morrow Timothy Rincones Daianna Shakoor Kashif Sheth Vihar
Stewart Eric Urquhart Geoff Walton Caroline Welsch Todd
Wible Barry Yee Christine Yuen Gigi ;
param: PRJ: teamSizeLo teamSizeHi :=
Abbott 3 4
GM EMD 3 4
Littelfuse 3 4
NMFF 3 4
UOP 3 4
Zebra 3 4 ;
param assignRank: Abbott GM EMD Littelfuse NMFF UOP Zebra :=
Cane Gentil 5 4 3 1 2 6
Chung Michael 1 4 2 5 2 6
Goldrich Matthew 2 5 6 1 3 3
Grasparil Michelle 3 6 4 1 2 5
Henry Steve 5 1 4 6 3 2
Jurishica Carley 2 3 5 1 4 6
Laurie Alina 4 5 2 1 2 6
Lawless Katie 6 1 5 3 2 4
Morrow Timothy 6 5 4 3 2 1
Rincones Daianna 1 2 3 5 4 6
Shakoor Kashif 2 3 1 6 4 5
Sheth Vihar 1 2 3 5 4 6
Stewart Eric 4 2 6 1 4 3
Urquhart Geoff 5 1 4 6 3 2
Walton Caroline 5 1 3 6 4 2
Welsch Todd 5 1 2 6 4 2
Wible Barry 6 3 1 5 3 2
Yee Christine 4 5 2 1 2 6
Yuen Gigi 4 5 2 1 2 6 ;
To see why this makes sense, observe first that since there is only one student available to be “shipped” from each “origin,” all of the Assign[s,p] variables must be <= 1 as well as >= 0. When also shipCost is replaced by assignRank, the terms of the objective all have the form assignRank[s,p] * Assign[s,p], for some student s and project p. This gives two possibilities for each term: If s is assigned to p, then Assign[s,p] is 1, in which case the objective term assignRank[s,p] * Assign[s,p] takes the value assignRank[s,p]. If s is not assigned to p, then Assign[s,p] is 0, in which case the objective term assignRank[s,p] * Assign[s,p] takes the value 0.