[patjanssen said:]

Hi,I am using OPL 3.7 to try to solve a job shop scheduling problem. There are 8 tasks per job. The number of jobs and resources used are given by an input file in excel. I have been able to code the problem using Constraint programming and minimizing the makespan. But I also have to be able to solve it using the shortest processing time heuristic. Would I be able to use the same code but have the shortest processing time heuristic implemented using a search and rank function? I have attached the code for the constraint program. Please help!

SheetConnection sheetData("C:\Documents and Settings\admin\Desktop\Template.xls");

{string} Jobs from SheetRead(sheetData,"Shoes");

{int} Machines from SheetRead(sheetData, "Machines");

int nbActivities = ...;

range Activities 1..nbActivities;

int+ resource[Jobs,Activities] from SheetRead(sheetData, "Assignment");

float+ duration[Jobs,Activities] from SheetRead(sheetData, "Duration");

int totalDuration = sum(j in Jobs, a in Activities) duration[j,a];

scheduleHorizon = totalDuration;

Activity activity[j in Jobs, t in Activities](duration[j,t]);

Activity makespan(0);

UnaryResource tool[Machines];

minimize

makespan.end

subject to {

forall(j in Jobs)

activity[j,nbActivities] precedes makespan;

forall(j in Jobs)

forall(t in 1..nbActivities-1)

activity[j,t] precedes activity[j,t+1];

forall(j in Jobs)

forall(t in Activities)

activity[j,t] requires tool[resource[j,t]];

};