Hi All, I have a simple student class allocation problem with disjoint resources. I have modelled it in 2 different ways. 1) A list of class terms with fixed task ID, but variable Resource and Time, i.e. class(1,R,T). class(2,R,T). and 2) A matrix of class codes with rows and column positions indicating Resource and Time Each method works. However each model has characteristics that make it desirable from the perspective of implementing hard constraints, soft constraints and symmetry breaking strategies. What I would like to do is use both models in a solution and join them. I understand that this can be done (more or less) with a channelling constraint or an implied constraint. What I would expect is that once in place, these constraints would propagate changes between models. However, examples of this are thin. Can anyone please suggest a possible strategy? One experiment I have tried (shown below) is to delay setting the matrix class until the R and T for the task in the list method is set. This has obvious propogation issues in that we are waiting for both to ground. Code so far is below. Cheers, Pat :- lib(ic). :- lib(ic_global). go:- Time::1..2, Room::1..2, findall(class(Class,Time,Room),class(Class,Time,Room),Classes), dim(ClassMatrix, [2,2]), ClassMatrix[1..2,1..2]::1..4, ( foreach(class(C,T,R),Classes),param(ClassMatrix) do channel(R,T,C,ClassMatrix) ), ic_global:alldifferent(ClassMatrix), term_variables(Classes,ClassesV), search(ClassesV,0,input_order,indomain,complete,[]), writeln(Classes). delay channel(R,T,C,M) if nonground((R,T)). channel(R,T,C,Matrix) :- subscript(Matrix,[R,T],C). class(1,_,_). class(2,_,_). class(3,_,_). class(4,_,_).Received on Wed Oct 24 2007 - 02:02:55 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET