hi im trying to do an automated class scheduling . can you give me suggestion on how can i constraint the assignment of rooms to their predefined buildings only? also avoid assigning in between lunchbreak
set CODE;
set ROOMS;
set DAYS ordered := {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
set TIME ordered := {"8:00am - 9:00am", "9:00am - 10:00am", "10:00am 11:00am", "11:00am - 12:00nn", "1:00pm - 2:00pm", "2:00pm - 3:00pm", "3:00pm - 4:00pm", "4:00pm - 5:00pm"};
param program{CODE} symbolic;
param section{CODE} symbolic;
param course_num{CODE} symbolic;
param course_title{CODE} symbolic;
param room{CODE} symbolic;
param lec{CODE} >= 0;
param lab{CODE} >= 0;
param teaching_load{CODE} >= 0;
param building{CODE} symbolic;
param buildings{ROOMS} symbolic;
param floor{ROOMS} symbolic;
param type{ROOMS} symbolic;
param lecture{ROOMS} binary;
param laboratory{ROOMS} binary;
# Read data from Excel
load amplxl.dll;
table overall IN "amplxl" "timetable.xlsx" "overall":
CODE <- [CODE], program, section, course_num, course_title, room, lec, lab, teaching_load, building;
table rooms IN "amplxl" "timetable.xlsx" "rooms":
ROOMS <- [ROOMS], buildings, floor, type, lecture, laboratory;
table b IN "amplxl" "timetable.xlsx" "buildings":
BUILDINGS <- [BUILDINGS];
read table overall;
read table rooms;
read table b;
var assignment{CODE, ROOMS, DAYS, TIME} binary;
var room_assigned{CODE, ROOMS} binary;
# Constraints
subject to required_hours_per_course{c in CODE}:
sum{r in ROOMS, d in DAYS, t in TIME} assignment[c, r, d, t] = lec[c] + lab[c];
subject to no_conflicts {r in ROOMS, d in DAYS, t in TIME}:
sum {c in CODE} assignment[c, r, d, t] <= 1;
subject to single_assignroom_per_slot{c in CODE, d in DAYS, t in TIME}:
sum{r in ROOMS} assignment[c, r, d, t] <= 1;
subject to same_room_per_code {c in CODE}:
sum{r in ROOMS} room_assigned[c, r] = 0 or sum{r in ROOMS} room_assigned[c, r] = card(ROOMS);
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/eafe8b1a-e286-4d10-a3e7-301762c85d03n%40googlegroups.com.