I need to do some resource allocation work using ECLiPSe. I was trying out a small problem where there are : 3 Resources a,b and c with skill levels 5, 4,2 respectively. There are three Tasks T1, T2 and T3 which have to be done by the above resources and require a skill level of 5,2,4 respectively. How do I allocate the resources to the above tasks. I have written a small routine - but it does not seem to be working. Can anyone help me out in this ? Thanks Ranjana %Task allocating to resources :-lib(fd). :-lib(structures). :-define_struct(task(taskID,start,duration, skill, resID)). :-define_struct(resource(id,skill)). resAlloc(StartTimes,Resources):- Tasks =[T1,T2,T3], TaskSkill5 #= 5..5, TaskSkill4 #= 4..4, TaskSkill2 #= 2..2, StartTimes = [S1,S2,S3], StartTimes :: 9..24, Resources =[RT1,RT2,RT3], Resources ::[a,b,c], R1 = resource with [id:a , skill:TaskSkill5], R2 = resource with [id:b , skill:TaskSkill4], R3 = resource with [id:c , skill:TaskSkill2], S1#=10, S2 #> S1 +2, S3 #>= S1+5, T1 = task with [taskID:1, start:S1, duration:1, skill:TaskSkill5, resID : RT1], T2 = task with [taskID :2, start:S2, duration:2, skill :TaskSkill2,resID :RT2], T3 = task with [taskID :3, start:S3, duration:1, skill :TaskSkill4,resID:RT3], label_resource_assignment(Tasks,Resources), labeling(Resources), labeling(StartTimes). label_resource_assignment(Tasks,Resources):- (foreach(Task,Tasks), param(Resources) do (foreach(Resource,Resources), param(Task) do Task = task with [skill: TaskSkill, resID :Res], Resource = resource with [skill:ResSkill, id : ResId], ( TaskSkill == ResSkill -> Res =ResId ; true ) ) ).Received on Wed Jul 28 14:18:48 1999
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:04 PM GMT GMT