Patrick Pleass wrote: > 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. Dear Pat, Basically, you need a constraint that links the value in a matrix with its indexes. I don't think there is such a constraint in ECLiPSe, but you can build it yourself. The first idea that came to my mind would be to use the element constraint, but it requires the list to be ground. Since you already have a predicate with the same semantics of the constraint, one idea would be to convert it into a constraint using library Propia. E.g.: channel(R,T,C,Matrix) :- indomain(R), indomain(T), subscript(Matrix,[R,T],C). and then call it with channel(...) infers most. i.e., go:- ... ( foreach(class(C,T,R),Classes),param(ClassMatrix) do channel(R,T,C,ClassMatrix) infers most ), ... (Disclaimer: untested) It is probably not the most efficient solution, but it is "rapid prototyping" and should perform stronger propagation. Best, Marco -- Marco Gavanelli, Ph.D. Computer Science Division Dipartimento di Ingegneria University of Ferrara Via Saragat 1 - 44100 Ferrara (Italy) Tel +39-0532-97-4833 Fax +39-0532-97-4870 http://www.ing.unife.it/docenti/MarcoGavanelli/Received on Thu Oct 25 2007 - 11:07:40 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST