Welcome @marciobonadia,
Are you a Grasshopper beginner or advanced user, and privy to scripting (i.e. Python, C#) and such?
You could also be more precise about your algorithm and what it rules are? What sizes would the individual rectangles be? What are other rules to consider?
To be totally honest, this is a pretty involved topic (I think) and far less straightforward than you might think a first glance.
For instance, rectangle packing algorithms with rectangles of predefined sizes, won’t always find a solution, where the boundary rectangle is totally filled, or filled without any gaps between the individual rectangles.