Igor Kondrasovas wrote: > ... > I decided also to go further and make the following test in a different > constraint (now performing a multiplication after addition), but its > seems to be something wrong in the last line when LHS is finally > constrained. I’m getting a “number expected in set_up_ic_con…” at > run-time (no messages at compilation). > > (for(K,1,NPieces),fromto(0,LHS1,LHS2,LHS), param(M, PieceLengths) do > > LHS2 = LHS1 + M[K,1] * PieceLengths[K] > > ), > > #Something not good here.... > > LHS #=< BarsLengths[1], Yes, sorry, mistake in my example code earlier. Because LHS is a symbolic expression (rather than a simple number or numeric variable), you have to wrap it in eval/1, i.e. eval(LHS) #=< BarsLengths[1] Alternatively, use the list variant I mentioned previously: (for(K,1,NPieces), foreach(P,Products), param(M, PieceLengths) do P = M[K,1] * PieceLengths[K] ), sum(Products) #=< BarsLengths[1] -- JoachimReceived on Thu Nov 05 2009 - 02:05:29 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST