Hello all, I posted this e-mail erroneously to Kish, but my idea is to share it with all in the list: I have a preliminary version of my program running, but one important thing missing is that I need to dynamically impose the constraints, based on the length of the input arrays. Let me show an example with what I mean: linear(PieceLengths, BarsLengths, M) :- dim(PieceLengths, [NPieces]), dim(BarsLengths, [NBars]), dim(M,[NPieces,NBars]), M #::0..1, % Constraints that the sum of every column value in each row must be equals 1 M[1,1] + M[1,2] + M[1,3] #= 1, M[2,1] + M[2,2] + M[2,3] #= 1, M[3,1] + M[3,2] + M[3,3] #= 1, M[4,1] + M[4,2] + M[4,3] #= 1, M[5,1] + M[5,2] + M[5,3] #= 1, M[6,1] + M[6,2] + M[6,3] #= 1, M[7,1] + M[7,2] + M[7,3] #= 1, M[8,1] + M[8,2] + M[8,3] #= 1, M[9,1] + M[9,2] + M[9,3] #= 1, M[10,1] + M[10,2] + M[10,3] #= 1, As you can see here, this constrains are fixed and will work only when M is 10x3 matrix. I must change it in order to accept any input configuration. I imagine I can iterate to every single line of the M matrix using a simple for loop. But for the sum of the columns values a loop will not help me since I must "construct" the constraint instead of perform any calculation at every iteration. Is it possible to do with Eclipse? Thanks in advance for any help, Igor KondrasovasReceived on Mon Nov 02 2009 - 13:16:29 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST