Can I obtain an algorithm for locally restricted weak compositions

asked 2023-02-15 01:42:28 +0100

brian Wilson gravatar image

I was looking for a non-recursive (gray code?) for generating all the k part weak compositions of an integer N { ie g(1)+g(2)2+…g(k)=N with the g(i).ge.0 ) but where each part has its own local restriction { ie 0.le.g(i).le.m(i) }. The only algorithm I could find in the literature was an article by Timothy R. Walsh : “Loop free sequencing of bounded integer compositons” published in JCMCC 33 (2000) pp.323-345 but I have not been able to make heads or tails out of the paper (it has three algorithms and It is not clear to me how each should be called in what sequence and what the initialization is). (I also suspect there may be typos in the pseudo code listed in the publication).

Any guidance would be most helpful.

Yours truly, Dr. Brian G. Wilson Lawrence Livermore National Laboratory

edit retag flag offensive close merge delete