Dear Sir, Greetings! My code is suffering from a strange problem. It is as following. Without the inner loop and list Vs, then everything is OK. All solutions of Fs is produced. However, when the inner loop, which is a simple mapping between list Fs and Vs, is added, only one solution of Fs is produced. The inner loop should have no impact on Fs. Where do I mess up? I know I can do the mapping when labeling(Fs) is done (It has been tested with correct output). However, since my final goal is to minimize a function which contains both Fs and Vs, Vs must be determined at the same time as Fs. Thank you in advance. dvf(Fs,Vs):- open("input.txt",read,sin), read(sin,Tn), read(sin,Tc), read(sin,Dl), read(sin,Levels), read(sin,Voltage), close(sin), length(Voltage,Vn), length(Vs,Tn), length(Fs,Tn), Fs::Levels, dim(Array,[Tn]), ( for(I,1,Tn), foreach(Ai,Tc), foreach(Fi,Fs), foreach(Vi,Vs), foreach(Di,Dl), foreachelem(T, Array), param(Tn,Tc,Fs,Dl,Array,Vs,Vn,Levels,Voltage) do T=Ai/Fi, Di $>= sum(Array[1..I]), ( for(J,1,Vn), param(Vn,Fi,Levels,Vi,Voltage) do Fi$=Levels[J] -> Vi is Voltage[J]; true ) ), labeling(Fs). Input.txt 7. [21, 25, 46, 91, 58, 82, 38]. [123, 146, 285, 367,488,500,600]. [1,2]. [10, 20]. Best, Liu,Yu 2009-09-07 liu.yu.senior.chinaReceived on Mon Sep 07 2009 - 23:55:24 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET